Skip to content

TEZ-4412 ensure mkDirForAM create directory with special permissions - #209

Merged
abstractdog merged 5 commits into
apache:masterfrom
skysiders:TEZ-4412
May 10, 2022
Merged

TEZ-4412 ensure mkDirForAM create directory with special permissions#209
abstractdog merged 5 commits into
apache:masterfrom
skysiders:TEZ-4412

Conversation

@skysiders

Copy link
Copy Markdown
Contributor

TEZ-4412 ensure mkDirForAM create directory with special permissions

I found TezClientUtils has method ensureStagingDirExists.It will check whether the path "stagingArea" exists, if it exists, check the permission, if not, call the function "TezCommonUtils.mkDirForAM" to create.But in method mkDirForAM,it use mkdir(path, permission) to create, if umask too strict such as 777,this directory will set with 000 permission.So we need to ensure the directory has right permission.

In this patch, I compared the permissions of the files with the expected permissions. If they are inconsistent, then log this and use setPermission to grant directory permissions.

@tez-yetus

This comment was marked as outdated.

@skysiders

Copy link
Copy Markdown
ContributorAuthor

Hi @abstractdog ,I found some permission issue here, can you please take a look?

@abstractdog

Copy link
Copy Markdown
Contributor

thanks for the patch @skysiders!
looks good to me, left a minor comment, please take care of it as well as checkstyle warnings

@abstractdog
abstractdog self-requested a review May 7, 2022 08:00
fs.mkdirs(dir, new FsPermission(TEZ_AM_DIR_PERMISSION));
FsPermission perm = new FsPermission(TEZ_AM_DIR_PERMISSION);
fs.mkdirs(dir, perm);
if(!fs.getFileStatus(dir).getPermission().equals(perm)){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method is public static, looks easily testable, could you please introduce a unit test in TestTezCommonUtils?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your review. I will check it.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abstractdog ,I add UT and fix check style. Couldyou please take a look?

@skysiders
skysiders requested a review from abstractdogMay 7, 2022 08:31
@tez-yetus

This comment was marked as outdated.

@skysiders

Copy link
Copy Markdown
ContributorAuthor

this test is properly working for the original scenario, can you include another one that tests the scenario you mentioned (umask)?

Hi @abstractdog , I'm sorry to make mistake in UT, and I try to fix it in this patch.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 2sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall17m 5smaster passed
+1 💚compile0m 44smaster passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚compile0m 41smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚checkstyle1m 10smaster passed
+1 💚javadoc0m 56smaster passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc0m 44smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+0 🆗spotbugs1m 39sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 37smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 23sthe patch passed
+1 💚compile0m 26sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javac0m 26sthe patch passed
+1 💚compile0m 21sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚javac0m 21sthe patch passed
-0 ⚠️checkstyle0m 13stez-api: The patch generated 1 new + 23 unchanged - 0 fixed = 24 total (was 23)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 25sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc0m 25sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚findbugs1m 2sthe patch passed
_ Other Tests _
+1 💚unit2m 5stez-api in the patch passed.
+1 💚asflicense0m 15sThe patch does not generate ASF License warnings.
30m 28s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/3/artifact/out/Dockerfile
GITHUB PR#209
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux e757c91223e4 4.15.0-175-generic #184-Ubuntu SMP Thu Mar 24 17:48:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 798ddda
Default JavaPrivate Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
checkstylehttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/3/artifact/out/diff-checkstyle-tez-api.txt
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/3/testReport/
Max. process+thread count398 (vs. ulimit of 5500)
modulesC: tez-api U: tez-api
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/3/console
versionsgit=2.25.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@abstractdog

Copy link
Copy Markdown
Contributor

thanks @skysiders , there is 1 more checkstyle issue reported

@skysiders

Copy link
Copy Markdown
ContributorAuthor

Thanks for your review @abstractdog , I use checkstyle:check find issue in import. I used the new FsPermission(700) check as assert at first, but then I found it would be more appropriate to use TezCommonUtils.TEZ_AM_DIR_PERMISSION, so I replaced the content in the assert, and forgot to delete the import.

@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 59sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall16m 11smaster passed
+1 💚compile0m 45smaster passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚compile0m 41smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚checkstyle1m 9smaster passed
+1 💚javadoc0m 56smaster passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc0m 44smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+0 🆗spotbugs1m 38sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 36smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 23sthe patch passed
+1 💚compile0m 26sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javac0m 26sthe patch passed
+1 💚compile0m 22sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚javac0m 22sthe patch passed
+1 💚checkstyle0m 13sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 25sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc0m 25sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚findbugs1m 2sthe patch passed
_ Other Tests _
+1 💚unit2m 6stez-api in the patch passed.
+1 💚asflicense0m 16sThe patch does not generate ASF License warnings.
29m 32s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/4/artifact/out/Dockerfile
GITHUB PR#209
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux e045ab3e49ea 4.15.0-175-generic #184-Ubuntu SMP Thu Mar 24 17:48:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 798ddda
Default JavaPrivate Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/4/testReport/
Max. process+thread count391 (vs. ulimit of 5500)
modulesC: tez-api U: tez-api
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/4/console
versionsgit=2.25.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Configuration remoteConf = new Configuration();
remoteConf.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, TEST_ROOT_DIR);
remoteConf.set(CommonConfigurationKeys.FS_PERMISSIONS_UMASK_KEY, "777");
MiniDFSCluster miniDFS = new MiniDFSCluster.Builder(remoteConf).numDataNodes(3).format(true).racks(null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test works as expected, this patch is so close, 1 more thing, could you please shutdown miniDFS cluster?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @abstractdog .Thanks for your suggestion, In this patch, I closed miniDFS after I ran out of it. Thank you for reviewing my code, it has taught me a lot.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged to master, thanks @skysiders for this patch, your tireless work, and quick responses!

@skysiders
skysiders requested a review from abstractdogMay 9, 2022 06:52
@tez-yetus

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 2sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚test4tests0m 0sThe patch appears to include 1 new or modified test files.
_ master Compile Tests _
+1 💚mvninstall15m 58smaster passed
+1 💚compile0m 46smaster passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚compile0m 42smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚checkstyle1m 8smaster passed
+1 💚javadoc0m 56smaster passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc0m 44smaster passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+0 🆗spotbugs1m 39sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs1m 36smaster passed
_ Patch Compile Tests _
+1 💚mvninstall0m 23sthe patch passed
+1 💚compile0m 27sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javac0m 27sthe patch passed
+1 💚compile0m 23sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚javac0m 23sthe patch passed
+1 💚checkstyle0m 14sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 26sthe patch passed with JDK Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1
+1 💚javadoc0m 25sthe patch passed with JDK Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
+1 💚findbugs1m 2sthe patch passed
_ Other Tests _
+1 💚unit2m 6stez-api in the patch passed.
+1 💚asflicense0m 14sThe patch does not generate ASF License warnings.
29m 24s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/5/artifact/out/Dockerfile
GITHUB PR#209
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 0801a38611fa 4.15.0-175-generic #184-Ubuntu SMP Thu Mar 24 17:48:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 798ddda
Default JavaPrivate Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Private Build-11.0.15+10-Ubuntu-0ubuntu0.20.04.1 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_312-8u312-b07-0ubuntu1~20.04-b07
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/5/testReport/
Max. process+thread count423 (vs. ulimit of 5500)
modulesC: tez-api U: tez-api
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-209/5/console
versionsgit=2.25.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@skysiders@tez-yetus@abstractdog