You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "smengcl (via GitHub)" <gi...@apache.org> on 2026/07/24 09:07:37 UTC
[PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
smengcl opened a new pull request, #10859:
URL: https://github.com/apache/ozone/pull/10859
Generated-by: Codex (GPT-5.6 Sol)
## What changes were proposed in this pull request?
HDDS-9117 changed `getBucketInfo` so linked buckets return selected operational properties from their resolved source bucket. HDDS-15624 extracted this behavior into shared logic and applied it to `listBuckets`.
This patch addresses two gaps in that behavior:
- Check `READ` access on the resolved source bucket before copying its operational properties. If access is denied, return the stored link information instead.
- Reuse successfully authorized source information within `listBuckets`, avoiding repeated source access checks when multiple links resolve to the same bucket.
- Copy `BucketEncryptionKeyInfo` from 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. `listBuckets` also 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#testWithOperationalPropertiesFromCopiesEncryptionInfo`
- `TestBucketManagerImpl#testGetBucketInfoDoesNotCopySourcePropertiesWithoutReadAccess`
- `TestBucketManagerImpl#testListBucketsDoesNotCopySourcePropertiesWithoutReadAccess`
- `TestBucketManagerImpl#testListBucketsChecksSourceReadAccessOncePerSource`
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3647721891
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
+ try {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.READ, resolvedBucket.realVolume(),
+ resolvedBucket.realBucket(), null);
+ } catch (OMException e) {
+ if (e.getResult() == PERMISSION_DENIED) {
+ return null;
Review Comment:
not sure about this -- wouldn't it make more sense to throw PERMISSION_DENIED exception in this case?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3647733682
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmBucketInfo.java:
##########
Review Comment:
would be nice to make the order consistent with the ones in toBuilder() for ease of maintenance in the future. That's a miss in HDDS-15624.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3648065009
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketManagerImpl.java:
##########
@@ -540,4 +554,121 @@ public void testListBucketsResolvesFsoAndObsLinkLayouts() throws Exception {
assertEquals(volume, listedObsLink.getSourceVolume());
assertEquals("obs-source", listedObsLink.getSourceBucket());
}
+
+ @Test
+ void testGetBucketInfoFailsWithoutSourceReadAccess() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo link = createLinkBucketInfo(linkVolume, sourceVolume);
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.getBucketInfo(linkVolume, "link")).thenReturn(link);
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ denySourceRead(metadataReader, sourceVolume);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ OMException exception = assertThrows(OMException.class,
+ () -> omSpy.getBucketInfo(linkVolume, "link"));
+
+ assertEquals(ResultCodes.PERMISSION_DENIED, exception.getResult());
+ verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ verify(bucketManager, times(1)).getBucketInfo(sourceVolume, "source");
+ }
+
+ @Test
+ void testListBucketsDoesNotCopySourcePropertiesWithoutReadAccess() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo link = createLinkBucketInfo(linkVolume, sourceVolume);
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ OmBucketInfo regular = OmBucketInfo.newBuilder()
+ .setVolumeName(linkVolume)
+ .setBucketName("regular")
+ .build();
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.listBuckets(linkVolume, "", "", 100, false))
+ .thenReturn(new ArrayList<>(Arrays.asList(link, regular)));
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ denySourceRead(metadataReader, sourceVolume);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ List<OmBucketInfo> result = omSpy.listBuckets(linkVolume, "", "", 100, false);
+
+ assertThat(result.get(0).getMetadata())
+ .containsEntry("linkKey", "linkValue")
+ .doesNotContainKey("sourceKey");
+ assertSame(regular, result.get(1));
+ verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ verify(bucketManager, times(1)).getBucketInfo(sourceVolume, "source");
+ }
+
+ @Test
+ void testListBucketsChecksSourceReadAccessOncePerSource() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo firstLink = createLinkBucketInfo(linkVolume, sourceVolume)
+ .toBuilder()
+ .setBucketName("link1")
+ .build();
+ OmBucketInfo secondLink = createLinkBucketInfo(linkVolume, sourceVolume)
+ .toBuilder()
+ .setBucketName("link2")
+ .build();
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.listBuckets(linkVolume, "", "", 100, false))
+ .thenReturn(new ArrayList<>(Arrays.asList(firstLink, secondLink)));
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ List<OmBucketInfo> result = omSpy.listBuckets(linkVolume, "", "", 100, false);
+
+ assertEquals("sourceValue", result.get(0).getMetadata().get("sourceKey"));
+ assertEquals("sourceValue", result.get(1).getMetadata().get("sourceKey"));
+ verify(metadataReader, times(1))
+ .checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ }
+
+ private static OmBucketInfo createLinkBucketInfo(String linkVolume, String sourceVolume) {
+ return OmBucketInfo.newBuilder()
+ .setVolumeName(linkVolume)
+ .setBucketName("link")
+ .setSourceVolume(sourceVolume)
+ .setSourceBucket("source")
+ .addAllMetadata(singletonMap("linkKey", "linkValue"))
+ .build();
+ }
+
+ private static OmBucketInfo createSourceBucketInfo(String sourceVolume) {
+ return OmBucketInfo.newBuilder()
+ .setVolumeName(sourceVolume)
+ .setBucketName("source")
+ .addAllMetadata(singletonMap("sourceKey", "sourceValue"))
+ .build();
+ }
+
+ private static void denySourceRead(OmMetadataReader metadataReader, String sourceVolume) throws IOException {
+ doAnswer(invocation -> {
+ if (sourceVolume.equals(invocation.getArgument(3)) && "source".equals(invocation.getArgument(4))) {
+ throw new OMException("denied", ResultCodes.PERMISSION_DENIED);
+ }
+ return null;
+ }).when(metadataReader).checkAcls(any(), any(), any(), any(), any(), any());
+ }
+
+ private OzoneManager createAclEnabledOmSpy(BucketManager bucketManager, OmMetadataReader metadataReader) {
+ OzoneManager omSpy = spy(omTestManagers.getOzoneManager());
+ HddsWhiteboxTestUtils.setInternalState(omSpy, "bucketManager", bucketManager);
+ HddsWhiteboxTestUtils.setInternalState(omSpy, "omMetadataReader", metadataReader);
+ when(omSpy.getAclsEnabled()).thenReturn(true);
+ AuditMessage auditMessage = mock(AuditMessage.class);
Review Comment:
Doing this will trigger the same findbugs issue that was just addressed.
`getAclsEnabled()` only reads the authorization flags and has no side effects.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3648013106
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketManagerImpl.java:
##########
@@ -540,4 +554,121 @@ public void testListBucketsResolvesFsoAndObsLinkLayouts() throws Exception {
assertEquals(volume, listedObsLink.getSourceVolume());
assertEquals("obs-source", listedObsLink.getSourceBucket());
}
+
+ @Test
+ void testGetBucketInfoFailsWithoutSourceReadAccess() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo link = createLinkBucketInfo(linkVolume, sourceVolume);
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.getBucketInfo(linkVolume, "link")).thenReturn(link);
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ denySourceRead(metadataReader, sourceVolume);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ OMException exception = assertThrows(OMException.class,
+ () -> omSpy.getBucketInfo(linkVolume, "link"));
+
+ assertEquals(ResultCodes.PERMISSION_DENIED, exception.getResult());
+ verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ verify(bucketManager, times(1)).getBucketInfo(sourceVolume, "source");
+ }
+
+ @Test
+ void testListBucketsDoesNotCopySourcePropertiesWithoutReadAccess() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo link = createLinkBucketInfo(linkVolume, sourceVolume);
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ OmBucketInfo regular = OmBucketInfo.newBuilder()
+ .setVolumeName(linkVolume)
+ .setBucketName("regular")
+ .build();
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.listBuckets(linkVolume, "", "", 100, false))
+ .thenReturn(new ArrayList<>(Arrays.asList(link, regular)));
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ denySourceRead(metadataReader, sourceVolume);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ List<OmBucketInfo> result = omSpy.listBuckets(linkVolume, "", "", 100, false);
+
+ assertThat(result.get(0).getMetadata())
+ .containsEntry("linkKey", "linkValue")
+ .doesNotContainKey("sourceKey");
+ assertSame(regular, result.get(1));
+ verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ verify(bucketManager, times(1)).getBucketInfo(sourceVolume, "source");
+ }
+
+ @Test
+ void testListBucketsChecksSourceReadAccessOncePerSource() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo firstLink = createLinkBucketInfo(linkVolume, sourceVolume)
+ .toBuilder()
+ .setBucketName("link1")
+ .build();
+ OmBucketInfo secondLink = createLinkBucketInfo(linkVolume, sourceVolume)
+ .toBuilder()
+ .setBucketName("link2")
+ .build();
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.listBuckets(linkVolume, "", "", 100, false))
+ .thenReturn(new ArrayList<>(Arrays.asList(firstLink, secondLink)));
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ List<OmBucketInfo> result = omSpy.listBuckets(linkVolume, "", "", 100, false);
+
+ assertEquals("sourceValue", result.get(0).getMetadata().get("sourceKey"));
+ assertEquals("sourceValue", result.get(1).getMetadata().get("sourceKey"));
+ verify(metadataReader, times(1))
+ .checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ }
+
+ private static OmBucketInfo createLinkBucketInfo(String linkVolume, String sourceVolume) {
+ return OmBucketInfo.newBuilder()
+ .setVolumeName(linkVolume)
+ .setBucketName("link")
+ .setSourceVolume(sourceVolume)
+ .setSourceBucket("source")
+ .addAllMetadata(singletonMap("linkKey", "linkValue"))
+ .build();
+ }
+
+ private static OmBucketInfo createSourceBucketInfo(String sourceVolume) {
+ return OmBucketInfo.newBuilder()
+ .setVolumeName(sourceVolume)
+ .setBucketName("source")
+ .addAllMetadata(singletonMap("sourceKey", "sourceValue"))
+ .build();
+ }
+
+ private static void denySourceRead(OmMetadataReader metadataReader, String sourceVolume) throws IOException {
+ doAnswer(invocation -> {
+ if (sourceVolume.equals(invocation.getArgument(3)) && "source".equals(invocation.getArgument(4))) {
+ throw new OMException("denied", ResultCodes.PERMISSION_DENIED);
+ }
+ return null;
+ }).when(metadataReader).checkAcls(any(), any(), any(), any(), any(), any());
+ }
+
+ private OzoneManager createAclEnabledOmSpy(BucketManager bucketManager, OmMetadataReader metadataReader) {
+ OzoneManager omSpy = spy(omTestManagers.getOzoneManager());
+ HddsWhiteboxTestUtils.setInternalState(omSpy, "bucketManager", bucketManager);
+ HddsWhiteboxTestUtils.setInternalState(omSpy, "omMetadataReader", metadataReader);
+ when(omSpy.getAclsEnabled()).thenReturn(true);
+ AuditMessage auditMessage = mock(AuditMessage.class);
Review Comment:
Stubbing a method on a Mockito spy via `when(spy.method()).thenReturn(...)` will invoke the real method during stubbing, which can introduce unintended side effects / flakiness. Prefer `doReturn(...).when(spy)...` for spies (consistent with the other stubs in this helper).
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3651203005
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
+ try {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.READ, resolvedBucket.realVolume(),
+ resolvedBucket.realBucket(), null);
+ } catch (OMException e) {
+ if (e.getResult() == PERMISSION_DENIED) {
+ return null;
+ }
+ throw e;
Review Comment:
Updated the PR description to match the intended behavior: when source READ is denied, both getBucketInfo and listBuckets return the stored link information without copying source operational properties. Also corrected the listed unit test name.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3648748166
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
+ try {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.READ, resolvedBucket.realVolume(),
+ resolvedBucket.realBucket(), null);
+ } catch (OMException e) {
+ if (e.getResult() == PERMISSION_DENIED) {
+ return null;
+ }
+ throw e;
Review Comment:
The PR description says `getBucketInfo` should propagate `PERMISSION_DENIED` when the caller cannot READ the resolved source bucket, but this change explicitly swallows `PERMISSION_DENIED` and returns `null` (which causes link enrichment to be skipped and `getBucketInfo` to return the original link bucket). The new unit test `testGetBucketInfoReturnsLinkWithoutSourceReadAccess` also asserts this non-throwing behavior.
Please align behavior and documentation: either update the PR description (and/or test names) to reflect “skip enrichment on source READ denied”, or change the implementation so `getBucketInfo` throws on source READ denied while `listBuckets` continues with the raw link entry.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3647773775
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmBucketInfo.java:
##########
Review Comment:
let's do that here
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3647773135
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
+ try {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.READ, resolvedBucket.realVolume(),
+ resolvedBucket.realBucket(), null);
+ } catch (OMException e) {
+ if (e.getResult() == PERMISSION_DENIED) {
+ return null;
Review Comment:
Yup. Fixed
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3647880484
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
+ try {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.READ, resolvedBucket.realVolume(),
+ resolvedBucket.realBucket(), null);
+ } catch (OMException e) {
+ if (e.getResult() == PERMISSION_DENIED) {
+ return null;
Review Comment:
I think the reason Codex did that was because of this:
https://github.com/apache/ozone/blob/77ceb2969b507096fe97482da3a1e693ccc64561/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java#L3011-L3018
`listBuckets` is doing a best-effort resolution of the links. If it hits `PERMISSION_DENIED`, it will leave that OmBucketInfo untouched
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl merged PR #10859:
URL: https://github.com/apache/ozone/pull/10859
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on PR #10859:
URL: https://github.com/apache/ozone/pull/10859#issuecomment-5263424261
Thanks @jojochuang for the review.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3644344176
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestBucketManagerImpl.java:
##########
@@ -540,4 +554,114 @@ public void testListBucketsResolvesFsoAndObsLinkLayouts() throws Exception {
assertEquals(volume, listedObsLink.getSourceVolume());
assertEquals("obs-source", listedObsLink.getSourceBucket());
}
+
+ @Test
+ void testGetBucketInfoDoesNotCopySourcePropertiesWithoutReadAccess() throws Exception {
+ String linkVolume = volumeName();
+ String sourceVolume = volumeName();
+ OmBucketInfo link = createLinkBucketInfo(linkVolume, sourceVolume);
+ OmBucketInfo source = createSourceBucketInfo(sourceVolume);
+ BucketManager bucketManager = mock(BucketManager.class);
+ when(bucketManager.getBucketInfo(linkVolume, "link")).thenReturn(link);
+ when(bucketManager.getBucketInfo(sourceVolume, "source")).thenReturn(source);
+ OmMetadataReader metadataReader = mock(OmMetadataReader.class);
+ denySourceRead(metadataReader, sourceVolume);
+ OzoneManager omSpy = createAclEnabledOmSpy(bucketManager, metadataReader);
+
+ OmBucketInfo result = omSpy.getBucketInfo(linkVolume, "link");
+
+ assertSame(link, result);
+ verify(metadataReader).checkAcls(BUCKET, OZONE, READ, sourceVolume, "source", null);
+ }
Review Comment:
This test name says source properties should not be copied when source READ is denied, but the assertion only checks object identity (assertSame). That’s brittle and doesn’t actually assert the behavioral contract (no source operational properties leak) or that the source bucket isn’t fetched. Consider asserting metadata does not include source entries and verifying the source getBucketInfo is not invoked.
This issue also appears on line 595 of the same file.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3647087063
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
Review 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.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-15961. Resolve linked bucket source properties consistently [ozone]
Posted by "smengcl (via GitHub)" <gi...@apache.org>.
smengcl commented on code in PR #10859:
URL: https://github.com/apache/ozone/pull/10859#discussion_r3648734430
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -3078,6 +3080,18 @@ private OmBucketInfo getResolvedSourceBucket(
return cachedSource;
}
}
+ if (getAclsEnabled()) {
+ try {
+ omMetadataReader.checkAcls(ResourceType.BUCKET, StoreType.OZONE,
+ ACLType.READ, resolvedBucket.realVolume(),
+ resolvedBucket.realBucket(), null);
+ } catch (OMException e) {
+ if (e.getResult() == PERMISSION_DENIED) {
+ return null;
Review Comment:
Oh well throwing PERMISSION_DENIED breaks the `bucket info` contract. Failed CI:
https://github.com/smengcl/hadoop-ozone/actions/runs/30124567390/job/89610053056
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org