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


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java:
##########
@@ -623,6 +641,25 @@ public boolean syncDataFromOM() {
     return true;
   }
 
+  private void printOMDBMetaInfo() throws IOException {
+    printTableCount("fileTable");
+    printTableCount("keyTable");
+  }
+
+  private void printTableCount(String tableName) throws IOException {
+    Table table = omMetadataManager.getTable(tableName);
+    if (table == null) {
+      LOG.error("Table {} not found in OM Metadata.", tableName);
+      return;
+    }
+    if (LOG.isDebugEnabled()) {
+      try (TableIterator<String, ? extends Table.KeyValue<String, ?>> iterator 
= table.iterator()) {
+        long count = Iterators.size(iterator);
+        LOG.debug("{} Table count: {}", tableName, count);
+      }
+    }
+  }

Review Comment:
   > Couldn't we catch the exception from the `iterator()` and simply log that 
it happened (similarly how you do it if the table is null)? As you are only 
adding a debug log based on the table count, maybe it would be better not to 
throw the exception.
   
   Ok sure. will do.



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