chungen0126 commented on code in PR #11293:
URL: https://github.com/apache/ozone/pull/11293#discussion_r4702598989
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmBucketInfo.java:
##########
@@ -365,6 +378,8 @@ public Map<String, String> toAuditMap() {
auditMap.put(OzoneConsts.QUOTA_IN_BYTES,
String.valueOf(this.quotaInBytes));
auditMap.put(OzoneConsts.QUOTA_IN_NAMESPACE,
String.valueOf(this.quotaInNamespace));
+ auditMap.put(OzoneConsts.OBJECT_LOCK_ENABLED,
String.valueOf(objectLockEnabled));
+ auditMap.put(OzoneConsts.DEFAULT_RETENTION, defaultRetention != null ?
defaultRetention.toString() : null);
Review Comment:
Suggest removing `DEFAULT_RETENTION` from the audit log here, as it has
dedicated get/set APIs. We should log it in those specific operations instead.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/diff/SnapshotDiffValueParser.java:
##########
@@ -112,6 +113,28 @@ public static byte[] computeKeyInfoCompareSignature(byte[]
value) throws IOExcep
case KeyInfo.ACLS_FIELD_NUMBER:
updateDigestWithBytes(digest, fieldNumber, input.readBytes());
break;
+ case KeyInfo.RETENTION_FIELD_NUMBER:
Review Comment:
I think we should keep this pr focus. Let's split changes related to snapsho
to a new jira.
##########
hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOmKeyInfo.java:
##########
@@ -54,6 +55,38 @@
*/
public class TestOmKeyInfo {
+ @Test
+ public void objectLockProtobufConversionAndCopy() throws IOException {
Review Comment:
I don't think we need extra test case for OmKeyInfo. They could be combine
into existing test cases.
##########
hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOmBucketInfo.java:
##########
@@ -40,6 +42,55 @@
*/
public class TestOmBucketInfo {
+ @Test
+ public void objectLockProtobufConversionAndCopy() {
Review Comment:
I don't think we need extra test case for OmBucketInfo. They could be
combine into existing test cases.
##########
hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestRetention.java:
##########
@@ -0,0 +1,221 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.helpers;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.google.protobuf.Descriptors.Descriptor;
+import com.google.protobuf.Descriptors.FieldDescriptor;
+import java.io.IOException;
+import java.time.Instant;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyInfo;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyInfoProtoLight;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RetentionMode;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.RetentionTimeUnit;
+import org.junit.jupiter.api.Test;
+
+/**
+ * Tests for retention configuration conversion and expiration calculations.
+ */
+class TestRetention {
Review Comment:
This test class should be dedicated to testing `RetentionUtil`. Please
rename it to `TestRetentionUtil` and focus on testing `RetentionUtil`
validation and calculation logic rather than repeatedly testing the protobuf
definitions.
Once protobuf schemas are released, they are immutable and protected by
compatibility checks—repeatedly asserting field descriptors here isn't really
meaningful.
Please redesign the test cases for this class.
##########
hadoop-ozone/integration-test-tools/src/test/java/org/apache/hadoop/ozone/debug/TestLDBCli.java:
##########
@@ -72,6 +72,7 @@
import org.junit.jupiter.api.io.TempDir;
Review Comment:
Please do not modify this class, as it is unrelated to the changes in this
PR.
--
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]