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

ArafatKhan2198 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 76b5c6947a2 HDDS-16882. Recon swallows the RocksDB open failure of a 
fetched OM DB snapshot, logs success and keeps using its deleted previous OM 
DB. (#11560)
76b5c6947a2 is described below

commit 76b5c6947a2cb6cf03891abbfe7d2175e4ccf51e
Author: Arafat2198 <[email protected]>
AuthorDate: Fri Oct 23 11:13:04 2026 +0530

    HDDS-16882. Recon swallows the RocksDB open failure of a fetched OM DB 
snapshot, logs success and keeps using its deleted previous OM DB. (#11560)
    
    Co-authored-by: Claude <[email protected]>
---
 .../recon/recovery/ReconOmMetadataManagerImpl.java |  54 ++++++---
 .../spi/impl/OzoneManagerServiceProviderImpl.java  |   5 +
 .../recovery/TestReconOmMetadataManagerImpl.java   |  91 +++++++++++++++
 .../impl/TestOzoneManagerServiceProviderImpl.java  | 126 +++++++++++++++++++++
 4 files changed, 263 insertions(+), 13 deletions(-)

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 d0f92d0485f..d9fbb42836d 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
@@ -33,6 +33,7 @@
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.apache.hadoop.hdds.utils.IOUtils;
 import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
 import org.apache.hadoop.hdds.utils.db.DBStore;
 import org.apache.hadoop.hdds.utils.db.DBStoreBuilder;
@@ -110,28 +111,50 @@ public void start(OzoneConfiguration configuration) 
throws IOException {
     if (lastKnownOMSnapshot != null) {
       LOG.info("Last known snapshot for OM : {}",
           lastKnownOMSnapshot.getAbsolutePath());
-      initializeNewRdbStore(lastKnownOMSnapshot, true);
+      DBStore store;
+      try {
+        store = openRdbStore(lastKnownOMSnapshot);
+      } catch (IOException ioEx) {
+        // Start without an OM DB, so that a new snapshot is fetched.
+        LOG.error("Unable to initialize Recon OM DB snapshot store.", ioEx);
+        return;
+      }
+      initializeNewRdbStore(store, true);
     }
   }
 
+  private DBStore openRdbStore(File dbFile) throws IOException {
+    DBStore store = DBStoreBuilder.newBuilder(ozoneConfiguration, 
OMDBDefinition.get(), dbFile).build();
+    LOG.info("Created OM DB handle from snapshot at {}.", 
dbFile.getAbsolutePath());
+    return store;
+  }
+
   /**
-   * Replace existing DB instance with new one.
+   * Replace existing DB instance with new one. If the OM tables cannot be 
initialized from the new DB, it is closed
+   * and the previous DB is restored, so that the store and all OM tables 
always point to the same DB.
    *
-   * @param dbFile          new DB file location.
+   * @param newStore        new DB instance.
    * @param addCacheMetrics
    */
-  private void initializeNewRdbStore(File dbFile, boolean addCacheMetrics) 
throws IOException {
+  private void initializeNewRdbStore(DBStore newStore, boolean 
addCacheMetrics) throws IOException {
+    DBStore previous = getStore();
+    setStore(newStore);
     try {
-      setStore(DBStoreBuilder.newBuilder(ozoneConfiguration, 
OMDBDefinition.get(), dbFile).build());
-      LOG.info("Created OM DB handle from snapshot at {}.",
-          dbFile.getAbsolutePath());
-    } catch (IOException ioEx) {
-      LOG.error("Unable to initialize Recon OM DB snapshot store.", ioEx);
-    }
-    if (getStore() != null) {
       initializeOmTables(TableCache.CacheType.FULL_CACHE, addCacheMetrics);
-      omTablesInitialized = true;
+    } catch (IOException | RuntimeException e) {
+      setStore(previous);
+      IOUtils.close(LOG, newStore);
+      if (previous != null) {
+        try {
+          initializeOmTables(TableCache.CacheType.FULL_CACHE, addCacheMetrics);
+        } catch (IOException | RuntimeException restoreEx) {
+          e.addSuppressed(restoreEx);
+          omTablesInitialized = false;
+        }
+      }
+      throw e;
     }
+    omTablesInitialized = true;
   }
 
   @Override
@@ -152,7 +175,12 @@ public void updateOmDB(File newDbLocation, boolean 
addCacheMetrics) throws IOExc
     }
     DBStore current = getStore();
     try {
-      initializeNewRdbStore(newDbLocation, addCacheMetrics);
+      initializeNewRdbStore(openRdbStore(newDbLocation), addCacheMetrics);
+    } catch (IOException | RuntimeException e) {
+      // The previous DB is kept. Do not leave a snapshot that failed to open 
behind as the last known OM DB.
+      LOG.warn("Deleting OM snapshot db at {} that could not be opened.", 
newDbLocation.getAbsolutePath());
+      FileUtils.deleteQuietly(newDbLocation);
+      throw e;
     } finally {
       // Always close DBStore if it's replaced.
       if (current != null && current != getStore()) {
diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
index c896e396cfc..28c1a3a5a0d 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/OzoneManagerServiceProviderImpl.java
@@ -732,6 +732,11 @@ public boolean syncDataFromOM() {
 
         if (currentSequenceNumber <= 0) {
           fullSnapshot = true;
+        } else if (!omMetadataManager.getStore().getDbLocation().exists()) {
+          // A failed full snapshot leaves Recon on its previous OM DB, whose 
directory was deleted before the fetch.
+          LOG.warn("Recon OM DB directory {} no longer exists, fetching a full 
snapshot.",
+              omMetadataManager.getStore().getDbLocation());
+          fullSnapshot = true;
         } else {
           // Get updates from OM and apply to local Recon OM DB and update 
task status in table
           deltaReconTaskStatusUpdater.recordRunStart();
diff --git 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
index 045faacc501..03a9a37c459 100644
--- 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
+++ 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
@@ -17,8 +17,11 @@
 
 package org.apache.hadoop.ozone.recon.recovery;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_DB_DIRS;
 import static 
org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_OM_SNAPSHOT_DB_DIR;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -33,8 +36,10 @@
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
 import org.apache.hadoop.hdds.utils.db.DBStore;
+import org.apache.hadoop.hdds.utils.db.cache.TableCache;
 import org.apache.hadoop.ozone.om.OMMetadataManager;
 import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
+import org.apache.hadoop.ozone.om.codec.OMDBDefinition;
 import org.apache.hadoop.ozone.om.helpers.BucketLayout;
 import org.apache.hadoop.ozone.om.helpers.OmBucketInfo;
 import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
@@ -146,6 +151,92 @@ public void testUpdateOmDB() throws Exception {
     assertTrue(current.isClosed());
   }
 
+  @Test
+  public void testUnreadableSnapshot() throws Exception {
+    OMMetadataManager omMetadataManager = getOMMetadataManager();
+    File reconOmDbDir = 
Files.createDirectory(temporaryFolder.resolve("reconOmDbDir")).toFile();
+    OzoneConfiguration configuration = new OzoneConfiguration();
+    configuration.set(OZONE_RECON_OM_SNAPSHOT_DB_DIR, 
reconOmDbDir.getAbsolutePath());
+
+    // A snapshot that RocksDB cannot open: CURRENT names a missing MANIFEST.
+    File unreadable = 
omMetadataManager.getStore().getCheckpoint(true).getCheckpointLocation().toFile();
+    FileUtils.writeStringToFile(new File(unreadable, "CURRENT"), 
"MANIFEST-999999\n", UTF_8);
+    FileUtils.copyDirectory(unreadable, new File(reconOmDbDir, 
"om.snapshot.db_" + System.currentTimeMillis()));
+
+    // At startup the unreadable last known snapshot is skipped.
+    ReconOMMetadataManager reconOMMetadataManager = new 
ReconOmMetadataManagerImpl(configuration, new ReconUtils());
+    reconOMMetadataManager.start(configuration);
+    assertThat(reconOMMetadataManager.getStore()).isNull();
+
+    // A refresh to an unreadable snapshot fails and keeps the active DB.
+    
reconOMMetadataManager.updateOmDB(omMetadataManager.getStore().getCheckpoint(true).getCheckpointLocation().toFile(),
+        true);
+    DBStore active = reconOMMetadataManager.getStore();
+    assertThatThrownBy(() -> reconOMMetadataManager.updateOmDB(unreadable, 
true)).isInstanceOf(IOException.class);
+    assertThat(unreadable).doesNotExist();
+    assertThat(reconOMMetadataManager.getStore()).isSameAs(active);
+    assertThat(active.isClosed()).isFalse();
+    
assertThat(reconOMMetadataManager.getVolumeTable().get("/sampleVol")).isNotNull();
+    reconOMMetadataManager.stop();
+    omMetadataManager.stop();
+  }
+
+  @Test
+  public void testSnapshotWithUnreadableTables() throws Exception {
+    OMMetadataManager omMetadataManager = getOMMetadataManager();
+    File reconOmDbDir = 
Files.createDirectory(temporaryFolder.resolve("reconOmDbDir")).toFile();
+    OzoneConfiguration configuration = new OzoneConfiguration();
+    configuration.set(OZONE_RECON_OM_SNAPSHOT_DB_DIR, 
reconOmDbDir.getAbsolutePath());
+    File readable = 
omMetadataManager.getStore().getCheckpoint(true).getCheckpointLocation().toFile();
+
+    // A snapshot that RocksDB opens, but whose OM tables cannot be 
initialized: a volume cannot be decoded.
+    omMetadataManager.getStore().getTable(OMDBDefinition.VOLUME_TABLE)
+        .put("/badVol".getBytes(UTF_8), "not a volume".getBytes(UTF_8));
+    File unreadableTables = 
omMetadataManager.getStore().getCheckpoint(true).getCheckpointLocation().toFile();
+    FileUtils.copyDirectory(unreadableTables, new File(reconOmDbDir, 
"om.snapshot.db_" + System.currentTimeMillis()));
+
+    // At startup the failure is still reported, and no OM DB is left in use.
+    ReconOMMetadataManager reconOMMetadataManager = new 
ReconOmMetadataManagerImpl(configuration, new ReconUtils());
+    assertThatThrownBy(() -> 
reconOMMetadataManager.start(configuration)).isInstanceOf(Exception.class);
+    assertThat(reconOMMetadataManager.getStore()).isNull();
+
+    // A refresh to it fails, and the active DB and all its tables are kept.
+    reconOMMetadataManager.updateOmDB(readable, true);
+    DBStore active = reconOMMetadataManager.getStore();
+    assertThatThrownBy(() -> 
reconOMMetadataManager.updateOmDB(unreadableTables, true))
+        .isInstanceOf(Exception.class);
+    assertThat(unreadableTables).doesNotExist();
+    assertThat(reconOMMetadataManager.getStore()).isSameAs(active);
+    assertThat(active.isClosed()).isFalse();
+    assertTrue(reconOMMetadataManager.isOmTablesInitialized());
+    
assertThat(reconOMMetadataManager.getVolumeTable().get("/sampleVol")).isNotNull();
+    
assertThat(reconOMMetadataManager.getKeyTable(getBucketLayout()).get("/sampleVol/bucketOne/key_one")).isNotNull();
+    reconOMMetadataManager.stop();
+    omMetadataManager.stop();
+  }
+
+  @Test
+  public void testStartReportsTableInitializationFailure() throws Exception {
+    OMMetadataManager omMetadataManager = getOMMetadataManager();
+    File reconOmDbDir = 
Files.createDirectory(temporaryFolder.resolve("reconOmDbDir")).toFile();
+    OzoneConfiguration configuration = new OzoneConfiguration();
+    configuration.set(OZONE_RECON_OM_SNAPSHOT_DB_DIR, 
reconOmDbDir.getAbsolutePath());
+    
FileUtils.copyDirectory(omMetadataManager.getStore().getCheckpoint(true).getCheckpointLocation().toFile(),
+        new File(reconOmDbDir, "om.snapshot.db_" + 
System.currentTimeMillis()));
+
+    ReconOMMetadataManager reconOMMetadataManager = new 
ReconOmMetadataManagerImpl(configuration, new ReconUtils()) {
+      @Override
+      protected void initializeOmTables(TableCache.CacheType cacheType, 
boolean addCacheMetrics) throws IOException {
+        throw new IOException("Mocked table initialization failure");
+      }
+    };
+
+    // Only a snapshot that cannot be opened is skipped at startup. A failure 
to initialize its tables is reported.
+    assertThatThrownBy(() -> 
reconOMMetadataManager.start(configuration)).isInstanceOf(IOException.class);
+    assertThat(reconOMMetadataManager.getStore()).isNull();
+    omMetadataManager.stop();
+  }
+
   /**
    * Get test OM metadata manager.
    * @return OMMetadataManager instance
diff --git 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestOzoneManagerServiceProviderImpl.java
 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestOzoneManagerServiceProviderImpl.java
index 26cf563ce56..625b150fd20 100644
--- 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestOzoneManagerServiceProviderImpl.java
+++ 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestOzoneManagerServiceProviderImpl.java
@@ -54,7 +54,9 @@
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import org.apache.commons.compress.archivers.ArchiveOutputStream;
 import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -213,6 +215,45 @@ public void testUpdateReconOmDBWithNewSnapshotFailure(
     reconTaskController.stop();
   }
 
+  @Test
+  public void testUpdateReconOmDBWithUnreadableSnapshot(
+      @TempDir File dirOmMetadata, @TempDir File dirReconMetadata) throws 
Exception {
+
+    OMMetadataManager omMetadataManager = 
initializeNewOmMetadataManager(dirOmMetadata);
+    ReconOMMetadataManager reconOMMetadataManager = 
getTestReconOmMetadataManager(omMetadataManager, dirReconMetadata);
+    RDBStore activeStore = (RDBStore) reconOMMetadataManager.getStore();
+
+    // A downloaded snapshot that RocksDB cannot open.
+    DBCheckpoint checkpoint = omMetadataManager.getStore().getCheckpoint(true);
+    
FileUtils.writeStringToFile(checkpoint.getCheckpointLocation().resolve("CURRENT").toFile(),
 "MANIFEST-999999\n",
+        UTF_8);
+    ReconUtils reconUtilsMock = getMockReconUtils();
+    when(reconUtilsMock.getReconNodeDetails(any(OzoneConfiguration.class)))
+        .thenReturn(ReconTestUtils.getReconNodeDetails());
+    ReconTaskController reconTaskController = getMockTaskController();
+
+    OzoneManagerServiceProviderImpl ozoneManagerServiceProvider =
+        new OzoneManagerServiceProviderImpl(configuration,
+            reconOMMetadataManager, reconTaskController, reconUtilsMock, 
ozoneManagerProtocol,
+            reconContext, getMockTaskStatusUpdaterManager());
+    ozoneManagerServiceProvider.setReconSnapshotProvider(
+        newStubSnapshotProvider(omSnapshotDbParentDir, 
checkpoint.getCheckpointLocation(), false));
+
+    assertFalse(ozoneManagerServiceProvider.updateReconOmDBWithNewSnapshot());
+
+    // The snapshot that failed to open is deleted.
+    String[] snapshots = omSnapshotDbParentDir.list((dir, name) -> 
name.startsWith(RECON_OM_SNAPSHOT_DB + "_"));
+    assertNotNull(snapshots);
+    assertEquals(0, snapshots.length, String.join(", ", snapshots));
+
+    // The active DB is kept.
+    assertEquals(activeStore, reconOMMetadataManager.getStore());
+    assertFalse(activeStore.isClosed());
+    assertNotNull(reconOMMetadataManager.getVolumeTable().get("/sampleVol"));
+    omMetadataManager.stop();
+    reconOMMetadataManager.stop();
+  }
+
   @Test
   public void testUpdateReconOmDBWithNewSnapshotSuccess(
       @TempDir File dirOmMetadata, @TempDir File dirReconMetadata) throws 
Exception {
@@ -606,6 +647,36 @@ public void testSyncDataFromOMDeltaUpdates(
     reconTaskControllerMock.stop();
   }
 
+  @Test
+  public void testSyncDataFromOMWithDeletedOMDbDir(
+      @TempDir File dirOmMetadata, @TempDir File dirReconMetadata) throws 
Exception {
+
+    OMMetadataManager omMetadataManager = 
initializeNewOmMetadataManager(dirOmMetadata);
+    ReconOMMetadataManager reconOMMetadataManager = 
getTestReconOmMetadataManager(omMetadataManager, dirReconMetadata);
+    DBStore previousStore = reconOMMetadataManager.getStore();
+    // A failed full snapshot leaves Recon on its previous OM DB, whose 
directory was deleted before the fetch.
+    FileUtils.deleteDirectory(previousStore.getDbLocation());
+
+    ReconUtils reconUtilsMock = getMockReconUtils();
+    when(reconUtilsMock.getReconNodeDetails(any(OzoneConfiguration.class)))
+        .thenReturn(ReconTestUtils.getReconNodeDetails());
+    OzoneManagerServiceProviderImpl ozoneManagerServiceProvider =
+        new OzoneManagerServiceProviderImpl(configuration, 
reconOMMetadataManager, getMockTaskController(),
+            reconUtilsMock, ozoneManagerProtocol, reconContext, 
getMockTaskStatusUpdaterManager());
+    
ozoneManagerServiceProvider.setReconSnapshotProvider(newStubSnapshotProvider(omSnapshotDbParentDir,
+        
omMetadataManager.getStore().getCheckpoint(true).getCheckpointLocation(), 
false));
+    OzoneManagerSyncMetrics metrics = ozoneManagerServiceProvider.getMetrics();
+
+    // Delta updates would succeed, but the sync must fetch a full snapshot 
instead.
+    ozoneManagerServiceProvider.syncDataFromOM();
+
+    assertEquals(1, metrics.getNumSnapshotRequests());
+    assertTrue(previousStore.isClosed());
+    assertTrue(reconOMMetadataManager.getStore().getDbLocation().exists());
+    omMetadataManager.stop();
+    reconOMMetadataManager.stop();
+  }
+
   @Test
   public void testSyncDataFromOMFullSnapshotForSNNFE(
       @TempDir File dirOmMetadata, @TempDir File dirReconMetadata)
@@ -642,6 +713,61 @@ public void testSyncDataFromOMFullSnapshotForSNNFE(
     reconTaskControllerMock.stop();
   }
 
+  @Test
+  public void testSyncDataFromOMWithUnreadableSnapshot(
+      @TempDir File dirOmMetadata, @TempDir File dirReconMetadata) throws 
Exception {
+
+    OMMetadataManager omMetadataManager = 
initializeNewOmMetadataManager(dirOmMetadata);
+    ReconOMMetadataManager reconOMMetadataManager = 
getTestReconOmMetadataManager(omMetadataManager, dirReconMetadata);
+    DBStore activeStore = reconOMMetadataManager.getStore();
+
+    // A downloaded snapshot that RocksDB cannot open: its largest SST is 
truncated.
+    DBCheckpoint checkpoint = omMetadataManager.getStore().getCheckpoint(true);
+    File[] sstFiles = 
checkpoint.getCheckpointLocation().toFile().listFiles((dir, name) -> 
name.endsWith(".sst"));
+    assertNotNull(sstFiles);
+    assertTrue(sstFiles.length > 0);
+    File largestSst = 
Arrays.stream(sstFiles).max(Comparator.comparingLong(File::length)).get();
+    try (RandomAccessFile raf = new RandomAccessFile(largestSst, "rw")) {
+      raf.setLength(largestSst.length() / 2);
+    }
+
+    ReconUtils reconUtilsMock = getMockReconUtils();
+    when(reconUtilsMock.getReconNodeDetails(any(OzoneConfiguration.class)))
+        .thenReturn(ReconTestUtils.getReconNodeDetails());
+    ReconTaskController reconTaskController = getMockTaskController();
+    // Delta updates are rejected, so the sync falls back to a full snapshot.
+    OzoneManagerProtocol protocol = getMockOzoneManagerClient(new DBUpdates());
+    
when(protocol.getDBUpdates(any(OzoneManagerProtocolProtos.DBUpdatesRequest.class)))
+        .thenThrow(new SequenceNumberNotFoundException());
+
+    OzoneManagerServiceProviderImpl ozoneManagerServiceProvider =
+        new OzoneManagerServiceProviderImpl(configuration, 
reconOMMetadataManager, reconTaskController,
+            reconUtilsMock, protocol, reconContext, 
getMockTaskStatusUpdaterManager());
+    ozoneManagerServiceProvider.setReconSnapshotProvider(
+        newStubSnapshotProvider(omSnapshotDbParentDir, 
checkpoint.getCheckpointLocation(), false));
+    OzoneManagerSyncMetrics metrics = ozoneManagerServiceProvider.getMetrics();
+
+    ozoneManagerServiceProvider.syncDataFromOM();
+
+    // The failed open is reported as a failed full snapshot.
+    assertEquals(1, metrics.getNumSnapshotRequests());
+    assertEquals(1, metrics.getNumSnapshotRequestsFailed());
+    assertFalse(reconContext.isHealthy().get());
+    
assertTrue(reconContext.getErrors().contains(ReconContext.ErrorCode.GET_OM_DB_SNAPSHOT_FAILED));
+
+    // The tasks are not reinitialized from a DB that was not installed.
+    verify(reconTaskController, never()).queueReInitializationEvent(any());
+
+    // The active DB is kept and the snapshot that failed to open is deleted.
+    assertEquals(activeStore, reconOMMetadataManager.getStore());
+    assertFalse(activeStore.isClosed());
+    String[] snapshots = omSnapshotDbParentDir.list((dir, name) -> 
name.startsWith(RECON_OM_SNAPSHOT_DB + "_"));
+    assertNotNull(snapshots);
+    assertEquals(0, snapshots.length, String.join(", ", snapshots));
+    omMetadataManager.stop();
+    reconOMMetadataManager.stop();
+  }
+
   private ReconTaskController getMockTaskController() {
     ReconTaskControllerImpl mockController = 
mock(ReconTaskControllerImpl.class);
     // Mock the new methods added to ReconTaskController interface


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

Reply via email to