sumitagrawl commented on code in PR #3974:
URL: https://github.com/apache/ozone/pull/3974#discussion_r1025373127


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -40,6 +40,7 @@ public class NSSummaryTaskDbEventHandler {
 
   private static final Logger LOG =
       LoggerFactory.getLogger(NSSummaryTaskDbEventHandler.class);
+  public static final long NSSUMMARY_FLUSH_TO_DB_MAX_THRESHOLD = 150 * 1000L;

Review Comment:
   check if this needs expose as configuration



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -194,4 +195,24 @@ protected void handleDeleteDirEvent(OmDirectoryInfo 
directoryInfo,
     nsSummary.removeChildDir(objectId);
     nsSummaryMap.put(parentObjectId, nsSummary);
   }
+
+  protected boolean flushAndCommitNSToDB(Map<Long, NSSummary> nsSummaryMap) {
+    try {
+      writeNSSummariesToDB(nsSummaryMap);
+    } catch (IOException e) {
+      LOG.error("Unable to write Namespace Summary data in Recon DB.", e);
+      return false;
+    }
+    return true;
+  }
+
+  protected boolean checkAndCallFlushToDB(
+      Map<Long, NSSummary> nsSummaryMap) {
+    // if map contains more than entries, flush to DB and clear the map
+    if (null != nsSummaryMap && nsSummaryMap.size() ==

Review Comment:
   Check should be nsSummaryMap.size() >= NSSUMMARY_FLUSH_TO_DB_MAX_THRESHOLD



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