Skip to content

Commit 10cdde5

Browse files
authored
HDFS-16375. The FBR lease ID should be exposed to the log (#3769)
1 parent 6ea1685 commit 10cdde5

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,6 +2741,8 @@ public boolean processReport(final DatanodeID nodeID,
27412741
Collection<Block> invalidatedBlocks = Collections.emptyList();
27422742
String strBlockReportId =
27432743
context != null ? Long.toHexString(context.getReportId()) : "";
2744+
String fullBrLeaseId =
2745+
context != null ? Long.toHexString(context.getLeaseId()) : "";
27442746

27452747
try {
27462748
node = datanodeManager.getDatanode(nodeID);
@@ -2763,20 +2765,20 @@ public boolean processReport(final DatanodeID nodeID,
27632765
if (namesystem.isInStartupSafeMode()
27642766
&& !StorageType.PROVIDED.equals(storageInfo.getStorageType())
27652767
&& storageInfo.getBlockReportCount() > 0) {
2766-
blockLog.info("BLOCK* processReport 0x{}: "
2768+
blockLog.info("BLOCK* processReport 0x{} with lease ID 0x{}: "
27672769
+ "discarded non-initial block report from {}"
27682770
+ " because namenode still in startup phase",
2769-
strBlockReportId, nodeID);
2771+
strBlockReportId, fullBrLeaseId, nodeID);
27702772
blockReportLeaseManager.removeLease(node);
27712773
return !node.hasStaleStorages();
27722774
}
27732775

27742776
if (storageInfo.getBlockReportCount() == 0) {
27752777
// The first block report can be processed a lot more efficiently than
27762778
// ordinary block reports. This shortens restart times.
2777-
blockLog.info("BLOCK* processReport 0x{}: Processing first "
2779+
blockLog.info("BLOCK* processReport 0x{} with lease ID 0x{}: Processing first "
27782780
+ "storage report for {} from datanode {}",
2779-
strBlockReportId,
2781+
strBlockReportId, fullBrLeaseId,
27802782
storageInfo.getStorageID(),
27812783
nodeID);
27822784
processFirstBlockReport(storageInfo, newReport);
@@ -2795,8 +2797,8 @@ public boolean processReport(final DatanodeID nodeID,
27952797

27962798
if(blockLog.isDebugEnabled()) {
27972799
for (Block b : invalidatedBlocks) {
2798-
blockLog.debug("BLOCK* processReport 0x{}: {} on node {} size {} " +
2799-
"does not belong to any file.", strBlockReportId, b,
2800+
blockLog.debug("BLOCK* processReport 0x{} with lease ID 0x{}: {} on node {} size {} " +
2801+
"does not belong to any file.", strBlockReportId, fullBrLeaseId, b,
28002802
node, b.getNumBytes());
28012803
}
28022804
}
@@ -2806,9 +2808,9 @@ public boolean processReport(final DatanodeID nodeID,
28062808
if (metrics != null) {
28072809
metrics.addStorageBlockReport((int) (endTime - startTime));
28082810
}
2809-
blockLog.info("BLOCK* processReport 0x{}: from storage {} node {}, " +
2811+
blockLog.info("BLOCK* processReport 0x{} with lease ID 0x{}: from storage {} node {}, " +
28102812
"blocks: {}, hasStaleStorage: {}, processing time: {} msecs, " +
2811-
"invalidatedBlocks: {}", strBlockReportId, storage.getStorageID(),
2813+
"invalidatedBlocks: {}", strBlockReportId, fullBrLeaseId, storage.getStorageID(),
28122814
nodeID, newReport.getNumberOfBlocks(),
28132815
node.hasStaleStorages(), (endTime - startTime),
28142816
invalidatedBlocks.size());

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,8 @@ List<DatanodeCommand> blockReport(long fullBrLeaseId) throws IOException {
455455
dn.getMetrics().addBlockReport(brSendCost, getRpcMetricSuffix());
456456
final int nCmds = cmds.size();
457457
LOG.info((success ? "S" : "Uns") +
458-
"uccessfully sent block report 0x" +
459-
Long.toHexString(reportId) + " to namenode: " + nnAddr +
458+
"uccessfully sent block report 0x" + Long.toHexString(reportId) +
459+
" with lease ID 0x" + Long.toHexString(fullBrLeaseId) + " to namenode: " + nnAddr +
460460
", containing " + reports.length +
461461
" storage report(s), of which we sent " + numReportsSent + "." +
462462
" The reports had " + totalBlockCount +

0 commit comments

Comments
 (0)