|
@@ -2153,6 +2153,8 @@ public class BlockManager implements BlockStatsMXBean {
|
|
final long endTime;
|
|
final long endTime;
|
|
DatanodeDescriptor node;
|
|
DatanodeDescriptor node;
|
|
Collection<Block> invalidatedBlocks = Collections.emptyList();
|
|
Collection<Block> invalidatedBlocks = Collections.emptyList();
|
|
|
|
+ String strBlockReportId =
|
|
|
|
+ context != null ? Long.toHexString(context.getReportId()) : "";
|
|
|
|
|
|
try {
|
|
try {
|
|
node = datanodeManager.getDatanode(nodeID);
|
|
node = datanodeManager.getDatanode(nodeID);
|
|
@@ -2171,9 +2173,10 @@ public class BlockManager implements BlockStatsMXBean {
|
|
}
|
|
}
|
|
if (namesystem.isInStartupSafeMode()
|
|
if (namesystem.isInStartupSafeMode()
|
|
&& storageInfo.getBlockReportCount() > 0) {
|
|
&& storageInfo.getBlockReportCount() > 0) {
|
|
- blockLog.info("BLOCK* processReport: "
|
|
|
|
|
|
+ blockLog.info("BLOCK* processReport 0x{}: "
|
|
+ "discarded non-initial block report from {}"
|
|
+ "discarded non-initial block report from {}"
|
|
- + " because namenode still in startup phase", nodeID);
|
|
|
|
|
|
+ + " because namenode still in startup phase",
|
|
|
|
+ strBlockReportId, nodeID);
|
|
blockReportLeaseManager.removeLease(node);
|
|
blockReportLeaseManager.removeLease(node);
|
|
return !node.hasStaleStorages();
|
|
return !node.hasStaleStorages();
|
|
}
|
|
}
|
|
@@ -2187,13 +2190,14 @@ public class BlockManager implements BlockStatsMXBean {
|
|
if (storageInfo.getBlockReportCount() == 0) {
|
|
if (storageInfo.getBlockReportCount() == 0) {
|
|
// The first block report can be processed a lot more efficiently than
|
|
// The first block report can be processed a lot more efficiently than
|
|
// ordinary block reports. This shortens restart times.
|
|
// ordinary block reports. This shortens restart times.
|
|
- LOG.info("Processing first storage report for " +
|
|
|
|
- storageInfo.getStorageID() + " from datanode " +
|
|
|
|
|
|
+ blockLog.info("BLOCK* processReport 0x{}: Processing first "
|
|
|
|
+ + "storage report for {} from datanode {}",
|
|
|
|
+ strBlockReportId,
|
|
|
|
+ storageInfo.getStorageID(),
|
|
nodeID.getDatanodeUuid());
|
|
nodeID.getDatanodeUuid());
|
|
processFirstBlockReport(storageInfo, newReport);
|
|
processFirstBlockReport(storageInfo, newReport);
|
|
} else {
|
|
} else {
|
|
- invalidatedBlocks = processReport(storageInfo, newReport,
|
|
|
|
- context != null ? context.isSorted() : false);
|
|
|
|
|
|
+ invalidatedBlocks = processReport(storageInfo, newReport, context);
|
|
}
|
|
}
|
|
|
|
|
|
storageInfo.receivedBlockReport();
|
|
storageInfo.receivedBlockReport();
|
|
@@ -2229,8 +2233,8 @@ public class BlockManager implements BlockStatsMXBean {
|
|
}
|
|
}
|
|
|
|
|
|
for (Block b : invalidatedBlocks) {
|
|
for (Block b : invalidatedBlocks) {
|
|
- blockLog.debug("BLOCK* processReport: {} on node {} size {} does not " +
|
|
|
|
- "belong to any file", b, node, b.getNumBytes());
|
|
|
|
|
|
+ blockLog.debug("BLOCK* processReport 0x{}: {} on node {} size {} does not"
|
|
|
|
+ + " belong to any file", strBlockReportId, b, node, b.getNumBytes());
|
|
}
|
|
}
|
|
|
|
|
|
// Log the block report processing stats from Namenode perspective
|
|
// Log the block report processing stats from Namenode perspective
|
|
@@ -2238,10 +2242,10 @@ public class BlockManager implements BlockStatsMXBean {
|
|
if (metrics != null) {
|
|
if (metrics != null) {
|
|
metrics.addBlockReport((int) (endTime - startTime));
|
|
metrics.addBlockReport((int) (endTime - startTime));
|
|
}
|
|
}
|
|
- blockLog.info("BLOCK* processReport: from storage {} node {}, " +
|
|
|
|
|
|
+ blockLog.info("BLOCK* processReport 0x{}: from storage {} node {}, " +
|
|
"blocks: {}, hasStaleStorage: {}, processing time: {} msecs, " +
|
|
"blocks: {}, hasStaleStorage: {}, processing time: {} msecs, " +
|
|
- "invalidatedBlocks: {}", storage.getStorageID(), nodeID,
|
|
|
|
- newReport.getNumberOfBlocks(),
|
|
|
|
|
|
+ "invalidatedBlocks: {}", strBlockReportId, storage.getStorageID(),
|
|
|
|
+ nodeID, newReport.getNumberOfBlocks(),
|
|
node.hasStaleStorages(), (endTime - startTime),
|
|
node.hasStaleStorages(), (endTime - startTime),
|
|
invalidatedBlocks.size());
|
|
invalidatedBlocks.size());
|
|
return !node.hasStaleStorages();
|
|
return !node.hasStaleStorages();
|
|
@@ -2355,7 +2359,8 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
|
|
|
private Collection<Block> processReport(
|
|
private Collection<Block> processReport(
|
|
final DatanodeStorageInfo storageInfo,
|
|
final DatanodeStorageInfo storageInfo,
|
|
- final BlockListAsLongs report, final boolean sorted) throws IOException {
|
|
|
|
|
|
+ final BlockListAsLongs report,
|
|
|
|
+ BlockReportContext context) throws IOException {
|
|
// Normal case:
|
|
// Normal case:
|
|
// Modify the (block-->datanode) map, according to the difference
|
|
// Modify the (block-->datanode) map, according to the difference
|
|
// between the old and new block report.
|
|
// between the old and new block report.
|
|
@@ -2366,13 +2371,21 @@ public class BlockManager implements BlockStatsMXBean {
|
|
Collection<BlockToMarkCorrupt> toCorrupt = new LinkedList<>();
|
|
Collection<BlockToMarkCorrupt> toCorrupt = new LinkedList<>();
|
|
Collection<StatefulBlockInfo> toUC = new LinkedList<>();
|
|
Collection<StatefulBlockInfo> toUC = new LinkedList<>();
|
|
|
|
|
|
|
|
+ boolean sorted = false;
|
|
|
|
+ String strBlockReportId = "";
|
|
|
|
+ if (context != null) {
|
|
|
|
+ sorted = context.isSorted();
|
|
|
|
+ strBlockReportId = Long.toHexString(context.getReportId());
|
|
|
|
+ }
|
|
|
|
+
|
|
Iterable<BlockReportReplica> sortedReport;
|
|
Iterable<BlockReportReplica> sortedReport;
|
|
if (!sorted) {
|
|
if (!sorted) {
|
|
- blockLog.warn("BLOCK* processReport: Report from the DataNode ({}) is "
|
|
|
|
- + "unsorted. This will cause overhead on the NameNode "
|
|
|
|
|
|
+ blockLog.warn("BLOCK* processReport 0x{}: Report from the DataNode ({}) "
|
|
|
|
+ + "is unsorted. This will cause overhead on the NameNode "
|
|
+ "which needs to sort the Full BR. Please update the "
|
|
+ "which needs to sort the Full BR. Please update the "
|
|
+ "DataNode to the same version of Hadoop HDFS as the "
|
|
+ "DataNode to the same version of Hadoop HDFS as the "
|
|
+ "NameNode ({}).",
|
|
+ "NameNode ({}).",
|
|
|
|
+ strBlockReportId,
|
|
storageInfo.getDatanodeDescriptor().getDatanodeUuid(),
|
|
storageInfo.getDatanodeDescriptor().getDatanodeUuid(),
|
|
VersionInfo.getVersion());
|
|
VersionInfo.getVersion());
|
|
Set<BlockReportReplica> set = new FoldedTreeSet<>();
|
|
Set<BlockReportReplica> set = new FoldedTreeSet<>();
|
|
@@ -2403,8 +2416,8 @@ public class BlockManager implements BlockStatsMXBean {
|
|
numBlocksLogged++;
|
|
numBlocksLogged++;
|
|
}
|
|
}
|
|
if (numBlocksLogged > maxNumBlocksToLog) {
|
|
if (numBlocksLogged > maxNumBlocksToLog) {
|
|
- blockLog.info("BLOCK* processReport: logged info for {} of {} " +
|
|
|
|
- "reported.", maxNumBlocksToLog, numBlocksLogged);
|
|
|
|
|
|
+ blockLog.info("BLOCK* processReport 0x{}: logged info for {} of {} " +
|
|
|
|
+ "reported.", strBlockReportId, maxNumBlocksToLog, numBlocksLogged);
|
|
}
|
|
}
|
|
for (Block b : toInvalidate) {
|
|
for (Block b : toInvalidate) {
|
|
addToInvalidates(b, node);
|
|
addToInvalidates(b, node);
|