MAPREDUCE-7372 MapReduce set permission too late in copyJar method (#4026). Contributed by Zhang Dongsheng.

Reviewed-by: Steve Loughran <stevel@apache.org>
Signed-off-by: Chris Nauroth <cnauroth@apache.org>
This commit is contained in:
skysiders 2022-07-26 02:38:59 +08:00 committed by GitHub
parent 6ba2c53720
commit 9fe96238d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -783,9 +783,11 @@ class JobResourceUploader {
void copyJar(Path originalJarPath, Path submitJarFile, void copyJar(Path originalJarPath, Path submitJarFile,
short replication) throws IOException { short replication) throws IOException {
jtFs.copyFromLocalFile(originalJarPath, submitJarFile); jtFs.copyFromLocalFile(originalJarPath, submitJarFile);
jtFs.setReplication(submitJarFile, replication); // The operation of setReplication requires certain permissions
// so we need to make sure it has enough permissions
jtFs.setPermission(submitJarFile, new FsPermission( jtFs.setPermission(submitJarFile, new FsPermission(
JobSubmissionFiles.JOB_FILE_PERMISSION)); JobSubmissionFiles.JOB_FILE_PERMISSION));
jtFs.setReplication(submitJarFile, replication);
} }
private void addLog4jToDistributedCache(Job job, Path jobSubmitDir) private void addLog4jToDistributedCache(Job job, Path jobSubmitDir)