HDFS-10752. Several log refactoring/improvement suggestion in HDFS. Contributed by Hanisha Koneru.
This commit is contained in:
parent
e9c4616b5e
commit
b4564103e4
@ -69,7 +69,7 @@ Entry<FileHandle, OpenFileCtx> getEntryToEvict() {
|
||||
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
||||
.iterator();
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("openFileMap size:" + openFileMap.size());
|
||||
LOG.trace("openFileMap size:" + size());
|
||||
}
|
||||
|
||||
Entry<FileHandle, OpenFileCtx> idlest = null;
|
||||
@ -117,10 +117,10 @@ Entry<FileHandle, OpenFileCtx> getEntryToEvict() {
|
||||
boolean put(FileHandle h, OpenFileCtx context) {
|
||||
OpenFileCtx toEvict = null;
|
||||
synchronized (this) {
|
||||
Preconditions.checkState(openFileMap.size() <= this.maxStreams,
|
||||
"stream cache size " + openFileMap.size()
|
||||
+ " is larger than maximum" + this.maxStreams);
|
||||
if (openFileMap.size() == this.maxStreams) {
|
||||
Preconditions.checkState(size() <= this.maxStreams,
|
||||
"stream cache size " + size() + " is larger than maximum" + this
|
||||
.maxStreams);
|
||||
if (size() == this.maxStreams) {
|
||||
Entry<FileHandle, OpenFileCtx> pairs = getEntryToEvict();
|
||||
if (pairs ==null) {
|
||||
return false;
|
||||
@ -149,7 +149,7 @@ void scan(long streamTimeout) {
|
||||
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
||||
.iterator();
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("openFileMap size:" + openFileMap.size());
|
||||
LOG.trace("openFileMap size:" + size());
|
||||
}
|
||||
|
||||
while (it.hasNext()) {
|
||||
@ -168,7 +168,7 @@ void scan(long streamTimeout) {
|
||||
openFileMap.remove(handle);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("After remove stream " + handle.getFileId()
|
||||
+ ", the stream number:" + openFileMap.size());
|
||||
+ ", the stream number:" + size());
|
||||
}
|
||||
ctxToRemove.add(ctx2);
|
||||
}
|
||||
@ -201,7 +201,7 @@ void cleanAll() {
|
||||
Iterator<Entry<FileHandle, OpenFileCtx>> it = openFileMap.entrySet()
|
||||
.iterator();
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("openFileMap size:" + openFileMap.size());
|
||||
LOG.trace("openFileMap size:" + size());
|
||||
}
|
||||
|
||||
while (it.hasNext()) {
|
||||
|
@ -84,12 +84,12 @@ void addToCorruptReplicasMap(Block blk, DatanodeDescriptor dn,
|
||||
if (!nodes.keySet().contains(dn)) {
|
||||
NameNode.blockStateChangeLog.debug(
|
||||
"BLOCK NameSystem.addToCorruptReplicasMap: {} added as corrupt on "
|
||||
+ "{} by {} {}", blk.getBlockName(), dn, Server.getRemoteIp(),
|
||||
+ "{} by {} {}", blk, dn, Server.getRemoteIp(),
|
||||
reasonText);
|
||||
} else {
|
||||
NameNode.blockStateChangeLog.debug(
|
||||
"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);
|
||||
}
|
||||
// Add the node or update the reason.
|
||||
|
@ -666,7 +666,7 @@ NamenodeRegistration getRegistration() {
|
||||
|
||||
NamenodeRegistration setRegistration() {
|
||||
nodeRegistration = new NamenodeRegistration(
|
||||
NetUtils.getHostPortString(rpcServer.getRpcAddress()),
|
||||
NetUtils.getHostPortString(getNameNodeAddress()),
|
||||
NetUtils.getHostPortString(getHttpAddress()),
|
||||
getFSImage().getStorage(), getRole());
|
||||
return nodeRegistration;
|
||||
@ -729,7 +729,7 @@ protected void initialize(Configuration conf) throws IOException {
|
||||
// This is expected for MiniDFSCluster. Set it now using
|
||||
// the RPC server's bind address.
|
||||
clientNamenodeAddress =
|
||||
NetUtils.getHostPortString(rpcServer.getRpcAddress());
|
||||
NetUtils.getHostPortString(getNameNodeAddress());
|
||||
LOG.info("Clients are to use " + clientNamenodeAddress + " to access"
|
||||
+ " this namenode/service.");
|
||||
}
|
||||
@ -816,7 +816,7 @@ private void startCommonServices(Configuration conf) throws IOException {
|
||||
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) {
|
||||
LOG.info(getRole() + " service RPC up at: "
|
||||
+ rpcServer.getServiceRpcAddress());
|
||||
@ -1047,7 +1047,7 @@ public InetSocketAddress getNameNodeAddress() {
|
||||
* @return NameNode RPC address in "host:port" string form
|
||||
*/
|
||||
public String getNameNodeAddressHostPortString() {
|
||||
return NetUtils.getHostPortString(rpcServer.getRpcAddress());
|
||||
return NetUtils.getHostPortString(getNameNodeAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1056,7 +1056,7 @@ public String getNameNodeAddressHostPortString() {
|
||||
*/
|
||||
public InetSocketAddress getServiceRpcAddress() {
|
||||
final InetSocketAddress serviceAddr = rpcServer.getServiceRpcAddress();
|
||||
return serviceAddr == null ? rpcServer.getRpcAddress() : serviceAddr;
|
||||
return serviceAddr == null ? getNameNodeAddress() : serviceAddr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user