hemantk-12 commented on code in PR #5976:
URL: https://github.com/apache/ozone/pull/5976#discussion_r1453860118


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RocksDatabase.java:
##########
@@ -353,27 +336,49 @@ public String toString() {
   }
 
   private final String name;
+  private final Throwable creationStackTrace = new Throwable("Object creation 
stack trace");
+
   private final ManagedRocksDB db;
   private final ManagedDBOptions dbOptions;
   private final ManagedWriteOptions writeOptions;
   private final List<ColumnFamilyDescriptor> descriptors;
+  /** column family names -> {@link ColumnFamily}. */
   private final Map<String, ColumnFamily> columnFamilies;
+  /** {@link ColumnFamilyHandle#getID()} -> column family names. */
+  private final Supplier<Map<Integer, String>> columnFamilyNames;
 
   private final AtomicBoolean isClosed = new AtomicBoolean();
-  private final AtomicLong counter;
+  /** Count the number of operations running concurrently. */
+  private final AtomicLong counter = new AtomicLong();
 
   private RocksDatabase(File dbFile, ManagedRocksDB db,
       ManagedDBOptions dbOptions, ManagedWriteOptions writeOptions,
-      List<ColumnFamilyDescriptor> descriptors,
-      Map<String, ColumnFamily> columnFamilies, AtomicLong counter) {
+      List<ColumnFamilyDescriptor> descriptors, List<ColumnFamilyHandle> 
handles) throws RocksDBException {
     this.name = getClass().getSimpleName() + "[" + dbFile + "]";
     this.db = db;
     this.dbOptions = dbOptions;
     this.writeOptions = writeOptions;
     this.descriptors = descriptors;
-    this.columnFamilies = columnFamilies;
-    this.counter = counter;
-    this.stackTrace = Thread.currentThread().getStackTrace();
+    this.columnFamilies = newMap(handles);
+    this.columnFamilyNames = MemoizedSupplier.valueOf(() -> 
toMap(columnFamilies.values()));
+  }
+
+  private Map<String, ColumnFamily> newMap(List<ColumnFamilyHandle> handles) 
throws RocksDBException {

Review Comment:
   nit: `newMap` and `toMap` are very generic names and seem like can be used 
to create/convert any type of Map.
   I think `newMap` could be `toColumnFamilyMap` and `toMap` be 
`toColumnFamilyIdToNameMap` or something along the line.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RocksDatabase.java:
##########
@@ -289,10 +280,6 @@ public ColumnFamilyHandle getHandle() {
       return handle;

Review Comment:
   nit: please remove `@VisibleForTesting`. it is used in src code now.



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