This is an automated email from the ASF dual-hosted git repository.

tanvipenumudy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 3db5ad3b0c HDDS-11349. Add NullPointer handling when volume/bucket 
tables are not initialized (#7103)
3db5ad3b0c is described below

commit 3db5ad3b0c225f045e89d0c7644f605da14689ef
Author: Abhishek Pal <[email protected]>
AuthorDate: Wed Aug 21 15:55:01 2024 +0530

    HDDS-11349. Add NullPointer handling when volume/bucket tables are not 
initialized (#7103)
---
 .../ozone/recon/recovery/ReconOmMetadataManagerImpl.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
index 15fea3574a..91cb61369f 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
@@ -169,8 +169,16 @@ public class ReconOmMetadataManagerImpl extends 
OmMetadataManagerImpl
     // Unlike in {@link OmMetadataManagerImpl}, the volumes are queried 
directly
     // from the volume table (not through cache) since Recon does not use
     // Table cache.
+    Table<String, OmVolumeArgs>  volumeTable = getVolumeTable();
+
+    // If the table is not yet initialized, i.e. it is null
+    // Return empty list as response
+    if (volumeTable == null) {
+      return result;
+    }
+
     try (TableIterator<String, ? extends Table.KeyValue<String, OmVolumeArgs>>
-             iterator = getVolumeTable().iterator()) {
+                 iterator = volumeTable.iterator()) {
 
       while (iterator.hasNext() && result.size() < maxKeys) {
         Table.KeyValue<String, OmVolumeArgs> kv = iterator.next();
@@ -296,6 +304,11 @@ public class ReconOmMetadataManagerImpl extends 
OmMetadataManagerImpl
 
     int currentCount = 0;
     Table<String, OmBucketInfo> bucketTable = getBucketTable();
+    // If the table is not yet initialized, i.e. it is null
+    // Return empty list as response
+    if (bucketTable == null) {
+      return result;
+    }
 
     try (TableIterator<String, ? extends Table.KeyValue<String, OmBucketInfo>>
              iterator = bucketTable.iterator()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to