Skip to content

Commit 4d0198d

Browse files
surendralilhorezsdaroczi
authored andcommitted
HDFS-14796. Define LOG instead of BlockManager.LOG in ErasureCodingWork/ReplicationWork. Contributed by Fei Hui.
Change-Id: I281deae1a86fbecf0fb2db985d41c31decafadeb
1 parent e38dc14 commit 4d0198d

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockReconstructionWork.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
package org.apache.hadoop.hdfs.server.blockmanagement;
1919

2020
import org.apache.hadoop.net.Node;
21+
import org.slf4j.Logger;
22+
import org.slf4j.LoggerFactory;
2123

2224
import java.util.Collections;
2325
import java.util.List;
@@ -30,6 +32,10 @@
3032
* Reconstruction is done by transferring data from srcNodes to targets
3133
*/
3234
abstract class BlockReconstructionWork {
35+
36+
public static final Logger LOG =
37+
LoggerFactory.getLogger(BlockReconstructionWork.class);
38+
3339
private final BlockInfo block;
3440

3541
private final String srcPath;

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/ErasureCodingWork.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public ErasureCodingWork(String blockPoolId, BlockInfo block,
4646
this.blockPoolId = blockPoolId;
4747
this.liveBlockIndicies = liveBlockIndicies;
4848
this.liveBusyBlockIndicies = liveBusyBlockIndicies;
49-
BlockManager.LOG.debug("Creating an ErasureCodingWork to {} reconstruct ",
49+
LOG.debug("Creating an ErasureCodingWork to {} reconstruct ",
5050
block);
5151
}
5252

@@ -163,10 +163,8 @@ private void createReplicationWork(int sourceIndex,
163163
internBlkLen, stripedBlk.getGenerationStamp());
164164
source.addBlockToBeReplicated(targetBlk,
165165
new DatanodeStorageInfo[] {target});
166-
if (BlockManager.LOG.isDebugEnabled()) {
167-
BlockManager.LOG.debug("Add replication task from source {} to "
168-
+ "target {} for EC block {}", source, target, targetBlk);
169-
}
166+
LOG.debug("Add replication task from source {} to "
167+
+ "target {} for EC block {}", source, target, targetBlk);
170168
}
171169

172170
private List<Integer> findLeavingServiceSources() {

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/ReplicationWork.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public ReplicationWork(BlockInfo block, BlockCollection bc,
3333
assert getSrcNodes().length == 1 :
3434
"There should be exactly 1 source node that have been selected";
3535
getSrcNodes()[0].incrementPendingReplicationWithoutTargets();
36-
BlockManager.LOG
37-
.debug("Creating a ReplicationWork to reconstruct " + block);
36+
LOG.debug("Creating a ReplicationWork to reconstruct " + block);
3837
}
3938

4039
@Override

0 commit comments

Comments
 (0)