szetszwo commented on code in PR #9555:
URL: https://github.com/apache/ozone/pull/9555#discussion_r2649344449


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java:
##########
@@ -143,13 +255,18 @@ private class OpCache {
     /** A cache for a {@link ColumnFamily}. */
     private class FamilyCache {
       private final ColumnFamily family;
+
       /**
-       * A (dbKey -> dbValue) map, where the dbKey type is {@link Bytes}
-       * and the dbValue type is {@link Object}.
-       * When dbValue is a byte[]/{@link ByteBuffer}, it represents a put-op.
-       * Otherwise, it represents a delete-op (dbValue is {@link Op#DELETE}).
+       * A mapping of keys to operations for batch processing in the {@link 
FamilyCache}.
+       * The keys are represented as {@link Bytes} objects, encapsulating the 
byte array or buffer
+       * for efficient equality and hashing. The values are instances of 
{@link Op}, representing
+       * different types of operations that can be applied to a {@link 
ColumnFamily}.
+       *
+       * This field is intended to store pending batch updates before they are 
written to the database.
+       * It supports operations such as additions and deletions while 
maintaining the ability to overwrite
+       * existing entries when necessary.
        */
-      private final Map<Bytes, Object> ops = new HashMap<>();
+      private final Map<Bytes, Op> batchOps = new HashMap<>();

Review Comment:
   ops is better since the class is Op.  batchOps should mean objects of 
RDBBatchOperation.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java:
##########
@@ -135,9 +135,9 @@ public String toString() {
     }
   }
 
-  private abstract class Operation implements Closeable {
+  private abstract static class Op implements Closeable {
 
-    private Operation() {
+    private Op() {
     }

Review Comment:
   Remove this empty constructor.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java:
##########
@@ -42,6 +45,9 @@
 public final class RDBBatchOperation implements BatchOperation {
   static final Logger LOG = LoggerFactory.getLogger(RDBBatchOperation.class);
 
+  private static final String PUT_OP = "PUT";
+  private static final String DELETE_OP = "DELETE";

Review Comment:
   Use class name and remove string constants.



-- 
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]

Reply via email to