-
Notifications
You must be signed in to change notification settings - Fork 594
HDDS-5891. OFS mkdir -p does not work as expected for bucket creation when volume exists due to volume create ACL check #2814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… when volume exists due to volume create ACL check
|
Hi @smengcl, Please help me understand what is the aim here, as I am not sure why are we doing the getBucket call this way. In my head, the algorithm is simply this:
This is better reflected by #2815, the one @dombizita created, based on our earlier discussions with her. I would like to understand why we are using the ObjectStore's client proxy to directly do OzoneManager protocol calls, when we can get the volume, and from the volume we can get the bucket later on, is there a good reason to turn to the underlying API I don't see, or we can even get rid of using the OzoneManager protocol proxy directly? On the other hand, I pretty much agree that the BucketManager#getBucketInfo(volName, bucketName) method should throw a VOLUME_NOT_FOUND in case the volume does not exist, that is a much clearer cause in this case. |
Thanks @fapifta for the comment. Thanks @dombizita for #2815 .
Yes #2815 is fine and it is better for compatibility (concern for compatibility is why I posted my PR #2814 in draft). #2814 and #2815 can be seen as two different approaches to the same problem.
The reason I used a single I am totally fine with #2815 in order to unblock other work, and improve on this later. Not sure if adding an extra round trip would really add meaningful perf impact in the first place, happy to discuss about that. |
|
Hmm, looking into it further, that perf impact might be huge, as if we do a getVolumeInfo first, then a getBucketInfo based on the volume, and if we use this in almost all operations as we do now, then that is a burden we do not want to take on for sure. So even though the other solution for me seems easier to understand, it hurts with the performance tradeoff... If we are concerned about compatibility, we need to use getBucketDetails(vol, buck) in the initial try catch, as otherwise, we are causing performance degradation of a lot of unrelated calls, but if we do not want to change the behaviour of BucketManager, we need to change how we handle errors, and there get volume first, and create only if it does not exist I believe... On the other hand, I would leave the change of BucketManager still on the table, as if volume does not exists, it would be the correct behaviour to throw a volume not found, instead of the bucket not found or any other resultcode in the OMException. If you check, createBucket already does it this way, and if getBucketInfo(vol, buck) switches to this behaviour, your solution is the one I would vote for... |
…gnored for now. But if @ignore is removed, the new check will pass.
|
Hi @fapifta , thanks for the comment. I have updated the PR. It is ready for review. Would you like to take a look? |
fapifta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @smengcl,
thank you for working this out, and adding the tests.
Unfortunate fact that the BucketManager test is ignored, so won't be running, can we fix that by removing the @ignore from the test, and add it to just the methods that are failing, and leave the green tests, and the new test as active running test cases?
As I checked, testGetBucketInfo and testCreateBucketWithoutVolume are green, and testGetBucketInfoForInvalidBucket is relevant to this change, and can be fixed, other tests I haven't checked.
I have created HDDS-5986 to fix the TestRootedOzoneFileSystem initialization problem along with some test failures that will come up after the fix.
Also please find one comment inline about an other minor change.
...one/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestRootedOzoneFileSystem.java
Outdated
Show resolved
Hide resolved
fapifta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice... I should have search jira before creating the ticket :)
If CI is green then I think we are good to go here.
Change-Id: Ic38e582cc96c859087b98baad2467af37ba7bdbe
|
Thanks @fapifta for the +1. Finally got a green CI run after 6+ retriggers. Merging in a minute. |
https://issues.apache.org/jira/browse/HDDS-5891
BucketManagerImpl#getBucketInfocan now throwVOLUME_NOT_FOUNDif the parent volume doesn't exist, and will only throwBUCKET_NOT_FOUNDif the parent volume exists but the bucket doesn't. Before this change it throwsBUCKET_NOT_FOUNDregardless of whether parent volume exists. Related prior comment: HDDS-5279. OFS mkdir -p does not work when Volume is not pre-created #2412 (comment)BasicRootedOzoneClientAdapterImpl#getBucketwill no longer attempt to create the volume if the volume exists. Previously, it can't distinguishVOLUME_NOT_EXISTfromBUCKET_NOT_EXISTdue to the API limitation mentioned in (1). This fixes the issue mentioned in the jira title, wheregetBucketcan fail if a non-privileged user tries tomkdir -pover a new bucket but fail because the user would fail the volumeCREATEpermission check -- which doesn't make sense to be checked in the first place in this case.Testing
Some integration/acceptance tests might be broken as a result of (1).Actually the CI goes fine as soon as I fixed the get from VolumeTable logic. In the code logic the volume key was missing the leading/.BucketManagerImpl#getBucketInfoin OM, that it could throwVOLUME_NOT_FOUNDnow if the parent volume doesn't exist (previouslygetBucketInfowould throwBUCKET_NOT_FOUNDin this case).mkdir -pnow even though this user don't have volumeCREATEpermission on the parent volume.