aryangupta1998 commented on code in PR #5971:
URL: https://github.com/apache/ozone/pull/5971#discussion_r1447743417


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -1655,8 +1655,18 @@ public void start() throws IOException {
         .getBucketTable()));
 
     if (getMetricsStorageFile().exists()) {
-      OmMetricsInfo metricsInfo = READER.readValue(getMetricsStorageFile());
-      metrics.setNumKeys(metricsInfo.getNumKeys());
+      OmMetricsInfo metricsInfo = null;
+      try {
+        metricsInfo = READER.readValue(getMetricsStorageFile());
+      } catch (Exception e) {
+        LOG.error("Failure to parse OM Metrics File", e);
+      }
+      if (metricsInfo != null) {
+        metrics.setNumKeys(metricsInfo.getNumKeys());
+      } else {
+        metrics.setNumKeys(metadataManager.countEstimatedRowsInTable(
+            metadataManager.getKeyTable(BucketLayout.LEGACY)));

Review Comment:
   Can we have `getBucketLayout()` instead of passing `BucketLayout.LEGACY`?



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