HDFS-16375. The FBR lease ID should be exposed to the log (#3769)

This commit is contained in:
litao 2021-12-16 12:29:32 +08:00 committed by GitHub
parent 6ea1685abd
commit 10cdde59b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View File

@ -2741,6 +2741,8 @@ public boolean processReport(final DatanodeID nodeID,
Collection<Block> invalidatedBlocks = Collections.emptyList();
String strBlockReportId =
context != null ? Long.toHexString(context.getReportId()) : "";
String fullBrLeaseId =
context != null ? Long.toHexString(context.getLeaseId()) : "";
try {
node = datanodeManager.getDatanode(nodeID);
@ -2763,10 +2765,10 @@ public boolean processReport(final DatanodeID nodeID,
if (namesystem.isInStartupSafeMode()
&& !StorageType.PROVIDED.equals(storageInfo.getStorageType())
&& storageInfo.getBlockReportCount() > 0) {
blockLog.info("BLOCK* processReport 0x{}: "
blockLog.info("BLOCK* processReport 0x{} with lease ID 0x{}: "
+ "discarded non-initial block report from {}"
+ " because namenode still in startup phase",
strBlockReportId, nodeID);
strBlockReportId, fullBrLeaseId, nodeID);
blockReportLeaseManager.removeLease(node);
return !node.hasStaleStorages();
}
@ -2774,9 +2776,9 @@ public boolean processReport(final DatanodeID nodeID,
if (storageInfo.getBlockReportCount() == 0) {
// The first block report can be processed a lot more efficiently than
// ordinary block reports. This shortens restart times.
blockLog.info("BLOCK* processReport 0x{}: Processing first "
blockLog.info("BLOCK* processReport 0x{} with lease ID 0x{}: Processing first "
+ "storage report for {} from datanode {}",
strBlockReportId,
strBlockReportId, fullBrLeaseId,
storageInfo.getStorageID(),
nodeID);
processFirstBlockReport(storageInfo, newReport);
@ -2795,8 +2797,8 @@ public boolean processReport(final DatanodeID nodeID,
if(blockLog.isDebugEnabled()) {
for (Block b : invalidatedBlocks) {
blockLog.debug("BLOCK* processReport 0x{}: {} on node {} size {} " +
"does not belong to any file.", strBlockReportId, b,
blockLog.debug("BLOCK* processReport 0x{} with lease ID 0x{}: {} on node {} size {} " +
"does not belong to any file.", strBlockReportId, fullBrLeaseId, b,
node, b.getNumBytes());
}
}
@ -2806,9 +2808,9 @@ public boolean processReport(final DatanodeID nodeID,
if (metrics != null) {
metrics.addStorageBlockReport((int) (endTime - startTime));
}
blockLog.info("BLOCK* processReport 0x{}: from storage {} node {}, " +
blockLog.info("BLOCK* processReport 0x{} with lease ID 0x{}: from storage {} node {}, " +
"blocks: {}, hasStaleStorage: {}, processing time: {} msecs, " +
"invalidatedBlocks: {}", strBlockReportId, storage.getStorageID(),
"invalidatedBlocks: {}", strBlockReportId, fullBrLeaseId, storage.getStorageID(),
nodeID, newReport.getNumberOfBlocks(),
node.hasStaleStorages(), (endTime - startTime),
invalidatedBlocks.size());

View File

@ -455,8 +455,8 @@ List<DatanodeCommand> blockReport(long fullBrLeaseId) throws IOException {
dn.getMetrics().addBlockReport(brSendCost, getRpcMetricSuffix());
final int nCmds = cmds.size();
LOG.info((success ? "S" : "Uns") +
"uccessfully sent block report 0x" +
Long.toHexString(reportId) + " to namenode: " + nnAddr +
"uccessfully sent block report 0x" + Long.toHexString(reportId) +
" with lease ID 0x" + Long.toHexString(fullBrLeaseId) + " to namenode: " + nnAddr +
", containing " + reports.length +
" storage report(s), of which we sent " + numReportsSent + "." +
" The reports had " + totalBlockCount +