Copilot commented on code in PR #9426:
URL: https://github.com/apache/ozone/pull/9426#discussion_r2597026647
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java:
##########
@@ -1537,6 +1539,48 @@ void testMultipleDirectoriesMatched(String keyPrefix1,
String keyPrefix2, String
}
deleteLifecyclePolicy(volumeName, bucketName);
}
+
+ @Test
+ void testGetLifecycleServiceStatus() throws Exception {
+ final String volumeName = getTestName();
+ final String bucketName = uniqueObjectName("bucket");
+ String prefix = "key";
+
+ //Sservice should be enabled but not running
Review Comment:
Spelling error in comment: "Sservice" should be "Service".
```suggestion
//Service should be enabled but not running
```
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -219,12 +221,26 @@ public void resume() {
suspended.set(false);
}
+ public void setServiceEnabled(boolean enabled) {
+ this.isServiceEnabled.set(enabled);
+ LOG.info("KeyLifecycleService is {}", enabled ? "enabled" : "disabled");
+ }
Review Comment:
Missing JavaDoc for public method `setServiceEnabled`. This method enables
or disables the lifecycle service at runtime and is part of the reconfiguration
feature, so it should be documented to explain its purpose and parameters.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -219,12 +221,26 @@ public void resume() {
suspended.set(false);
}
+ public void setServiceEnabled(boolean enabled) {
+ this.isServiceEnabled.set(enabled);
+ LOG.info("KeyLifecycleService is {}", enabled ? "enabled" : "disabled");
+ }
+
@Override
public void shutdown() {
super.shutdown();
KeyLifecycleServiceMetrics.unregister();
}
+ public GetLifecycleServiceStatusResponse status() {
+ Set<String> runningBuckets = new HashSet<>(inFlight.keySet());
+ return GetLifecycleServiceStatusResponse.newBuilder()
+ .setIsRunning(!runningBuckets.isEmpty())
+ .setIsEnabled(isServiceEnabled.get())
+ .addAllRunningBuckets(runningBuckets)
+ .build();
+ }
Review Comment:
Missing JavaDoc for public method `status`. This method returns the current
status of the lifecycle service (enabled/running state and buckets being
processed) and should be documented to explain what it returns and when it
should be called.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -470,6 +491,11 @@ private void evaluateKeyAndDirTable(OmBucketInfo bucket,
long volumeObjId, Table
HashSet<Long> deletedDirSet = new HashSet<>();
while (!stack.isEmpty()) {
+ if (!shouldRun()) {
+ LOG.info("KeyLifecycleService is suspended or disabled." +
Review Comment:
This string appears to be missing a space after 'disabled.'.
```suggestion
LOG.info("KeyLifecycleService is suspended or disabled. " +
```
--
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]