ivandika3 commented on code in PR #9255:
URL: https://github.com/apache/ozone/pull/9255#discussion_r2501402342
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/lifecycle/OMLifecycleConfigurationSetRequest.java:
##########
@@ -149,6 +149,7 @@ public OMClientResponse validateAndUpdateCache(OzoneManager
ozoneManager, Execut
throw new OMException("Bucket doesn't exist", BUCKET_NOT_FOUND);
}
omLifecycleConfiguration.setUpdateID(transactionLogIndex);
+
omLifecycleConfiguration.setBucketObjectID(metadataManager.getBucketId(volumeName,
bucketName));
Review Comment:
Nit: Since we already both `isExist` and `getBucketId` which will query the
bucket table twice, how about combine this to simply get the bucket info once?
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/response/bucket/OMBucketDeleteResponse.java:
##########
@@ -32,7 +33,7 @@
/**
* Response for DeleteBucket request.
*/
-@CleanupTableInfo(cleanupTables = {BUCKET_TABLE, VOLUME_TABLE})
+@CleanupTableInfo(cleanupTables = {BUCKET_TABLE, VOLUME_TABLE,
LIFECYCLE_CONFIGURATION_TABLE})
Review Comment:
Good catch.
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmLifecycleConfiguration.java:
##########
@@ -230,6 +245,7 @@ public static OmLifecycleConfiguration getFromProtobuf(
public static class Builder extends WithObjectID.Builder {
private String volume = "";
private String bucket = "";
+ private long bucketObjectID = -1L;
Review Comment:
How about set this to `Long` instead of -1L? If we forget to set this in
some places, the object ID might be wrongly set to -1 and lifecycle
configuration might not work.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java:
##########
@@ -270,6 +270,12 @@ public BackgroundTaskResult call() {
onFailure(bucketKey);
return result;
}
+ if (bucket.getObjectID() != policy.getBucketObjectID()) {
+ LOG.warn("Bucket object ID doesn't match. ID in bucket is {}, ID
in LifecycleConfiguration is {}.",
+ bucket.getObjectID(), policy.getBucketObjectID());
+ onFailure(bucketKey);
+ return result;
+ }
Review Comment:
How about we still allow the lifecycle service to proceed if the
`OmLifecycleConfiguration#getObjectID` is unset (null or -1)?
--
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]