private boolean shouldSubmitMove ( PolicyInfo policy , Map < String , Integer > nodeToNumBlocks , List < BlockInfo > stripeBlocks ) { if ( policy == null ) { return true ; } int targetRepl = Integer . parseInt ( policy . getProperty ( "targetReplication" ) ) ; int parityRepl = Integer . parseInt ( policy . getProperty ( "metaReplication" ) ) ; Codec codec = Codec . getCodec ( policy . getCodecId ( ) ) ; int numParityBlks = codec . parityLength ; int numSrcBlks = stripeBlocks . size ( ) - numParityBlks ; int expectNumReplicas = numSrcBlks * targetRepl + numParityBlks * parityRepl ; int actualNumReplicas = 0 ; for ( int num : nodeToNumBlocks . values ( ) ) { actualNumReplicas += num ; } if ( actualNumReplicas != expectNumReplicas ) { String msg = "Expected number of replicas in the stripe: " + expectNumReplicas + ", but actual number is: " + actualNumReplicas + ". " ; if ( stripeBlocks . size ( ) > 0 ) { msg += "filePath: " + stripeBlocks . get ( 0 ) . file . getPath ( ) ; } LOG . warn ( msg ) ; } return actualNumReplicas == expectNumReplicas ; }
We will not submit more block move if the namenode hasn t deleted the over replicated blocks yet .