public boolean checkRaidProgress ( INodeFile sourceINode , LightWeightLinkedSet < RaidBlockInfo > raidEncodingTasks , FSNamesystem fs , boolean forceAdd ) throws IOException { boolean result = true ; BlockInfo [ ] blocks = sourceINode . getBlocks ( ) ; for ( int i = 0 ; i < blocks . length ; i += numStripeBlocks ) { boolean hasParity = true ; if ( ! forceAdd ) { for ( int j = 0 ; j < numParityBlocks ; j ++ ) { if ( fs . countLiveNodes ( blocks [ i + j ] ) < this . parityReplication ) { hasParity = false ; break ; } } } if ( ! hasParity || forceAdd ) { raidEncodingTasks . add ( new RaidBlockInfo ( blocks [ i ] , parityReplication , i ) ) ; result = false ; } } return result ; }
Count the number of live replicas of each parity block in the raided file If any stripe has not enough parity block replicas add the stripe to raidEncodingTasks to schedule encoding . If forceAdd is true we always add the stripe to raidEncodingTasks without checking