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


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/tasks/NSSummaryTaskDbEventHandler.java:
##########
@@ -194,4 +204,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

Review Comment:
   It seems that `nsSummaryMap` does not get cleared.



##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/TestNSSummaryEndpointWithFSO.java:
##########
@@ -341,6 +343,9 @@ public class TestNSSummaryEndpointWithFSO {
 
   @Before
   public void setUp() throws Exception {
+    ozoneConfiguration = new OzoneConfiguration();
+    ozoneConfiguration.setLong(OZONE_RECON_NSSUMMARY_FLUSH_TO_DB_MAX_THRESHOLD,
+        150 * 1000L);

Review Comment:
   Let's set it to a small value, say 10, in the unit tests.



##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/tasks/TestNSSummaryTaskWithFSO.java:
##########
@@ -117,6 +121,9 @@ private TestNSSummaryTaskWithFSO() {
 
   @BeforeClass
   public static void setUp() throws Exception {
+    ozoneConfiguration = new OzoneConfiguration();
+    ozoneConfiguration.setLong(OZONE_RECON_NSSUMMARY_FLUSH_TO_DB_MAX_THRESHOLD,
+        150 * 1000L);

Review Comment:
   Let's set it to a small value, say 10, in the unit tests.



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