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


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -271,61 +359,130 @@ private Set<String> getDeltaFiles(OmSnapshot 
fromSnapshot,
   }
 
   private List<DiffReportEntry> generateDiffReport(
-      final Set<Long> objectIDsToCheck,
-      final Map<Long, String> oldObjIdToKeyMap,
-      final Map<Long, String> newObjIdToKeyMap) {
-
-    final List<DiffReportEntry> deleteDiffs = new ArrayList<>();
-    final List<DiffReportEntry> renameDiffs = new ArrayList<>();
-    final List<DiffReportEntry> createDiffs = new ArrayList<>();
-    final List<DiffReportEntry> modifyDiffs = new ArrayList<>();
-
-
-    for (Long id : objectIDsToCheck) {
-      /*
-       * This key can be
-       * -> Created after the old snapshot was taken, which means it will be
-       *    missing in oldKeyTable and present in newKeyTable.
-       * -> Deleted after the old snapshot was taken, which means it will be
-       *    present in oldKeyTable and missing in newKeyTable.
-       * -> Modified after the old snapshot was taken, which means it will be
-       *    present in oldKeyTable and present in newKeyTable with same
-       *    Object ID but with different metadata.
-       * -> Renamed after the old snapshot was taken, which means it will be
-       *    present in oldKeyTable and present in newKeyTable but with 
different
-       *    name and same Object ID.
-       */
-
-      final String oldKeyName = oldObjIdToKeyMap.get(id);
-      final String newKeyName = newObjIdToKeyMap.get(id);
-
-      if (oldKeyName == null && newKeyName == null) {
-        // This cannot happen.
-        continue;
+      final String requestId,
+      final PersistentMap<Long, byte[]> objectIDsToCheck,
+      final PersistentMap<Long, String> oldObjIdToKeyMap,
+      final PersistentMap<Long, String> newObjIdToKeyMap
+  ) throws RocksDBException, IOException {
+
+    // RequestId is prepended to column family name to make it unique
+    // for request.
+    ColumnFamilyHandle deleteDiffColumnFamily = null;
+    ColumnFamilyHandle renameDiffColumnFamily = null;
+    ColumnFamilyHandle createDiffColumnFamily = null;
+    ColumnFamilyHandle modifyDiffColumnFamily = null;
+
+    try {
+      deleteDiffColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-deleteDiff"),
+              new ColumnFamilyOptions()));
+      renameDiffColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-renameDiff"),
+              new ColumnFamilyOptions()));
+      createDiffColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-createDiff"),
+              new ColumnFamilyOptions()));
+      modifyDiffColumnFamily = rocksDB.createColumnFamily(
+          new ColumnFamilyDescriptor(
+              codecRegistry.asRawData(requestId + "-modifyDiff"),
+              new ColumnFamilyOptions()));
+
+      final PersistentMap<Long, DiffReportEntry> deleteDiffs =
+          createDiffReportPersistentMap(deleteDiffColumnFamily);

Review Comment:
   > We will rely on RocksDB's mem-tables size for that as of now
   
   
   I like the idea of letting Rocksdb manage memory, but if we don't want a 
disk write on each db op, we should consider disabling the WAL:
   http://rocksdb.org/blog/2017/08/25/flushwal.html
   



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