HDFS-14796. Define LOG instead of BlockManager.LOG in ErasureCodingWork/ReplicationWork. Contributed by Fei Hui.

This commit is contained in:
Surendra Singh Lilhore 2019-08-30 14:28:13 +05:30
parent 22a58615a2
commit 96f7dc1992
3 changed files with 10 additions and 7 deletions

View File

@ -18,6 +18,8 @@
package org.apache.hadoop.hdfs.server.blockmanagement; package org.apache.hadoop.hdfs.server.blockmanagement;
import org.apache.hadoop.net.Node; import org.apache.hadoop.net.Node;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -30,6 +32,10 @@
* Reconstruction is done by transferring data from srcNodes to targets * Reconstruction is done by transferring data from srcNodes to targets
*/ */
abstract class BlockReconstructionWork { abstract class BlockReconstructionWork {
public static final Logger LOG =
LoggerFactory.getLogger(BlockReconstructionWork.class);
private final BlockInfo block; private final BlockInfo block;
private final String srcPath; private final String srcPath;

View File

@ -44,7 +44,7 @@ public ErasureCodingWork(String blockPoolId, BlockInfo block,
liveReplicaStorages, additionalReplRequired, priority); liveReplicaStorages, additionalReplRequired, priority);
this.blockPoolId = blockPoolId; this.blockPoolId = blockPoolId;
this.liveBlockIndicies = liveBlockIndicies; this.liveBlockIndicies = liveBlockIndicies;
BlockManager.LOG.debug("Creating an ErasureCodingWork to {} reconstruct ", LOG.debug("Creating an ErasureCodingWork to {} reconstruct ",
block); block);
} }
@ -157,10 +157,8 @@ private void createReplicationWork(int sourceIndex,
internBlkLen, stripedBlk.getGenerationStamp()); internBlkLen, stripedBlk.getGenerationStamp());
source.addBlockToBeReplicated(targetBlk, source.addBlockToBeReplicated(targetBlk,
new DatanodeStorageInfo[] {target}); new DatanodeStorageInfo[] {target});
if (BlockManager.LOG.isDebugEnabled()) { LOG.debug("Add replication task from source {} to "
BlockManager.LOG.debug("Add replication task from source {} to " + "target {} for EC block {}", source, target, targetBlk);
+ "target {} for EC block {}", source, target, targetBlk);
}
} }
private List<Integer> findLeavingServiceSources() { private List<Integer> findLeavingServiceSources() {

View File

@ -32,8 +32,7 @@ public ReplicationWork(BlockInfo block, BlockCollection bc,
assert getSrcNodes().length == 1 : assert getSrcNodes().length == 1 :
"There should be exactly 1 source node that have been selected"; "There should be exactly 1 source node that have been selected";
getSrcNodes()[0].incrementPendingReplicationWithoutTargets(); getSrcNodes()[0].incrementPendingReplicationWithoutTargets();
BlockManager.LOG LOG.debug("Creating a ReplicationWork to reconstruct " + block);
.debug("Creating a ReplicationWork to reconstruct " + block);
} }
@Override @Override