HDFS-4080. Merging change r1407566 from trunk
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1407571 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f0c5611551
commit
bcc35e1ac3
|
@ -99,6 +99,13 @@ log4j.appender.TLA.totalLogFileSize=${hadoop.tasklog.totalLogFileSize}
|
||||||
log4j.appender.TLA.layout=org.apache.log4j.PatternLayout
|
log4j.appender.TLA.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.TLA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
|
log4j.appender.TLA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n
|
||||||
|
|
||||||
|
#
|
||||||
|
# HDFS block state change log from block manager
|
||||||
|
#
|
||||||
|
# Uncomment the following to suppress normal block state change
|
||||||
|
# messages from BlockManager in NameNode.
|
||||||
|
#log4j.logger.BlockStateChange=WARN
|
||||||
|
|
||||||
#
|
#
|
||||||
#Security appender
|
#Security appender
|
||||||
#
|
#
|
||||||
|
|
|
@ -1677,6 +1677,8 @@ Release 0.23.5 - UNRELEASED
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
|
|
||||||
IMPROVEMENTS
|
IMPROVEMENTS
|
||||||
|
HDFS-4080. Add a separate logger for block state change logs to enable turning
|
||||||
|
off those logs. (Kihwal Lee via suresh)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ public class BlockInfoUnderConstruction extends BlockInfo {
|
||||||
setBlockUCState(BlockUCState.UNDER_RECOVERY);
|
setBlockUCState(BlockUCState.UNDER_RECOVERY);
|
||||||
blockRecoveryId = recoveryId;
|
blockRecoveryId = recoveryId;
|
||||||
if (replicas.size() == 0) {
|
if (replicas.size() == 0) {
|
||||||
NameNode.stateChangeLog.warn("BLOCK*"
|
NameNode.blockStateChangeLog.warn("BLOCK*"
|
||||||
+ " BlockInfoUnderConstruction.initLeaseRecovery:"
|
+ " BlockInfoUnderConstruction.initLeaseRecovery:"
|
||||||
+ " No blocks found, lease removed.");
|
+ " No blocks found, lease removed.");
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ public class BlockInfoUnderConstruction extends BlockInfo {
|
||||||
primaryNodeIndex = j;
|
primaryNodeIndex = j;
|
||||||
DatanodeDescriptor primary = replicas.get(j).getExpectedLocation();
|
DatanodeDescriptor primary = replicas.get(j).getExpectedLocation();
|
||||||
primary.addBlockToBeRecovered(this);
|
primary.addBlockToBeRecovered(this);
|
||||||
NameNode.stateChangeLog.info("BLOCK* " + this
|
NameNode.blockStateChangeLog.info("BLOCK* " + this
|
||||||
+ " recovery started, primary=" + primary);
|
+ " recovery started, primary=" + primary);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ import com.google.common.collect.Sets;
|
||||||
public class BlockManager {
|
public class BlockManager {
|
||||||
|
|
||||||
static final Log LOG = LogFactory.getLog(BlockManager.class);
|
static final Log LOG = LogFactory.getLog(BlockManager.class);
|
||||||
|
static final Log blockLog = NameNode.blockStateChangeLog;
|
||||||
|
|
||||||
/** Default load factor of map */
|
/** Default load factor of map */
|
||||||
public static final float DEFAULT_MAP_LOAD_FACTOR = 0.75f;
|
public static final float DEFAULT_MAP_LOAD_FACTOR = 0.75f;
|
||||||
|
@ -873,7 +874,7 @@ public class BlockManager {
|
||||||
final long size) throws UnregisteredNodeException {
|
final long size) throws UnregisteredNodeException {
|
||||||
final DatanodeDescriptor node = getDatanodeManager().getDatanode(datanode);
|
final DatanodeDescriptor node = getDatanodeManager().getDatanode(datanode);
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
NameNode.stateChangeLog.warn("BLOCK* getBlocks: "
|
blockLog.warn("BLOCK* getBlocks: "
|
||||||
+ "Asking for blocks from an unrecorded node " + datanode);
|
+ "Asking for blocks from an unrecorded node " + datanode);
|
||||||
throw new HadoopIllegalArgumentException(
|
throw new HadoopIllegalArgumentException(
|
||||||
"Datanode " + datanode + " not found.");
|
"Datanode " + datanode + " not found.");
|
||||||
|
@ -951,7 +952,7 @@ public class BlockManager {
|
||||||
datanodes.append(node).append(" ");
|
datanodes.append(node).append(" ");
|
||||||
}
|
}
|
||||||
if (datanodes.length() != 0) {
|
if (datanodes.length() != 0) {
|
||||||
NameNode.stateChangeLog.info("BLOCK* addToInvalidates: " + b + " "
|
blockLog.info("BLOCK* addToInvalidates: " + b + " "
|
||||||
+ datanodes);
|
+ datanodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -972,7 +973,7 @@ public class BlockManager {
|
||||||
// ignore the request for now. This could happen when BlockScanner
|
// ignore the request for now. This could happen when BlockScanner
|
||||||
// thread of Datanode reports bad block before Block reports are sent
|
// thread of Datanode reports bad block before Block reports are sent
|
||||||
// by the Datanode on startup
|
// by the Datanode on startup
|
||||||
NameNode.stateChangeLog.info("BLOCK* findAndMarkBlockAsCorrupt: "
|
blockLog.info("BLOCK* findAndMarkBlockAsCorrupt: "
|
||||||
+ blk + " not found");
|
+ blk + " not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -989,7 +990,7 @@ public class BlockManager {
|
||||||
|
|
||||||
BlockCollection bc = b.corrupted.getBlockCollection();
|
BlockCollection bc = b.corrupted.getBlockCollection();
|
||||||
if (bc == null) {
|
if (bc == null) {
|
||||||
NameNode.stateChangeLog.info("BLOCK markBlockAsCorrupt: " + b
|
blockLog.info("BLOCK markBlockAsCorrupt: " + b
|
||||||
+ " cannot be marked as corrupt as it does not belong to any file");
|
+ " cannot be marked as corrupt as it does not belong to any file");
|
||||||
addToInvalidates(b.corrupted, node);
|
addToInvalidates(b.corrupted, node);
|
||||||
return;
|
return;
|
||||||
|
@ -1014,7 +1015,7 @@ public class BlockManager {
|
||||||
*/
|
*/
|
||||||
private void invalidateBlock(BlockToMarkCorrupt b, DatanodeInfo dn
|
private void invalidateBlock(BlockToMarkCorrupt b, DatanodeInfo dn
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
NameNode.stateChangeLog.info("BLOCK* invalidateBlock: " + b + " on " + dn);
|
blockLog.info("BLOCK* invalidateBlock: " + b + " on " + dn);
|
||||||
DatanodeDescriptor node = getDatanodeManager().getDatanode(dn);
|
DatanodeDescriptor node = getDatanodeManager().getDatanode(dn);
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
throw new IOException("Cannot invalidate " + b
|
throw new IOException("Cannot invalidate " + b
|
||||||
|
@ -1024,7 +1025,7 @@ public class BlockManager {
|
||||||
// Check how many copies we have of the block
|
// Check how many copies we have of the block
|
||||||
NumberReplicas nr = countNodes(b.stored);
|
NumberReplicas nr = countNodes(b.stored);
|
||||||
if (nr.replicasOnStaleNodes() > 0) {
|
if (nr.replicasOnStaleNodes() > 0) {
|
||||||
NameNode.stateChangeLog.info("BLOCK* invalidateBlocks: postponing " +
|
blockLog.info("BLOCK* invalidateBlocks: postponing " +
|
||||||
"invalidation of " + b + " on " + dn + " because " +
|
"invalidation of " + b + " on " + dn + " because " +
|
||||||
nr.replicasOnStaleNodes() + " replica(s) are located on nodes " +
|
nr.replicasOnStaleNodes() + " replica(s) are located on nodes " +
|
||||||
"with potentially out-of-date block reports");
|
"with potentially out-of-date block reports");
|
||||||
|
@ -1034,12 +1035,12 @@ public class BlockManager {
|
||||||
// If we have at least one copy on a live node, then we can delete it.
|
// If we have at least one copy on a live node, then we can delete it.
|
||||||
addToInvalidates(b.corrupted, dn);
|
addToInvalidates(b.corrupted, dn);
|
||||||
removeStoredBlock(b.stored, node);
|
removeStoredBlock(b.stored, node);
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug("BLOCK* invalidateBlocks: "
|
blockLog.debug("BLOCK* invalidateBlocks: "
|
||||||
+ b + " on " + dn + " listed for deletion.");
|
+ b + " on " + dn + " listed for deletion.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NameNode.stateChangeLog.info("BLOCK* invalidateBlocks: " + b
|
blockLog.info("BLOCK* invalidateBlocks: " + b
|
||||||
+ " on " + dn + " is the only copy and was not deleted");
|
+ " on " + dn + " is the only copy and was not deleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1162,7 @@ public class BlockManager {
|
||||||
(blockHasEnoughRacks(block)) ) {
|
(blockHasEnoughRacks(block)) ) {
|
||||||
neededReplications.remove(block, priority); // remove from neededReplications
|
neededReplications.remove(block, priority); // remove from neededReplications
|
||||||
neededReplications.decrementReplicationIndex(priority);
|
neededReplications.decrementReplicationIndex(priority);
|
||||||
NameNode.stateChangeLog.info("BLOCK* Removing " + block
|
blockLog.info("BLOCK* Removing " + block
|
||||||
+ " from neededReplications as it has enough replicas");
|
+ " from neededReplications as it has enough replicas");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1237,7 @@ public class BlockManager {
|
||||||
neededReplications.remove(block, priority); // remove from neededReplications
|
neededReplications.remove(block, priority); // remove from neededReplications
|
||||||
neededReplications.decrementReplicationIndex(priority);
|
neededReplications.decrementReplicationIndex(priority);
|
||||||
rw.targets = null;
|
rw.targets = null;
|
||||||
NameNode.stateChangeLog.info("BLOCK* Removing " + block
|
blockLog.info("BLOCK* Removing " + block
|
||||||
+ " from neededReplications as it has enough replicas");
|
+ " from neededReplications as it has enough replicas");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1262,8 +1263,8 @@ public class BlockManager {
|
||||||
// The reason we use 'pending' is so we can retry
|
// The reason we use 'pending' is so we can retry
|
||||||
// replications that fail after an appropriate amount of time.
|
// replications that fail after an appropriate amount of time.
|
||||||
pendingReplications.increment(block, targets.length);
|
pendingReplications.increment(block, targets.length);
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug(
|
blockLog.debug(
|
||||||
"BLOCK* block " + block
|
"BLOCK* block " + block
|
||||||
+ " is moved from neededReplications to pendingReplications");
|
+ " is moved from neededReplications to pendingReplications");
|
||||||
}
|
}
|
||||||
|
@ -1279,7 +1280,7 @@ public class BlockManager {
|
||||||
namesystem.writeUnlock();
|
namesystem.writeUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NameNode.stateChangeLog.isInfoEnabled()) {
|
if (blockLog.isInfoEnabled()) {
|
||||||
// log which blocks have been scheduled for replication
|
// log which blocks have been scheduled for replication
|
||||||
for(ReplicationWork rw : work){
|
for(ReplicationWork rw : work){
|
||||||
DatanodeDescriptor[] targets = rw.targets;
|
DatanodeDescriptor[] targets = rw.targets;
|
||||||
|
@ -1289,13 +1290,13 @@ public class BlockManager {
|
||||||
targetList.append(' ');
|
targetList.append(' ');
|
||||||
targetList.append(targets[k]);
|
targetList.append(targets[k]);
|
||||||
}
|
}
|
||||||
NameNode.stateChangeLog.info("BLOCK* ask " + rw.srcNode
|
blockLog.info("BLOCK* ask " + rw.srcNode
|
||||||
+ " to replicate " + rw.block + " to " + targetList);
|
+ " to replicate " + rw.block + " to " + targetList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug(
|
blockLog.debug(
|
||||||
"BLOCK* neededReplications = " + neededReplications.size()
|
"BLOCK* neededReplications = " + neededReplications.size()
|
||||||
+ " pendingReplications = " + pendingReplications.size());
|
+ " pendingReplications = " + pendingReplications.size());
|
||||||
}
|
}
|
||||||
|
@ -1505,7 +1506,7 @@ public class BlockManager {
|
||||||
// To minimize startup time, we discard any second (or later) block reports
|
// To minimize startup time, we discard any second (or later) block reports
|
||||||
// that we receive while still in startup phase.
|
// that we receive while still in startup phase.
|
||||||
if (namesystem.isInStartupSafeMode() && !node.isFirstBlockReport()) {
|
if (namesystem.isInStartupSafeMode() && !node.isFirstBlockReport()) {
|
||||||
NameNode.stateChangeLog.info("BLOCK* processReport: "
|
blockLog.info("BLOCK* processReport: "
|
||||||
+ "discarded non-initial block report from " + nodeID
|
+ "discarded non-initial block report from " + nodeID
|
||||||
+ " because namenode still in startup phase");
|
+ " because namenode still in startup phase");
|
||||||
return;
|
return;
|
||||||
|
@ -1537,7 +1538,7 @@ public class BlockManager {
|
||||||
|
|
||||||
// Log the block report processing stats from Namenode perspective
|
// Log the block report processing stats from Namenode perspective
|
||||||
NameNode.getNameNodeMetrics().addBlockReport((int) (endTime - startTime));
|
NameNode.getNameNodeMetrics().addBlockReport((int) (endTime - startTime));
|
||||||
NameNode.stateChangeLog.info("BLOCK* processReport: from "
|
blockLog.info("BLOCK* processReport: from "
|
||||||
+ nodeID + ", blocks: " + newReport.getNumberOfBlocks()
|
+ nodeID + ", blocks: " + newReport.getNumberOfBlocks()
|
||||||
+ ", processing time: " + (endTime - startTime) + " msecs");
|
+ ", processing time: " + (endTime - startTime) + " msecs");
|
||||||
}
|
}
|
||||||
|
@ -1597,7 +1598,7 @@ public class BlockManager {
|
||||||
addStoredBlock(b, node, null, true);
|
addStoredBlock(b, node, null, true);
|
||||||
}
|
}
|
||||||
for (Block b : toInvalidate) {
|
for (Block b : toInvalidate) {
|
||||||
NameNode.stateChangeLog.info("BLOCK* processReport: "
|
blockLog.info("BLOCK* processReport: "
|
||||||
+ b + " on " + node + " size " + b.getNumBytes()
|
+ b + " on " + node + " size " + b.getNumBytes()
|
||||||
+ " does not belong to any file");
|
+ " does not belong to any file");
|
||||||
addToInvalidates(b, node);
|
addToInvalidates(b, node);
|
||||||
|
@ -2035,7 +2036,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
}
|
}
|
||||||
if (storedBlock == null || storedBlock.getBlockCollection() == null) {
|
if (storedBlock == null || storedBlock.getBlockCollection() == null) {
|
||||||
// If this block does not belong to anyfile, then we are done.
|
// If this block does not belong to anyfile, then we are done.
|
||||||
NameNode.stateChangeLog.info("BLOCK* addStoredBlock: " + block + " on "
|
blockLog.info("BLOCK* addStoredBlock: " + block + " on "
|
||||||
+ node + " size " + block.getNumBytes()
|
+ node + " size " + block.getNumBytes()
|
||||||
+ " but it does not belong to any file");
|
+ " but it does not belong to any file");
|
||||||
// we could add this block to invalidate set of this datanode.
|
// we could add this block to invalidate set of this datanode.
|
||||||
|
@ -2057,7 +2058,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
curReplicaDelta = 0;
|
curReplicaDelta = 0;
|
||||||
NameNode.stateChangeLog.warn("BLOCK* addStoredBlock: "
|
blockLog.warn("BLOCK* addStoredBlock: "
|
||||||
+ "Redundant addStoredBlock request received for " + storedBlock
|
+ "Redundant addStoredBlock request received for " + storedBlock
|
||||||
+ " on " + node + " size " + storedBlock.getNumBytes());
|
+ " on " + node + " size " + storedBlock.getNumBytes());
|
||||||
}
|
}
|
||||||
|
@ -2116,7 +2117,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logAddStoredBlock(BlockInfo storedBlock, DatanodeDescriptor node) {
|
private void logAddStoredBlock(BlockInfo storedBlock, DatanodeDescriptor node) {
|
||||||
if (!NameNode.stateChangeLog.isInfoEnabled()) {
|
if (!blockLog.isInfoEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2127,7 +2128,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
storedBlock.appendStringTo(sb);
|
storedBlock.appendStringTo(sb);
|
||||||
sb.append(" size " )
|
sb.append(" size " )
|
||||||
.append(storedBlock.getNumBytes());
|
.append(storedBlock.getNumBytes());
|
||||||
NameNode.stateChangeLog.info(sb);
|
blockLog.info(sb);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Invalidate corrupt replicas.
|
* Invalidate corrupt replicas.
|
||||||
|
@ -2154,7 +2155,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
try {
|
try {
|
||||||
invalidateBlock(new BlockToMarkCorrupt(blk, null), node);
|
invalidateBlock(new BlockToMarkCorrupt(blk, null), node);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
NameNode.stateChangeLog.info("invalidateCorruptReplicas "
|
blockLog.info("invalidateCorruptReplicas "
|
||||||
+ "error in deleting bad block " + blk + " on " + node, e);
|
+ "error in deleting bad block " + blk + " on " + node, e);
|
||||||
gotException = true;
|
gotException = true;
|
||||||
}
|
}
|
||||||
|
@ -2420,7 +2421,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
// upon giving instructions to the namenode.
|
// upon giving instructions to the namenode.
|
||||||
//
|
//
|
||||||
addToInvalidates(b, cur);
|
addToInvalidates(b, cur);
|
||||||
NameNode.stateChangeLog.info("BLOCK* chooseExcessReplicates: "
|
blockLog.info("BLOCK* chooseExcessReplicates: "
|
||||||
+"("+cur+", "+b+") is added to invalidated blocks set");
|
+"("+cur+", "+b+") is added to invalidated blocks set");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2434,8 +2435,8 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
}
|
}
|
||||||
if (excessBlocks.add(block)) {
|
if (excessBlocks.add(block)) {
|
||||||
excessBlocksCount++;
|
excessBlocksCount++;
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug("BLOCK* addToExcessReplicate:"
|
blockLog.debug("BLOCK* addToExcessReplicate:"
|
||||||
+ " (" + dn + ", " + block
|
+ " (" + dn + ", " + block
|
||||||
+ ") is added to excessReplicateMap");
|
+ ") is added to excessReplicateMap");
|
||||||
}
|
}
|
||||||
|
@ -2447,15 +2448,15 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
* removed block is still valid.
|
* removed block is still valid.
|
||||||
*/
|
*/
|
||||||
public void removeStoredBlock(Block block, DatanodeDescriptor node) {
|
public void removeStoredBlock(Block block, DatanodeDescriptor node) {
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug("BLOCK* removeStoredBlock: "
|
blockLog.debug("BLOCK* removeStoredBlock: "
|
||||||
+ block + " from " + node);
|
+ block + " from " + node);
|
||||||
}
|
}
|
||||||
assert (namesystem.hasWriteLock());
|
assert (namesystem.hasWriteLock());
|
||||||
{
|
{
|
||||||
if (!blocksMap.removeNode(block, node)) {
|
if (!blocksMap.removeNode(block, node)) {
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug("BLOCK* removeStoredBlock: "
|
blockLog.debug("BLOCK* removeStoredBlock: "
|
||||||
+ block + " has already been removed from node " + node);
|
+ block + " has already been removed from node " + node);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -2482,8 +2483,8 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
if (excessBlocks != null) {
|
if (excessBlocks != null) {
|
||||||
if (excessBlocks.remove(block)) {
|
if (excessBlocks.remove(block)) {
|
||||||
excessBlocksCount--;
|
excessBlocksCount--;
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug("BLOCK* removeStoredBlock: "
|
blockLog.debug("BLOCK* removeStoredBlock: "
|
||||||
+ block + " is removed from excessBlocks");
|
+ block + " is removed from excessBlocks");
|
||||||
}
|
}
|
||||||
if (excessBlocks.size() == 0) {
|
if (excessBlocks.size() == 0) {
|
||||||
|
@ -2526,7 +2527,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
if (delHint != null && delHint.length() != 0) {
|
if (delHint != null && delHint.length() != 0) {
|
||||||
delHintNode = datanodeManager.getDatanode(delHint);
|
delHintNode = datanodeManager.getDatanode(delHint);
|
||||||
if (delHintNode == null) {
|
if (delHintNode == null) {
|
||||||
NameNode.stateChangeLog.warn("BLOCK* blockReceived: " + block
|
blockLog.warn("BLOCK* blockReceived: " + block
|
||||||
+ " is expected to be removed from an unrecorded node " + delHint);
|
+ " is expected to be removed from an unrecorded node " + delHint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2561,7 +2562,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
addStoredBlock(b, node, delHintNode, true);
|
addStoredBlock(b, node, delHintNode, true);
|
||||||
}
|
}
|
||||||
for (Block b : toInvalidate) {
|
for (Block b : toInvalidate) {
|
||||||
NameNode.stateChangeLog.info("BLOCK* addBlock: block "
|
blockLog.info("BLOCK* addBlock: block "
|
||||||
+ b + " on " + node + " size " + b.getNumBytes()
|
+ b + " on " + node + " size " + b.getNumBytes()
|
||||||
+ " does not belong to any file");
|
+ " does not belong to any file");
|
||||||
addToInvalidates(b, node);
|
addToInvalidates(b, node);
|
||||||
|
@ -2587,7 +2588,7 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
try {
|
try {
|
||||||
final DatanodeDescriptor node = datanodeManager.getDatanode(nodeID);
|
final DatanodeDescriptor node = datanodeManager.getDatanode(nodeID);
|
||||||
if (node == null || !node.isAlive) {
|
if (node == null || !node.isAlive) {
|
||||||
NameNode.stateChangeLog
|
blockLog
|
||||||
.warn("BLOCK* processIncrementalBlockReport"
|
.warn("BLOCK* processIncrementalBlockReport"
|
||||||
+ " is received from dead or unregistered node "
|
+ " is received from dead or unregistered node "
|
||||||
+ nodeID);
|
+ nodeID);
|
||||||
|
@ -2614,19 +2615,19 @@ assert storedBlock.findDatanode(dn) < 0 : "Block " + block
|
||||||
String msg =
|
String msg =
|
||||||
"Unknown block status code reported by " + nodeID +
|
"Unknown block status code reported by " + nodeID +
|
||||||
": " + rdbi;
|
": " + rdbi;
|
||||||
NameNode.stateChangeLog.warn(msg);
|
blockLog.warn(msg);
|
||||||
assert false : msg; // if assertions are enabled, throw.
|
assert false : msg; // if assertions are enabled, throw.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (NameNode.stateChangeLog.isDebugEnabled()) {
|
if (blockLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug("BLOCK* block "
|
blockLog.debug("BLOCK* block "
|
||||||
+ (rdbi.getStatus()) + ": " + rdbi.getBlock()
|
+ (rdbi.getStatus()) + ": " + rdbi.getBlock()
|
||||||
+ " is received from " + nodeID);
|
+ " is received from " + nodeID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
namesystem.writeUnlock();
|
namesystem.writeUnlock();
|
||||||
NameNode.stateChangeLog
|
blockLog
|
||||||
.debug("*BLOCK* NameNode.processIncrementalBlockReport: " + "from "
|
.debug("*BLOCK* NameNode.processIncrementalBlockReport: " + "from "
|
||||||
+ nodeID
|
+ nodeID
|
||||||
+ " receiving: " + receiving + ", "
|
+ " receiving: " + receiving + ", "
|
||||||
|
|
|
@ -63,13 +63,13 @@ public class CorruptReplicasMap{
|
||||||
|
|
||||||
if (!nodes.contains(dn)) {
|
if (!nodes.contains(dn)) {
|
||||||
nodes.add(dn);
|
nodes.add(dn);
|
||||||
NameNode.stateChangeLog.info("BLOCK NameSystem.addToCorruptReplicasMap: "+
|
NameNode.blockStateChangeLog.info("BLOCK NameSystem.addToCorruptReplicasMap: "+
|
||||||
blk.getBlockName() +
|
blk.getBlockName() +
|
||||||
" added as corrupt on " + dn +
|
" added as corrupt on " + dn +
|
||||||
" by " + Server.getRemoteIp() +
|
" by " + Server.getRemoteIp() +
|
||||||
reasonText);
|
reasonText);
|
||||||
} else {
|
} else {
|
||||||
NameNode.stateChangeLog.info("BLOCK NameSystem.addToCorruptReplicasMap: "+
|
NameNode.blockStateChangeLog.info("BLOCK NameSystem.addToCorruptReplicasMap: "+
|
||||||
"duplicate requested for " +
|
"duplicate requested for " +
|
||||||
blk.getBlockName() + " to add as corrupt " +
|
blk.getBlockName() + " to add as corrupt " +
|
||||||
"on " + dn +
|
"on " + dn +
|
||||||
|
|
|
@ -88,7 +88,7 @@ class InvalidateBlocks {
|
||||||
if (set.add(block)) {
|
if (set.add(block)) {
|
||||||
numBlocks++;
|
numBlocks++;
|
||||||
if (log) {
|
if (log) {
|
||||||
NameNode.stateChangeLog.info("BLOCK* " + getClass().getSimpleName()
|
NameNode.blockStateChangeLog.info("BLOCK* " + getClass().getSimpleName()
|
||||||
+ ": add " + block + " to " + datanode);
|
+ ": add " + block + " to " + datanode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,8 +191,8 @@ class UnderReplicatedBlocks implements Iterable<Block> {
|
||||||
int priLevel = getPriority(block, curReplicas, decomissionedReplicas,
|
int priLevel = getPriority(block, curReplicas, decomissionedReplicas,
|
||||||
expectedReplicas);
|
expectedReplicas);
|
||||||
if(priLevel != LEVEL && priorityQueues.get(priLevel).add(block)) {
|
if(priLevel != LEVEL && priorityQueues.get(priLevel).add(block)) {
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(NameNode.blockStateChangeLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug(
|
NameNode.blockStateChangeLog.debug(
|
||||||
"BLOCK* NameSystem.UnderReplicationBlock.add:"
|
"BLOCK* NameSystem.UnderReplicationBlock.add:"
|
||||||
+ block
|
+ block
|
||||||
+ " has only " + curReplicas
|
+ " has only " + curReplicas
|
||||||
|
@ -234,8 +234,8 @@ class UnderReplicatedBlocks implements Iterable<Block> {
|
||||||
boolean remove(Block block, int priLevel) {
|
boolean remove(Block block, int priLevel) {
|
||||||
if(priLevel >= 0 && priLevel < LEVEL
|
if(priLevel >= 0 && priLevel < LEVEL
|
||||||
&& priorityQueues.get(priLevel).remove(block)) {
|
&& priorityQueues.get(priLevel).remove(block)) {
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(NameNode.blockStateChangeLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug(
|
NameNode.blockStateChangeLog.debug(
|
||||||
"BLOCK* NameSystem.UnderReplicationBlock.remove: "
|
"BLOCK* NameSystem.UnderReplicationBlock.remove: "
|
||||||
+ "Removing block " + block
|
+ "Removing block " + block
|
||||||
+ " from priority queue "+ priLevel);
|
+ " from priority queue "+ priLevel);
|
||||||
|
@ -246,8 +246,8 @@ class UnderReplicatedBlocks implements Iterable<Block> {
|
||||||
// not found in the queue for the given priority level.
|
// not found in the queue for the given priority level.
|
||||||
for (int i = 0; i < LEVEL; i++) {
|
for (int i = 0; i < LEVEL; i++) {
|
||||||
if (priorityQueues.get(i).remove(block)) {
|
if (priorityQueues.get(i).remove(block)) {
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(NameNode.blockStateChangeLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug(
|
NameNode.blockStateChangeLog.debug(
|
||||||
"BLOCK* NameSystem.UnderReplicationBlock.remove: "
|
"BLOCK* NameSystem.UnderReplicationBlock.remove: "
|
||||||
+ "Removing block " + block
|
+ "Removing block " + block
|
||||||
+ " from priority queue "+ i);
|
+ " from priority queue "+ i);
|
||||||
|
@ -297,8 +297,8 @@ class UnderReplicatedBlocks implements Iterable<Block> {
|
||||||
remove(block, oldPri);
|
remove(block, oldPri);
|
||||||
}
|
}
|
||||||
if(curPri != LEVEL && priorityQueues.get(curPri).add(block)) {
|
if(curPri != LEVEL && priorityQueues.get(curPri).add(block)) {
|
||||||
if(NameNode.stateChangeLog.isDebugEnabled()) {
|
if(NameNode.blockStateChangeLog.isDebugEnabled()) {
|
||||||
NameNode.stateChangeLog.debug(
|
NameNode.blockStateChangeLog.debug(
|
||||||
"BLOCK* NameSystem.UnderReplicationBlock.update:"
|
"BLOCK* NameSystem.UnderReplicationBlock.update:"
|
||||||
+ block
|
+ block
|
||||||
+ " has only "+ curReplicas
|
+ " has only "+ curReplicas
|
||||||
|
|
|
@ -229,6 +229,7 @@ public class NameNode {
|
||||||
public static final int DEFAULT_PORT = 8020;
|
public static final int DEFAULT_PORT = 8020;
|
||||||
public static final Log LOG = LogFactory.getLog(NameNode.class.getName());
|
public static final Log LOG = LogFactory.getLog(NameNode.class.getName());
|
||||||
public static final Log stateChangeLog = LogFactory.getLog("org.apache.hadoop.hdfs.StateChange");
|
public static final Log stateChangeLog = LogFactory.getLog("org.apache.hadoop.hdfs.StateChange");
|
||||||
|
public static final Log blockStateChangeLog = LogFactory.getLog("BlockStateChange");
|
||||||
public static final HAState ACTIVE_STATE = new ActiveState();
|
public static final HAState ACTIVE_STATE = new ActiveState();
|
||||||
public static final HAState STANDBY_STATE = new StandbyState();
|
public static final HAState STANDBY_STATE = new StandbyState();
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
|
|
||||||
private static final Log LOG = NameNode.LOG;
|
private static final Log LOG = NameNode.LOG;
|
||||||
private static final Log stateChangeLog = NameNode.stateChangeLog;
|
private static final Log stateChangeLog = NameNode.stateChangeLog;
|
||||||
|
private static final Log blockStateChangeLog = NameNode.blockStateChangeLog;
|
||||||
|
|
||||||
// Dependencies from other parts of NN.
|
// Dependencies from other parts of NN.
|
||||||
protected final FSNamesystem namesystem;
|
protected final FSNamesystem namesystem;
|
||||||
|
@ -877,8 +878,8 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
String poolId, StorageBlockReport[] reports) throws IOException {
|
String poolId, StorageBlockReport[] reports) throws IOException {
|
||||||
verifyRequest(nodeReg);
|
verifyRequest(nodeReg);
|
||||||
BlockListAsLongs blist = new BlockListAsLongs(reports[0].getBlocks());
|
BlockListAsLongs blist = new BlockListAsLongs(reports[0].getBlocks());
|
||||||
if(stateChangeLog.isDebugEnabled()) {
|
if(blockStateChangeLog.isDebugEnabled()) {
|
||||||
stateChangeLog.debug("*BLOCK* NameNode.blockReport: "
|
blockStateChangeLog.debug("*BLOCK* NameNode.blockReport: "
|
||||||
+ "from " + nodeReg + " " + blist.getNumberOfBlocks()
|
+ "from " + nodeReg + " " + blist.getNumberOfBlocks()
|
||||||
+ " blocks");
|
+ " blocks");
|
||||||
}
|
}
|
||||||
|
@ -893,8 +894,8 @@ class NameNodeRpcServer implements NamenodeProtocols {
|
||||||
public void blockReceivedAndDeleted(DatanodeRegistration nodeReg, String poolId,
|
public void blockReceivedAndDeleted(DatanodeRegistration nodeReg, String poolId,
|
||||||
StorageReceivedDeletedBlocks[] receivedAndDeletedBlocks) throws IOException {
|
StorageReceivedDeletedBlocks[] receivedAndDeletedBlocks) throws IOException {
|
||||||
verifyRequest(nodeReg);
|
verifyRequest(nodeReg);
|
||||||
if(stateChangeLog.isDebugEnabled()) {
|
if(blockStateChangeLog.isDebugEnabled()) {
|
||||||
stateChangeLog.debug("*BLOCK* NameNode.blockReceivedAndDeleted: "
|
blockStateChangeLog.debug("*BLOCK* NameNode.blockReceivedAndDeleted: "
|
||||||
+"from "+nodeReg+" "+receivedAndDeletedBlocks.length
|
+"from "+nodeReg+" "+receivedAndDeletedBlocks.length
|
||||||
+" blocks.");
|
+" blocks.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.junit.Test;
|
||||||
public class TestDatanodeDeath {
|
public class TestDatanodeDeath {
|
||||||
{
|
{
|
||||||
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
|
||||||
|
((Log4JLogger)NameNode.blockStateChangeLog).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)LeaseManager.LOG).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)LeaseManager.LOG).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)LogFactory.getLog(FSNamesystem.class)).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)LogFactory.getLog(FSNamesystem.class)).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.ALL);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class TestFileAppend2 {
|
||||||
|
|
||||||
{
|
{
|
||||||
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
|
||||||
|
((Log4JLogger)NameNode.blockStateChangeLog).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)LeaseManager.LOG).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)LeaseManager.LOG).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)LogFactory.getLog(FSNamesystem.class)).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)LogFactory.getLog(FSNamesystem.class)).getLogger().setLevel(Level.ALL);
|
||||||
((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.ALL);
|
((Log4JLogger)DataNode.LOG).getLogger().setLevel(Level.ALL);
|
||||||
|
|
Loading…
Reference in New Issue