Skip to content

Commit

Permalink
Merge branch '8.x' into backport/8.x/pr-116056
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Nov 1, 2024
2 parents d42b4d7 + 11e0d46 commit 9ad5b1b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,12 @@ public void cleanupAndVerify(String reason, MetadataSnapshot sourceMetadata) thr
}
}
directory.syncMetaData();
final Store.MetadataSnapshot metadataOrEmpty = getMetadata(null);
Store.MetadataSnapshot metadataOrEmpty;
try {
metadataOrEmpty = getMetadata(null);
} catch (IndexNotFoundException e) {
metadataOrEmpty = MetadataSnapshot.EMPTY;
}
verifyAfterCleanup(sourceMetadata, metadataOrEmpty);
} finally {
metadataLock.writeLock().unlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,15 @@ public void testCleanupFromSnapshot() throws IOException {
IOUtils.close(store);
}

public void testCleanupEmptyStore() throws IOException {
final ShardId shardId = new ShardId("index", "_na_", 1);
Store store = new Store(shardId, INDEX_SETTINGS, StoreTests.newDirectory(random()), new DummyShardLock(shardId));

store.cleanupAndVerify("test", Store.MetadataSnapshot.EMPTY);

IOUtils.close(store);
}

public void testOnCloseCallback() throws IOException {
final ShardId shardId = new ShardId(
new Index(randomRealisticUnicodeOfCodepointLengthBetween(1, 10), "_na_"),
Expand Down

0 comments on commit 9ad5b1b

Please sign in to comment.