priyeshkaratha commented on code in PR #10996:
URL: https://github.com/apache/ozone/pull/10996#discussion_r3764126942
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java:
##########
@@ -3440,6 +3446,65 @@ public void testPartCountLimitedListBoundaryBehavior() {
assertEquals(0, overList.getPartCount());
}
+ /**
+ * Regression test: KeyLifecycleService must delete keys even when
ozone.acl.enabled=true.
+ * Before the fix, sendDeleteKeysRequestAndClearList submitted DeleteKeys
requests without
+ * userInfo (missing preExecute / ugi.doAs), causing UNAUTHORIZED when
resolveBucketLink
+ * called createUGIForApi() on the blank-userName request. Uses OBJECT_STORE
layout because
+ * that path calls sendDeleteKeysRequestAndClearList directly (not via
moveToTrash).
+ */
+ @Nested
+ @TestInstance(TestInstance.Lifecycle.PER_CLASS)
+ class WithAclsEnabled {
+
+ @BeforeAll
+ void setup(@TempDir File testDir) throws Exception {
+ scmBlockTestingClient = new ScmBlockLocationTestingClient(null, null, 0);
+ createConfig(testDir);
+ conf.setBoolean(OZONE_TEST_AUTHORIZATION_ENABLED, true);
+ conf.setBoolean(OZONE_ACL_ENABLED, true);
+ conf.set(OZONE_ACL_AUTHORIZER_CLASS, OZONE_ACL_AUTHORIZER_CLASS_NATIVE);
+ conf.setStrings(OZONE_ADMINISTRATORS, OZONE_ADMINISTRATORS_WILDCARD);
+ createSubject();
+ keyDeletingService.suspend();
+ directoryDeletingService.suspend();
+ }
+
+ @AfterAll
+ void cleanup() {
+ if (om != null) {
+ om.stop();
+ om.join();
+ }
+ }
+
+ @Test
+ void testLifecycleDeleteSucceedsWithAclsEnabled()
Review Comment:
Done
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java:
##########
@@ -3440,6 +3446,65 @@ public void testPartCountLimitedListBoundaryBehavior() {
assertEquals(0, overList.getPartCount());
}
+ /**
+ * Regression test: KeyLifecycleService must delete keys even when
ozone.acl.enabled=true.
+ * Before the fix, sendDeleteKeysRequestAndClearList submitted DeleteKeys
requests without
+ * userInfo (missing preExecute / ugi.doAs), causing UNAUTHORIZED when
resolveBucketLink
+ * called createUGIForApi() on the blank-userName request. Uses OBJECT_STORE
layout because
Review Comment:
Done
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -1670,12 +1687,14 @@ public void setListMaxSize(int size) {
this.listMaxSize = size;
}
- @VisibleForTesting
- public void setMpuAbortLimitPerTask(int limit) {
- this.mpuAbortLimitPerTask = limit;
+ // Returns the test-injected OzoneTrash if set, otherwise the live instance
+ // from OzoneManager. This is needed because startTrashEmptier() runs after
+ // keyManager.start() in all OzoneManager startup paths, so the field cannot
+ // be populated eagerly in the constructor.
+ private OzoneTrash getEffectiveOzoneTrash() {
+ return ozoneTrash != null ? ozoneTrash : ozoneManager.getOzoneTrash();
}
- @VisibleForTesting
Review Comment:
Yes
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]