HDDS-15961. Resolve linked bucket source properties consistently#10859
HDDS-15961. Resolve linked bucket source properties consistently#10859smengcl wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens how OM enriches linked bucket responses by gating the copy of operational properties on READ access to the resolved source bucket, and extends the set of copied operational fields to include bucket encryption key info. It also optimizes listBuckets by reusing authorized source information within a single call when multiple links resolve to the same source.
Changes:
- Add a source-bucket READ ACL check before enriching link buckets; if denied, return the stored link info without enrichment.
- Cache resolved source bucket info during
listBucketsenrichment to avoid repeated source READ checks for the same source. - Extend
OmBucketInfo.withOperationalPropertiesFrom(...)to copyBucketEncryptionKeyInfo, with unit tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java | Gate link enrichment on source READ ACL; reuse resolved source info during listBuckets. |
| hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmBucketInfo.java | Include bucket encryption key info among copied operational properties. |
| hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOmBucketInfo.java | Add unit coverage ensuring encryption info is copied during operational enrichment. |
| hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketManagerImpl.java | Add ACL-focused tests for link enrichment behavior and per-source READ check reuse. |
Comments suppressed due to low confidence (1)
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketManagerImpl.java:600
- Similar to the getBucketInfo case, this test currently asserts object identity (assertSame) rather than the behavioral contract. To make the test resilient and more meaningful, assert the returned linked bucket does not include source metadata/operational properties when source READ is denied, and verify the source bucket is not fetched.
List<OmBucketInfo> result = omSpy.listBuckets(linkVolume, "", "", 100, false);
assertSame(link, result.get(0));
assertSame(regular, result.get(1));
verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| OmBucketInfo result = omSpy.getBucketInfo(linkVolume, "link"); | ||
|
|
||
| assertSame(link, result); | ||
| verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null); | ||
| } |
| return cachedSource; | ||
| } | ||
| } | ||
| if (getAclsEnabled()) { |
There was a problem hiding this comment.
Looks like we didn't verify ACL of the target bucket even before HDDS-15624.
Linux symlink does verify the target permission, so it makes sense to check it.
Generated-by: Codex (GPT-5.6 Sol)
What changes were proposed in this pull request?
HDDS-9117 changed
getBucketInfoso linked buckets return selected operational properties from their resolved source bucket. HDDS-15624 extracted this behavior into shared logic and applied it tolistBuckets.This patch addresses two gaps in that behavior:
READaccess on the resolved source bucket before copying its operational properties. If access is denied, return the stored link information instead.listBuckets, avoiding repeated source access checks when multiple links resolve to the same bucket.BucketEncryptionKeyInfofrom the resolved source along with its other operational properties.The link bucket's identity fields—including its volume, bucket name, owner, source path, ACLs, timestamps, and object/update IDs—remain unchanged.
listBucketsalso continues processing subsequent entries when a link cannot be enriched.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15961
How was this patch tested?
The following test cases were added:
TestOmBucketInfo#testWithOperationalPropertiesFromCopiesEncryptionInfoTestBucketManagerImpl#testGetBucketInfoDoesNotCopySourcePropertiesWithoutReadAccessTestBucketManagerImpl#testListBucketsDoesNotCopySourcePropertiesWithoutReadAccessTestBucketManagerImpl#testListBucketsChecksSourceReadAccessOncePerSource