HDFS-16378. Add datanode address to BlockReportLeaseManager logs (#3786). Contributed by tomscut.
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
843f66f4dc
commit
59c650802d
@ -190,8 +190,8 @@ public synchronized void register(DatanodeDescriptor dn) {
|
|||||||
|
|
||||||
private synchronized NodeData registerNode(DatanodeDescriptor dn) {
|
private synchronized NodeData registerNode(DatanodeDescriptor dn) {
|
||||||
if (nodes.containsKey(dn.getDatanodeUuid())) {
|
if (nodes.containsKey(dn.getDatanodeUuid())) {
|
||||||
LOG.info("Can't register DN {} because it is already registered.",
|
LOG.info("Can't register DN {} ({}) because it is already registered.",
|
||||||
dn.getDatanodeUuid());
|
dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
NodeData node = new NodeData(dn.getDatanodeUuid());
|
NodeData node = new NodeData(dn.getDatanodeUuid());
|
||||||
@ -213,8 +213,8 @@ private synchronized void remove(NodeData node) {
|
|||||||
public synchronized void unregister(DatanodeDescriptor dn) {
|
public synchronized void unregister(DatanodeDescriptor dn) {
|
||||||
NodeData node = nodes.remove(dn.getDatanodeUuid());
|
NodeData node = nodes.remove(dn.getDatanodeUuid());
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
LOG.info("Can't unregister DN {} because it is not currently " +
|
LOG.info("Can't unregister DN {} ({}) because it is not currently " +
|
||||||
"registered.", dn.getDatanodeUuid());
|
"registered.", dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
remove(node);
|
remove(node);
|
||||||
@ -232,9 +232,9 @@ public synchronized long requestLease(DatanodeDescriptor dn) {
|
|||||||
// The DataNode wants a new lease, even though it already has one.
|
// The DataNode wants a new lease, even though it already has one.
|
||||||
// This can happen if the DataNode is restarted in between requesting
|
// This can happen if the DataNode is restarted in between requesting
|
||||||
// a lease and using it.
|
// a lease and using it.
|
||||||
LOG.debug("Removing existing BR lease 0x{} for DN {} in order to " +
|
LOG.debug("Removing existing BR lease 0x{} for DN {} ({}) in order to " +
|
||||||
"issue a new one.", Long.toHexString(node.leaseId),
|
"issue a new one.", Long.toHexString(node.leaseId),
|
||||||
dn.getDatanodeUuid());
|
dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
}
|
}
|
||||||
remove(node);
|
remove(node);
|
||||||
long monotonicNowMs = Time.monotonicNow();
|
long monotonicNowMs = Time.monotonicNow();
|
||||||
@ -248,9 +248,9 @@ public synchronized long requestLease(DatanodeDescriptor dn) {
|
|||||||
allLeases.append(prefix).append(cur.datanodeUuid);
|
allLeases.append(prefix).append(cur.datanodeUuid);
|
||||||
prefix = ", ";
|
prefix = ", ";
|
||||||
}
|
}
|
||||||
LOG.debug("Can't create a new BR lease for DN {}, because " +
|
LOG.debug("Can't create a new BR lease for DN {} ({}), because " +
|
||||||
"numPending equals maxPending at {}. Current leases: {}",
|
"numPending equals maxPending at {}. Current leases: {}",
|
||||||
dn.getDatanodeUuid(), numPending, allLeases.toString());
|
dn.getDatanodeUuid(), dn.getXferAddr(), numPending, allLeases);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -259,8 +259,8 @@ public synchronized long requestLease(DatanodeDescriptor dn) {
|
|||||||
node.leaseTimeMs = monotonicNowMs;
|
node.leaseTimeMs = monotonicNowMs;
|
||||||
pendingHead.addToEnd(node);
|
pendingHead.addToEnd(node);
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Created a new BR lease 0x{} for DN {}. numPending = {}",
|
LOG.debug("Created a new BR lease 0x{} for DN {} ({}). numPending = {}",
|
||||||
Long.toHexString(node.leaseId), dn.getDatanodeUuid(), numPending);
|
Long.toHexString(node.leaseId), dn.getDatanodeUuid(), dn.getXferAddr(), numPending);
|
||||||
}
|
}
|
||||||
return node.leaseId;
|
return node.leaseId;
|
||||||
}
|
}
|
||||||
@ -293,36 +293,36 @@ private synchronized void pruneExpiredPending(long monotonicNowMs) {
|
|||||||
public synchronized boolean checkLease(DatanodeDescriptor dn,
|
public synchronized boolean checkLease(DatanodeDescriptor dn,
|
||||||
long monotonicNowMs, long id) {
|
long monotonicNowMs, long id) {
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
LOG.debug("Datanode {} is using BR lease id 0x0 to bypass " +
|
LOG.debug("Datanode {} ({}) is using BR lease id 0x0 to bypass " +
|
||||||
"rate-limiting.", dn.getDatanodeUuid());
|
"rate-limiting.", dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
NodeData node = nodes.get(dn.getDatanodeUuid());
|
NodeData node = nodes.get(dn.getDatanodeUuid());
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
LOG.info("BR lease 0x{} is not valid for unknown datanode {}",
|
LOG.info("BR lease 0x{} is not valid for unknown datanode {} ({})",
|
||||||
Long.toHexString(id), dn.getDatanodeUuid());
|
Long.toHexString(id), dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (node.leaseId == 0) {
|
if (node.leaseId == 0) {
|
||||||
LOG.warn("BR lease 0x{} is not valid for DN {}, because the DN " +
|
LOG.warn("BR lease 0x{} is not valid for DN {} ({}), because the DN " +
|
||||||
"is not in the pending set.",
|
"is not in the pending set.",
|
||||||
Long.toHexString(id), dn.getDatanodeUuid());
|
Long.toHexString(id), dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (pruneIfExpired(monotonicNowMs, node)) {
|
if (pruneIfExpired(monotonicNowMs, node)) {
|
||||||
LOG.warn("BR lease 0x{} is not valid for DN {}, because the lease " +
|
LOG.warn("BR lease 0x{} is not valid for DN {} ({}), because the lease " +
|
||||||
"has expired.", Long.toHexString(id), dn.getDatanodeUuid());
|
"has expired.", Long.toHexString(id), dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (id != node.leaseId) {
|
if (id != node.leaseId) {
|
||||||
LOG.warn("BR lease 0x{} is not valid for DN {}. Expected BR lease 0x{}.",
|
LOG.warn("BR lease 0x{} is not valid for DN {} ({}). Expected BR lease 0x{}.",
|
||||||
Long.toHexString(id), dn.getDatanodeUuid(),
|
Long.toHexString(id), dn.getDatanodeUuid(), dn.getXferAddr(),
|
||||||
Long.toHexString(node.leaseId));
|
Long.toHexString(node.leaseId));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("BR lease 0x{} is valid for DN {}.",
|
LOG.trace("BR lease 0x{} is valid for DN {} ({}).",
|
||||||
Long.toHexString(id), dn.getDatanodeUuid());
|
Long.toHexString(id), dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -330,20 +330,20 @@ public synchronized boolean checkLease(DatanodeDescriptor dn,
|
|||||||
public synchronized long removeLease(DatanodeDescriptor dn) {
|
public synchronized long removeLease(DatanodeDescriptor dn) {
|
||||||
NodeData node = nodes.get(dn.getDatanodeUuid());
|
NodeData node = nodes.get(dn.getDatanodeUuid());
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
LOG.info("Can't remove lease for unknown datanode {}",
|
LOG.info("Can't remove lease for unknown datanode {} ({})",
|
||||||
dn.getDatanodeUuid());
|
dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
long id = node.leaseId;
|
long id = node.leaseId;
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
LOG.debug("DN {} has no lease to remove.", dn.getDatanodeUuid());
|
LOG.debug("DN {} ({}) has no lease to remove.", dn.getDatanodeUuid(), dn.getXferAddr());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
remove(node);
|
remove(node);
|
||||||
deferredHead.addToEnd(node);
|
deferredHead.addToEnd(node);
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("Removed BR lease 0x{} for DN {}. numPending = {}",
|
LOG.trace("Removed BR lease 0x{} for DN {} ({}). numPending = {}",
|
||||||
Long.toHexString(id), dn.getDatanodeUuid(), numPending);
|
Long.toHexString(id), dn.getDatanodeUuid(), dn.getXferAddr(), numPending);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user