HDFS-15890. Improve the Logs for File Concat Operation. Contributed by Bhavik Patel.

(cherry picked from commit 9ba60c33d8)
This commit is contained in:
Takanobu Asanuma 2021-03-17 14:14:26 +09:00
parent b4c07209fc
commit b898058e45
2 changed files with 7 additions and 12 deletions

View File

@ -52,9 +52,9 @@ class FSDirConcatOp {
String target, String[] srcs, boolean logRetryCache) throws IOException {
validatePath(target, srcs);
assert srcs != null;
if (FSDirectory.LOG.isDebugEnabled()) {
FSDirectory.LOG.debug("concat {} to {}", Arrays.toString(srcs), target);
}
NameNode.stateChangeLog.debug("DIR* NameSystem.concat: {} to {}",
Arrays.toString(srcs), target);
final INodesInPath targetIIP = fsd.resolvePath(pc, target, DirOp.WRITE);
// write permission for the target
if (fsd.isPermissionEnabled()) {
@ -66,11 +66,6 @@ class FSDirConcatOp {
// check the srcs
INodeFile[] srcFiles = verifySrcFiles(fsd, srcs, targetIIP, pc);
if(NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("DIR* NameSystem.concat: " +
Arrays.toString(srcs) + " to " + target);
}
long timestamp = now();
fsd.writeLock();
try {
@ -234,10 +229,8 @@ class FSDirConcatOp {
static void unprotectedConcat(FSDirectory fsd, INodesInPath targetIIP,
INodeFile[] srcList, long timestamp) throws IOException {
assert fsd.hasWriteLock();
if (NameNode.stateChangeLog.isDebugEnabled()) {
NameNode.stateChangeLog.debug("DIR* FSNamesystem.concat to "
+ targetIIP.getPath());
}
NameNode.stateChangeLog.debug("DIR* NameSystem.concat to {}",
targetIIP.getPath());
final INodeFile trgInode = targetIIP.getLastINode().asFile();
QuotaCounts deltas = computeQuotaDeltas(fsd, trgInode, srcList);

View File

@ -1051,6 +1051,8 @@ public class NameNodeRpcServer implements NamenodeProtocols {
@Override // ClientProtocol
public void concat(String trg, String[] src) throws IOException {
checkNNStartup();
stateChangeLog.debug("*DIR* NameNode.concat: src path {} to" +
" target path {}", Arrays.toString(src), trg);
namesystem.checkOperation(OperationCategory.WRITE);
CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
if (cacheEntry != null && cacheEntry.isSuccess()) {