devmadhuu commented on code in PR #5037:
URL: https://github.com/apache/ozone/pull/5037#discussion_r1469207734


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/ReconNamespaceSummaryManagerImpl.java:
##########
@@ -84,4 +85,9 @@ public void commitBatchOperation(RDBBatchOperation 
rdbBatchOperation)
   public Table getNSSummaryTable() {
     return nsSummaryTable;
   }
+
+  @VisibleForTesting
+  public void setNsSummaryTable(Table<Long, NSSummary> nsSummaryTable) {

Review Comment:
   Do not see any usages for this method, pls check once if it is needed ?



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java:
##########
@@ -651,6 +652,36 @@ public Response getDeletedDirInfo(
     return Response.ok(deletedDirInsightInfo).build();
   }
 
+  /**
+   * Retrieves the summary of deleted directories.
+   *
+   * This method calculates and returns a summary of deleted directories.
+   * @return The HTTP  response body includes a map with the following entries:
+   * - "totalDeletedDirectories": the total number of deleted directories
+   *
+   * Example response:
+   *   {
+   *    "totalDeletedDirectories": 8,
+   *   }
+   */
+  @GET
+  @Path("/deletePending/dirs/summary")
+  public Response getDeletedDirectorySummary() throws IOException {

Review Comment:
   @ArafatKhan2198 thanks for continued effort on this patch, IMO, we should 
sum based on all keys included in these `totalDeletedDirectories` and include 
total replicated and un-replicated size as well in summary, else it will be 
difficult for end user/admin to manually sum up size of all keys we are showing 
in deletePending dir details page.



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -270,63 +236,33 @@ private void handlePutEvent(OMDBUpdateEvent<String, 
Object> event,
                               String tableName,
                               Collection<String> sizeRelatedTables,
                               HashMap<String, Long> objectCountMap,
-                              HashMap<String, Long> unreplicatedSizeCountMap,
-                              HashMap<String, Long> replicatedSizeCountMap) {
+                              HashMap<String, Long> unReplicatedSizeMap,
+                              HashMap<String, Long> replicatedSizeMap)
+      throws IOException {
+    OmTableHandler tableHandler = tableHandlers.get(tableName);
 
-    if (sizeRelatedTables.contains(tableName)) {
-      handleSizeRelatedTablePutEvent(event, tableName, objectCountMap,
-          unreplicatedSizeCountMap, replicatedSizeCountMap);
+    if (sizeRelatedTables.contains(tableName) && tableHandler != null) {
+      tableHandler.handlePutEvent(event, tableName, objectCountMap,
+          unReplicatedSizeMap, replicatedSizeMap);
     } else {
       String countKey = getTableCountKeyFromTable(tableName);
       objectCountMap.computeIfPresent(countKey, (k, count) -> count + 1L);
     }
   }
 
-  private void handleSizeRelatedTablePutEvent(
-      OMDBUpdateEvent<String, Object> event,
-      String tableName,
-      HashMap<String, Long> objectCountMap,
-      HashMap<String, Long> unreplicatedSizeCountMap,
-      HashMap<String, Long> replicatedSizeCountMap) {
-
-    String countKey = getTableCountKeyFromTable(tableName);
-    String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
-    String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
-
-    if (event.getValue() instanceof OmKeyInfo) {
-      // Handle PUT for OpenKeyTable & OpenFileTable
-      OmKeyInfo omKeyInfo = (OmKeyInfo) event.getValue();
-      objectCountMap.computeIfPresent(countKey, (k, count) -> count + 1L);
-      unreplicatedSizeCountMap.computeIfPresent(unReplicatedSizeKey,
-          (k, size) -> size + omKeyInfo.getDataSize());
-      replicatedSizeCountMap.computeIfPresent(replicatedSizeKey,
-          (k, size) -> size + omKeyInfo.getReplicatedSize());
-    } else if (event.getValue() instanceof RepeatedOmKeyInfo) {
-      // Handle PUT for DeletedTable
-      RepeatedOmKeyInfo repeatedOmKeyInfo =
-          (RepeatedOmKeyInfo) event.getValue();
-      objectCountMap.computeIfPresent(countKey,
-          (k, count) -> count + repeatedOmKeyInfo.getOmKeyInfoList().size());
-      Pair<Long, Long> result = repeatedOmKeyInfo.getTotalSize();
-      unreplicatedSizeCountMap.computeIfPresent(unReplicatedSizeKey,
-          (k, size) -> size + result.getLeft());
-      replicatedSizeCountMap.computeIfPresent(replicatedSizeKey,
-          (k, size) -> size + result.getRight());
-    }
-  }
-
-
   private void handleDeleteEvent(OMDBUpdateEvent<String, Object> event,
                                  String tableName,
                                  Collection<String> sizeRelatedTables,
                                  HashMap<String, Long> objectCountMap,
-                                 HashMap<String, Long> 
unreplicatedSizeCountMap,
-                                 HashMap<String, Long> replicatedSizeCountMap) 
{
+                                 HashMap<String, Long> unReplicatedSizeMap,
+                                 HashMap<String, Long> replicatedSizeMap)
+      throws IOException {
+    OmTableHandler tableHandler = tableHandlers.get(tableName);
 
     if (event.getValue() != null) {
       if (sizeRelatedTables.contains(tableName)) {

Review Comment:
   Any reason `tableHandler` null check is not done here as being done in 
`handlePutEvent` ?



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OpenKeysInsightHandler.java:
##########
@@ -0,0 +1,175 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.recon.tasks;
+
+import org.apache.commons.lang3.tuple.Triple;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.hadoop.hdds.utils.db.TableIterator;
+import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * Manages records in the OpenKey Table, updating counts and sizes of
+ * open keys in the backend.
+ */
+public class OpenKeysInsightHandler implements OmTableHandler {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(OpenKeysInsightHandler.class);
+
+  /**
+   * Invoked by the process method to add information on those keys that have
+   * been open in the backend.
+   */
+  @Override
+  public void handlePutEvent(OMDBUpdateEvent<String, Object> event,
+                             String tableName,
+                             HashMap<String, Long> objectCountMap,
+                             HashMap<String, Long> unReplicatedSizeMap,
+                             HashMap<String, Long> replicatedSizeMap) {
+
+    String countKey = getTableCountKeyFromTable(tableName);
+    String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
+    String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
+
+    if (event.getValue() != null) {
+      OmKeyInfo omKeyInfo = (OmKeyInfo) event.getValue();
+      objectCountMap.computeIfPresent(countKey, (k, count) -> count + 1L);
+      unReplicatedSizeMap.computeIfPresent(unReplicatedSizeKey,
+          (k, size) -> size + omKeyInfo.getDataSize());
+      replicatedSizeMap.computeIfPresent(replicatedSizeKey,
+          (k, size) -> size + omKeyInfo.getReplicatedSize());
+    } else {
+      LOG.warn("Put event does not have the Key Info for {}.",
+          event.getKey());
+    }
+  }
+
+  /**
+   * Invoked by the process method to delete information on those keys that are
+   * no longer closed in the backend.
+   */
+  @Override
+  public void handleDeleteEvent(OMDBUpdateEvent<String, Object> event,
+                                String tableName,
+                                HashMap<String, Long> objectCountMap,
+                                HashMap<String, Long> unReplicatedSizeMap,
+                                HashMap<String, Long> replicatedSizeMap) {
+
+    String countKey = getTableCountKeyFromTable(tableName);
+    String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
+    String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
+
+    if (event.getValue() != null) {
+      OmKeyInfo omKeyInfo = (OmKeyInfo) event.getValue();
+      objectCountMap.computeIfPresent(countKey,
+          (k, count) -> count > 0 ? count - 1L : 0L);
+      unReplicatedSizeMap.computeIfPresent(unReplicatedSizeKey,
+          (k, size) -> size > omKeyInfo.getDataSize() ?
+              size - omKeyInfo.getDataSize() : 0L);
+      replicatedSizeMap.computeIfPresent(replicatedSizeKey,
+          (k, size) -> size > omKeyInfo.getReplicatedSize() ?
+              size - omKeyInfo.getReplicatedSize() : 0L);
+    } else {
+      LOG.warn("Delete event does not have the Key Info for {}.",
+          event.getKey());
+    }
+  }
+
+  /**
+   * Invoked by the process method to update information on those open keys 
that
+   * have been updated in the backend.
+   */
+  @Override
+  public void handleUpdateEvent(OMDBUpdateEvent<String, Object> event,
+                                String tableName,
+                                HashMap<String, Long> objectCountMap,
+                                HashMap<String, Long> unReplicatedSizeMap,
+                                HashMap<String, Long> replicatedSizeMap) {
+
+    if (event.getValue() != null) {
+      if (event.getOldValue() == null) {
+        LOG.warn("Update event does not have the old Key Info for {}.",
+            event.getKey());
+        return;
+      }
+      String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
+      String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
+
+      // In Update event the count for the open table will not change. So we
+      // don't need to update the count.
+      OmKeyInfo oldKeyInfo = (OmKeyInfo) event.getOldValue();
+      OmKeyInfo newKeyInfo = (OmKeyInfo) event.getValue();
+      unReplicatedSizeMap.computeIfPresent(unReplicatedSizeKey,
+          (k, size) -> size - oldKeyInfo.getDataSize() +
+              newKeyInfo.getDataSize());
+      replicatedSizeMap.computeIfPresent(replicatedSizeKey,
+          (k, size) -> size - oldKeyInfo.getReplicatedSize() +
+              newKeyInfo.getReplicatedSize());
+    } else {
+      LOG.warn("Update event does not have the Key Info for {}.",
+          event.getKey());
+    }
+  }
+
+  /**
+   * This method is called by the reprocess method. It calculates the record
+   * counts for both the open key table and the open file table. Additionally,
+   * it computes the sizes of both replicated and unreplicated keys
+   * that are currently open in the backend.
+   */
+  @Override
+  public Triple<Long, Long, Long> getTableSizeAndCount(
+      TableIterator<String, ? extends Table.KeyValue<String, ?>> iterator)
+      throws IOException {
+    long count = 0;
+    long unReplicatedSize = 0;
+    long replicatedSize = 0;
+
+    if (iterator != null) {
+      while (iterator.hasNext()) {
+        Table.KeyValue<String, ?> kv = iterator.next();
+        if (kv != null && kv.getValue() != null) {
+          OmKeyInfo omKeyInfo = (OmKeyInfo) kv.getValue();
+          unReplicatedSize += omKeyInfo.getDataSize();
+          replicatedSize += omKeyInfo.getReplicatedSize();
+          count++;
+        }
+      }
+    }
+    return Triple.of(count, unReplicatedSize, replicatedSize);
+  }
+
+  public static String getTableCountKeyFromTable(String tableName) {

Review Comment:
   Same comment as above given for `DeleteKeyInsightHandler`



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -65,14 +63,27 @@ public class OmTableInsightTask implements ReconOmTask {
   private GlobalStatsDao globalStatsDao;
   private Configuration sqlConfiguration;
   private ReconOMMetadataManager reconOMMetadataManager;
+  private ReconNamespaceSummaryManagerImpl reconNamespaceSummaryManager;
+  private Table<Long, NSSummary> nsSummaryTable;

Review Comment:
   Check if we are still using this `nsSummaryTable`



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/OMDBInsightEndpoint.java:
##########
@@ -651,6 +652,36 @@ public Response getDeletedDirInfo(
     return Response.ok(deletedDirInsightInfo).build();
   }
 
+  /**
+   * Retrieves the summary of deleted directories.
+   *
+   * This method calculates and returns a summary of deleted directories.
+   * @return The HTTP  response body includes a map with the following entries:
+   * - "totalDeletedDirectories": the total number of deleted directories
+   *
+   * Example response:
+   *   {
+   *    "totalDeletedDirectories": 8,
+   *   }
+   */
+  @GET
+  @Path("/deletePending/dirs/summary")
+  public Response getDeletedDirectorySummary() throws IOException {

Review Comment:
   I think this method doesn't throw `IOException`, so not sure why we would 
need throw clause. Pls check once.



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -65,14 +63,27 @@ public class OmTableInsightTask implements ReconOmTask {
   private GlobalStatsDao globalStatsDao;
   private Configuration sqlConfiguration;
   private ReconOMMetadataManager reconOMMetadataManager;
+  private ReconNamespaceSummaryManagerImpl reconNamespaceSummaryManager;
+  private Table<Long, NSSummary> nsSummaryTable;
+  private Map<String, OmTableHandler> tableHandlers;
 
   @Inject
   public OmTableInsightTask(GlobalStatsDao globalStatsDao,
-                            Configuration sqlConfiguration,
-                            ReconOMMetadataManager reconOMMetadataManager) {
+                             Configuration sqlConfiguration,
+                             ReconOMMetadataManager reconOMMetadataManager,
+                             ReconNamespaceSummaryManagerImpl
+                                  reconNamespaceSummaryManager) {
     this.globalStatsDao = globalStatsDao;
     this.sqlConfiguration = sqlConfiguration;
     this.reconOMMetadataManager = reconOMMetadataManager;
+    this.reconNamespaceSummaryManager = reconNamespaceSummaryManager;

Review Comment:
   Don't see any usage. Did I miss anything ?



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -65,14 +63,27 @@ public class OmTableInsightTask implements ReconOmTask {
   private GlobalStatsDao globalStatsDao;
   private Configuration sqlConfiguration;
   private ReconOMMetadataManager reconOMMetadataManager;
+  private ReconNamespaceSummaryManagerImpl reconNamespaceSummaryManager;

Review Comment:
   Check if we are still using this `reconNamespaceSummaryManager`



##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/TestEndpoints.java:
##########
@@ -263,6 +265,8 @@ private void initializeInjector() throws Exception {
 
     reconScm = (ReconStorageContainerManagerFacade)
         reconTestInjector.getInstance(OzoneStorageContainerManager.class);
+    reconNamespaceSummaryManager = reconTestInjector.getInstance(

Review Comment:
   Check if you need this



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/DeletedKeysInsightHandler.java:
##########
@@ -0,0 +1,159 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.recon.tasks;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.commons.lang3.tuple.Triple;
+import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.hadoop.hdds.utils.db.TableIterator;
+import org.apache.hadoop.ozone.om.helpers.RepeatedOmKeyInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * Manages records in the Deleted Table, updating counts and sizes of
+ * pending Key Deletions in the backend.
+ */
+public class DeletedKeysInsightHandler implements OmTableHandler {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(DeletedKeysInsightHandler.class);
+
+  /**
+   * Invoked by the process method to add information on those keys that have
+   * been backlogged in the backend for deletion.
+   */
+  @Override
+  public void handlePutEvent(OMDBUpdateEvent<String, Object> event,
+                             String tableName,
+                             HashMap<String, Long> objectCountMap,
+                             HashMap<String, Long> unReplicatedSizeMap,
+                             HashMap<String, Long> replicatedSizeMap) {
+
+    String countKey = getTableCountKeyFromTable(tableName);
+    String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
+    String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
+
+    if (event.getValue() != null) {
+      RepeatedOmKeyInfo repeatedOmKeyInfo =
+          (RepeatedOmKeyInfo) event.getValue();
+      objectCountMap.computeIfPresent(countKey,
+          (k, count) -> count + repeatedOmKeyInfo.getOmKeyInfoList().size());
+      Pair<Long, Long> result = repeatedOmKeyInfo.getTotalSize();
+      unReplicatedSizeMap.computeIfPresent(unReplicatedSizeKey,
+          (k, size) -> size + result.getLeft());
+      replicatedSizeMap.computeIfPresent(replicatedSizeKey,
+          (k, size) -> size + result.getRight());
+    } else {
+      LOG.warn("Put event does not have the Key Info for {}.",
+          event.getKey());
+    }
+
+  }
+
+  /**
+   * Invoked by the process method to remove information on those keys that 
have
+   * been successfully deleted from the backend.
+   */
+  @Override
+  public void handleDeleteEvent(OMDBUpdateEvent<String, Object> event,
+                                String tableName,
+                                HashMap<String, Long> objectCountMap,
+                                HashMap<String, Long> unReplicatedSizeMap,
+                                HashMap<String, Long> replicatedSizeMap) {
+
+    String countKey = getTableCountKeyFromTable(tableName);
+    String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
+    String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
+
+    if (event.getValue() != null) {
+      RepeatedOmKeyInfo repeatedOmKeyInfo =
+          (RepeatedOmKeyInfo) event.getValue();
+      objectCountMap.computeIfPresent(countKey, (k, count) ->
+          count > 0 ? count - repeatedOmKeyInfo.getOmKeyInfoList().size() : 
0L);
+      Pair<Long, Long> result = repeatedOmKeyInfo.getTotalSize();
+      unReplicatedSizeMap.computeIfPresent(unReplicatedSizeKey,
+          (k, size) -> size > result.getLeft() ? size - result.getLeft() : 0L);
+      replicatedSizeMap.computeIfPresent(replicatedSizeKey,
+          (k, size) -> size > result.getRight() ? size - result.getRight() :
+              0L);
+    } else {
+      LOG.warn("Delete event does not have the Key Info for {}.",
+          event.getKey());
+    }
+  }
+
+  /**
+   * Invoked by the process method to update the statistics on the keys
+   * pending to be deleted.
+   */
+  @Override
+  public void handleUpdateEvent(OMDBUpdateEvent<String, Object> event,
+                                String tableName,
+                                HashMap<String, Long> objectCountMap,
+                                HashMap<String, Long> unReplicatedSizeMap,
+                                HashMap<String, Long> replicatedSizeMap) {
+    // The size of deleted keys cannot change hence no-op.
+    return;
+  }
+
+  /**
+   * Invoked by the reprocess method to calculate the records count of the
+   * deleted table and the sizes of replicated and unreplicated keys that are
+   * pending deletion in Ozone.
+   */
+  @Override
+  public Triple<Long, Long, Long> getTableSizeAndCount(
+      TableIterator<String, ? extends Table.KeyValue<String, ?>> iterator)
+      throws IOException {
+    long count = 0;
+    long unReplicatedSize = 0;
+    long replicatedSize = 0;
+
+    if (iterator != null) {
+      while (iterator.hasNext()) {
+        Table.KeyValue<String, ?> kv = iterator.next();
+        if (kv != null && kv.getValue() != null) {
+          RepeatedOmKeyInfo repeatedOmKeyInfo = (RepeatedOmKeyInfo) kv
+              .getValue();
+          Pair<Long, Long> result = repeatedOmKeyInfo.getTotalSize();
+          unReplicatedSize += result.getRight();
+          replicatedSize += result.getLeft();
+          count += repeatedOmKeyInfo.getOmKeyInfoList().size();
+        }
+      }
+    }
+    return Triple.of(count, unReplicatedSize, replicatedSize);
+  }
+
+  public static String getTableCountKeyFromTable(String tableName) {

Review Comment:
   Can we move these 3 methods in `OmTableHandler` as default implementation ?



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/OmTableInsightTask.java:
##########
@@ -335,109 +271,33 @@ private void handleDeleteEvent(OMDBUpdateEvent<String, 
Object> event,
     }
   }
 
-  private void handleSizeRelatedTableDeleteEvent(
-      OMDBUpdateEvent<String, Object> event,
-      String tableName,
-      HashMap<String, Long> objectCountMap,
-      HashMap<String, Long> unreplicatedSizeCountMap,
-      HashMap<String, Long> replicatedSizeCountMap) {
-
-    String countKey = getTableCountKeyFromTable(tableName);
-    String unReplicatedSizeKey = getUnReplicatedSizeKeyFromTable(tableName);
-    String replicatedSizeKey = getReplicatedSizeKeyFromTable(tableName);
-
-    if (event.getValue() instanceof OmKeyInfo) {
-      // Handle DELETE for OpenKeyTable & OpenFileTable
-      OmKeyInfo omKeyInfo = (OmKeyInfo) event.getValue();
-      objectCountMap.computeIfPresent(countKey,
-          (k, count) -> count > 0 ? count - 1L : 0L);
-      unreplicatedSizeCountMap.computeIfPresent(unReplicatedSizeKey,
-          (k, size) -> size > omKeyInfo.getDataSize() ?
-              size - omKeyInfo.getDataSize() : 0L);
-      replicatedSizeCountMap.computeIfPresent(replicatedSizeKey,
-          (k, size) -> size > omKeyInfo.getReplicatedSize() ?
-              size - omKeyInfo.getReplicatedSize() : 0L);
-    } else if (event.getValue() instanceof RepeatedOmKeyInfo) {
-      // Handle DELETE for DeletedTable
-      RepeatedOmKeyInfo repeatedOmKeyInfo =
-          (RepeatedOmKeyInfo) event.getValue();
-      objectCountMap.computeIfPresent(countKey, (k, count) -> count > 0 ?
-          count - repeatedOmKeyInfo.getOmKeyInfoList().size() : 0L);
-      Pair<Long, Long> result = repeatedOmKeyInfo.getTotalSize();
-      unreplicatedSizeCountMap.computeIfPresent(unReplicatedSizeKey,
-          (k, size) -> size > result.getLeft() ? size - result.getLeft() : 0L);
-      replicatedSizeCountMap.computeIfPresent(replicatedSizeKey,
-          (k, size) -> size > result.getRight() ? size - result.getRight() :
-              0L);
-    }
-  }
 
+  /**
+   * Handle update events for size related tables.
+   */
   private void handleUpdateEvent(OMDBUpdateEvent<String, Object> event,
                                  String tableName,
                                  Collection<String> sizeRelatedTables,
                                  HashMap<String, Long> objectCountMap,
-                                 HashMap<String, Long> 
unreplicatedSizeCountMap,
-                                 HashMap<String, Long> replicatedSizeCountMap) 
{
+                                 HashMap<String, Long> unReplicatedSizeMap,
+                                 HashMap<String, Long> replicatedSizeMap) {
+
+    OmTableHandler tableHandler = tableHandlers.get(tableName);
 
     if (event.getValue() != null) {
       if (sizeRelatedTables.contains(tableName)) {

Review Comment:
   Any reason `tableHandler` null check is not done here as being done in 
`handlePutEvent` ?



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