xichen01 commented on code in PR #9255:
URL: https://github.com/apache/ozone/pull/9255#discussion_r2524260808
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmLifecycleConfiguration.java:
##########
@@ -195,11 +209,20 @@ public LifecycleConfiguration getProtobuf() {
.setObjectID(getObjectID())
.setUpdateID(getUpdateID());
+ if (bucketObjectID != null) {
Review Comment:
Perhaps we can set `bucketObjectID` to -1 or some other special value, so
that the `bucketObjectID` of the version containing the Lifecycle feature will
definitely have one valid bucket ObjectID (it is not -1), ultimately achieving
the same effect.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/lifecycle/OMLifecycleConfigurationSetRequest.java:
##########
@@ -127,29 +128,31 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager, Execut
AuditLogger auditLogger = ozoneManager.getAuditLogger();
UserInfo userInfo = getOmRequest().getUserInfo();
- String bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
IOException exception = null;
boolean acquiredBucketLock = false;
OMClientResponse omClientResponse = null;
Map<String, String> auditMap = new HashMap<>();
-
try {
- OmLifecycleConfiguration omLifecycleConfiguration =
- OmLifecycleConfiguration.getFromProtobuf(lifecycleConfiguration);
- auditMap = omLifecycleConfiguration.toAuditMap();
-
mergeOmLockDetails(metadataManager.getLock()
.acquireWriteLock(BUCKET_LOCK, volumeName, bucketName));
acquiredBucketLock = getOmLockDetails().isLockAcquired();
- omLifecycleConfiguration.valid();
- if (!metadataManager.getBucketTable().isExist(bucketKey)) {
+ String bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
+ OmBucketInfo bucketInfo =
metadataManager.getBucketTable().get(bucketKey);
+ if (bucketInfo == null) {
LOG.debug("bucket: {} in volume: {} doesn't exist", bucketName,
volumeName);
throw new OMException("Bucket doesn't exist", BUCKET_NOT_FOUND);
}
- omLifecycleConfiguration.setUpdateID(transactionLogIndex);
+ OmLifecycleConfiguration.Builder lcBuilder =
+
OmLifecycleConfiguration.getBuilderFromProtobuf(lifecycleConfiguration);
+ OmLifecycleConfiguration omLifecycleConfiguration =
+ lcBuilder.setBucketObjectID(bucketInfo.getObjectID()).build();
+ omLifecycleConfiguration.valid();
+ auditMap = omLifecycleConfiguration.toAuditMap();
+
+ omLifecycleConfiguration.setUpdateID(transactionLogIndex);
Review Comment:
Seems the `OmLifecycleConfiguration` is not a `@Immutable`, since it can be
modified, maybe we should remove the @Immutable on the
`OmLifecycleConfiguration`
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/S3LifecycleConfiguration.java:
##########
@@ -251,6 +251,7 @@ public void setAndOperator(AndOperator andOperator) {
}
}
+ // OzoneBucket doesn't have objectID info.
Review Comment:
This seems to be fine; OM itself knows the bucket's ObjectID.
--
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]