[ https://issues.apache.org/jira/browse/HDFS-17363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
farmmamba updated HDFS-17363: ----------------------------- Description: In method getBlockRecoveryCommand, we have below codes: {code:java} else { rBlock = new RecoveringBlock(primaryBlock, recoveryInfos, uc.getBlockRecoveryId()); if (b.isStriped()) { rBlock = new RecoveringStripedBlock(rBlock, uc.getBlockIndicesForSpecifiedStorages(storageIdx), ((BlockInfoStriped) b).getErasureCodingPolicy()); } {code} It seems that we initialize RecoveringBlock object every time even though b.isStriped returns true. This is unnecessary. was: In method getBlockRecoveryCommand, we have below codes: {code:java} else { rBlock = new RecoveringBlock(primaryBlock, recoveryInfos, uc.getBlockRecoveryId()); if (b.isStriped()) { rBlock = new RecoveringStripedBlock(rBlock, uc.getBlockIndicesForSpecifiedStorages(storageIdx), ((BlockInfoStriped) b).getErasureCodingPolicy()); } {code} It seems that we initialize RecoveringBlock object every time even though b.isStriped returns true. This is > Avoid initializing unnecessary objects in method getBlockRecoveryCommand > ------------------------------------------------------------------------ > > Key: HDFS-17363 > URL: https://issues.apache.org/jira/browse/HDFS-17363 > Project: Hadoop HDFS > Issue Type: Improvement > Components: namenode > Reporter: farmmamba > Assignee: farmmamba > Priority: Major > > In method getBlockRecoveryCommand, we have below codes: > {code:java} > else { > rBlock = new RecoveringBlock(primaryBlock, recoveryInfos, > uc.getBlockRecoveryId()); > if (b.isStriped()) { > rBlock = new RecoveringStripedBlock(rBlock, > uc.getBlockIndicesForSpecifiedStorages(storageIdx), > ((BlockInfoStriped) b).getErasureCodingPolicy()); > } {code} > It seems that we initialize RecoveringBlock object every time even though > b.isStriped returns true. > This is unnecessary. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org