cnauroth commented on code in PR #5355:
URL: https://github.com/apache/hadoop/pull/5355#discussion_r1149889446
##########
hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java:
##########
@@ -487,6 +489,11 @@ void archive(Path parentPath, List<Path> srcPaths,
+ " should be a directory but is a file");
}
conf.set(DST_DIR_LABEL, outputPath.toString());
+ Credentials credentials = new Credentials();
+ Path[] allPaths = new Path[] {parentPath, dest};
+ TokenCache.obtainTokensForNamenodes(credentials, allPaths, conf);
+ conf.setCredentials(credentials);
Review Comment:
Instead of overwriting the credentials with the setter, I suggest passing
the return value of `conf.getCredentials()` into
`TokenCache#obtainTokensForNamenodes`. I'm not sure what other credentials
might already be included by the time execution reaches here, so making it
additive might prevent some surprises.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]