prashantpogde commented on code in PR #4190:
URL: https://github.com/apache/ozone/pull/4190#discussion_r1093606831


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -113,54 +133,151 @@ public SnapshotDiffReport getSnapshotDiffReport(final 
String volume,
     final BucketLayout bucketLayout = getBucketLayout(volume, bucket,
         fromSnapshot.getMetadataManager());
 
-    /*
-     * The reason for having ObjectID to KeyName mapping instead of OmKeyInfo
-     * is to reduce the memory footprint.
-     */
-    final Map<Long, String> oldObjIdToKeyMap = new HashMap<>();
-    // Long --> const. length
-    // String --> var. length "/dir1/dir2/dir3/dir4/dir5/key1"
-    final Map<Long, String> newObjIdToKeyMap = new HashMap<>();
-
-    final Set<Long> objectIDsToCheck = new HashSet<>();
-
-    // add to object ID map for key/file.
-
-    final Table<String, OmKeyInfo> fsKeyTable = fromSnapshot
-        .getMetadataManager().getKeyTable(bucketLayout);
-    final Table<String, OmKeyInfo> tsKeyTable = toSnapshot
-        .getMetadataManager().getKeyTable(bucketLayout);
-    final Set<String> deltaFilesForKeyOrFileTable =
-        getDeltaFiles(fromSnapshot, toSnapshot,
-            Collections.singletonList(fsKeyTable.getName()),
-            fsInfo, tsInfo, volume, bucket);
-
-    addToObjectIdMap(fsKeyTable, tsKeyTable, deltaFilesForKeyOrFileTable,
-        oldObjIdToKeyMap, newObjIdToKeyMap, objectIDsToCheck, false);
-
-    if (bucketLayout.isFileSystemOptimized()) {
-      // add to object ID map for directory.
-      final Table<String, OmDirectoryInfo> fsDirTable =
-          fromSnapshot.getMetadataManager().getDirectoryTable();
-      final Table<String, OmDirectoryInfo> tsDirTable =
-          toSnapshot.getMetadataManager().getDirectoryTable();
-      final Set<String> deltaFilesForDirTable =
+    // TODO: This should comes from request itself.
+    String requestId = UUID.randomUUID().toString();
+
+    ColumnFamilyHandle fromSnapshotColumnFamily = null;
+    ColumnFamilyHandle toSnapshotColumnFamily = null;
+    ColumnFamilyHandle objectIDsColumnFamily = null;
+    ColumnFamilyHandle diffReportColumnFamily = null;
+
+    try {
+      // RequestId is prepended to column family name to make it unique
+      // for request.
+      fromSnapshotColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-fromSnapshot"),
+              new ColumnFamilyOptions()));
+      toSnapshotColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-toSnapshot"),
+              new ColumnFamilyOptions()));
+      objectIDsColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-objectIDs"),
+              new ColumnFamilyOptions()));
+      diffReportColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-diffReport"),
+              new ColumnFamilyOptions()));
+      /*
+       * The reason for having ObjectID to KeyName mapping instead of OmKeyInfo
+       * is to reduce the memory footprint.
+       */
+      final PersistentMap<Long, String> oldObjIdToKeyPersistentMap =
+          new RocksDbPersistentMap<>(rocksDB,
+              fromSnapshotColumnFamily,
+              codecRegistry,
+              Long.class,
+              String.class);
+
+      // Long --> const. length
+      // String --> var. length "/dir1/dir2/dir3/dir4/dir5/key1"

Review Comment:
   Having some comments here would help as to how these different maps are used.



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