HDFS-10752. Several log refactoring/improvement suggestion in HDFS. Contributed by Hanisha Koneru.
This commit is contained in:
parent
ad7d3c4db8
commit
a3cbaf0c04
|
@ -69,7 +69,7 @@ class OpenFileCtxCache {
|
||||||
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
||||||
.iterator();
|
.iterator();
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("openFileMap size:" + openFileMap.size());
|
LOG.trace("openFileMap size:" + size());
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry<FileHandle, OpenFileCtx> idlest = null;
|
Entry<FileHandle, OpenFileCtx> idlest = null;
|
||||||
|
@ -117,10 +117,10 @@ class OpenFileCtxCache {
|
||||||
boolean put(FileHandle h, OpenFileCtx context) {
|
boolean put(FileHandle h, OpenFileCtx context) {
|
||||||
OpenFileCtx toEvict = null;
|
OpenFileCtx toEvict = null;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
Preconditions.checkState(openFileMap.size() <= this.maxStreams,
|
Preconditions.checkState(size() <= this.maxStreams,
|
||||||
"stream cache size " + openFileMap.size()
|
"stream cache size " + size() + " is larger than maximum" + this
|
||||||
+ " is larger than maximum" + this.maxStreams);
|
.maxStreams);
|
||||||
if (openFileMap.size() == this.maxStreams) {
|
if (size() == this.maxStreams) {
|
||||||
Entry<FileHandle, OpenFileCtx> pairs = getEntryToEvict();
|
Entry<FileHandle, OpenFileCtx> pairs = getEntryToEvict();
|
||||||
if (pairs ==null) {
|
if (pairs ==null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -149,7 +149,7 @@ class OpenFileCtxCache {
|
||||||
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
||||||
.iterator();
|
.iterator();
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("openFileMap size:" + openFileMap.size());
|
LOG.trace("openFileMap size:" + size());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -168,7 +168,7 @@ class OpenFileCtxCache {
|
||||||
openFileMap.remove(handle);
|
openFileMap.remove(handle);
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("After remove stream " + handle.getFileId()
|
LOG.debug("After remove stream " + handle.getFileId()
|
||||||
+ ", the stream number:" + openFileMap.size());
|
+ ", the stream number:" + size());
|
||||||
}
|
}
|
||||||
ctxToRemove.add(ctx2);
|
ctxToRemove.add(ctx2);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ class OpenFileCtxCache {
|
||||||
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
||||||
.iterator();
|
.iterator();
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace("openFileMap size:" + openFileMap.size());
|
LOG.trace("openFileMap size:" + size());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
|
@ -84,12 +84,12 @@ public class CorruptReplicasMap{
|
||||||
if (!nodes.keySet().contains(dn)) {
|
if (!nodes.keySet().contains(dn)) {
|
||||||
NameNode.blockStateChangeLog.debug(
|
NameNode.blockStateChangeLog.debug(
|
||||||
"BLOCK NameSystem.addToCorruptReplicasMap: {} added as corrupt on "
|
"BLOCK NameSystem.addToCorruptReplicasMap: {} added as corrupt on "
|
||||||
+ "{} by {} {}", blk.getBlockName(), dn, Server.getRemoteIp(),
|
+ "{} by {} {}", blk, dn, Server.getRemoteIp(),
|
||||||
reasonText);
|
reasonText);
|
||||||
} else {
|
} else {
|
||||||
NameNode.blockStateChangeLog.debug(
|
NameNode.blockStateChangeLog.debug(
|
||||||
"BLOCK NameSystem.addToCorruptReplicasMap: duplicate requested for" +
|
"BLOCK NameSystem.addToCorruptReplicasMap: duplicate requested for" +
|
||||||
" {} to add as corrupt on {} by {} {}", blk.getBlockName(), dn,
|
" {} to add as corrupt on {} by {} {}", blk, dn,
|
||||||
Server.getRemoteIp(), reasonText);
|
Server.getRemoteIp(), reasonText);
|
||||||
}
|
}
|
||||||
// Add the node or update the reason.
|
// Add the node or update the reason.
|
||||||
|
|
|
@ -667,7 +667,7 @@ public class NameNode extends ReconfigurableBase implements
|
||||||
|
|
||||||
NamenodeRegistration setRegistration() {
|
NamenodeRegistration setRegistration() {
|
||||||
nodeRegistration = new NamenodeRegistration(
|
nodeRegistration = new NamenodeRegistration(
|
||||||
NetUtils.getHostPortString(rpcServer.getRpcAddress()),
|
NetUtils.getHostPortString(getNameNodeAddress()),
|
||||||
NetUtils.getHostPortString(getHttpAddress()),
|
NetUtils.getHostPortString(getHttpAddress()),
|
||||||
getFSImage().getStorage(), getRole());
|
getFSImage().getStorage(), getRole());
|
||||||
return nodeRegistration;
|
return nodeRegistration;
|
||||||
|
@ -730,7 +730,7 @@ public class NameNode extends ReconfigurableBase implements
|
||||||
// This is expected for MiniDFSCluster. Set it now using
|
// This is expected for MiniDFSCluster. Set it now using
|
||||||
// the RPC server's bind address.
|
// the RPC server's bind address.
|
||||||
clientNamenodeAddress =
|
clientNamenodeAddress =
|
||||||
NetUtils.getHostPortString(rpcServer.getRpcAddress());
|
NetUtils.getHostPortString(getNameNodeAddress());
|
||||||
LOG.info("Clients are to use " + clientNamenodeAddress + " to access"
|
LOG.info("Clients are to use " + clientNamenodeAddress + " to access"
|
||||||
+ " this namenode/service.");
|
+ " this namenode/service.");
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ public class NameNode extends ReconfigurableBase implements
|
||||||
LOG.warn("ServicePlugin " + p + " could not be started", t);
|
LOG.warn("ServicePlugin " + p + " could not be started", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG.info(getRole() + " RPC up at: " + rpcServer.getRpcAddress());
|
LOG.info(getRole() + " RPC up at: " + getNameNodeAddress());
|
||||||
if (rpcServer.getServiceRpcAddress() != null) {
|
if (rpcServer.getServiceRpcAddress() != null) {
|
||||||
LOG.info(getRole() + " service RPC up at: "
|
LOG.info(getRole() + " service RPC up at: "
|
||||||
+ rpcServer.getServiceRpcAddress());
|
+ rpcServer.getServiceRpcAddress());
|
||||||
|
@ -1050,7 +1050,7 @@ public class NameNode extends ReconfigurableBase implements
|
||||||
* @return NameNode RPC address in "host:port" string form
|
* @return NameNode RPC address in "host:port" string form
|
||||||
*/
|
*/
|
||||||
public String getNameNodeAddressHostPortString() {
|
public String getNameNodeAddressHostPortString() {
|
||||||
return NetUtils.getHostPortString(rpcServer.getRpcAddress());
|
return NetUtils.getHostPortString(getNameNodeAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1059,7 +1059,7 @@ public class NameNode extends ReconfigurableBase implements
|
||||||
*/
|
*/
|
||||||
public InetSocketAddress getServiceRpcAddress() {
|
public InetSocketAddress getServiceRpcAddress() {
|
||||||
final InetSocketAddress serviceAddr = rpcServer.getServiceRpcAddress();
|
final InetSocketAddress serviceAddr = rpcServer.getServiceRpcAddress();
|
||||||
return serviceAddr == null ? rpcServer.getRpcAddress() : serviceAddr;
|
return serviceAddr == null ? getNameNodeAddress() : serviceAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue