Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

@ESIntegTestCase.ClusterScope(supportsDedicatedMasters = false, numClientNodes = 0)
Expand Down Expand Up @@ -246,18 +247,18 @@ protected void assertShardFolders(String indexName, boolean snapshotDirectory) t
translogExists
);
assertThat(
snapshotDirectory ? "Snapshot directory doesn't exist" : "Snapshot directory shouldn't exist",
snapshotDirectory,
not(indexExists)
snapshotDirectory ? "Index file should not exist" : "Index file should exist",
indexExists,
not(snapshotDirectory)
);
assertTrue("Translog doesn't exist", translogExists);
assertThat("Translog should exist", translogExists, is(true));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Above rewords assertions messages to remove negation

try (Stream<Path> dir = Files.list(shardPath.resolveTranslog())) {
final long translogFiles = dir.filter(path -> path.getFileName().toString().contains("translog")).count();
if (snapshotDirectory) {
assertEquals("There should be 2 translog files for a snapshot directory", 2L, translogFiles);
assertThat("There should be 2 translog files for a snapshot directory", translogFiles, equalTo(2L));
} else {
assertThat(
"There should be 2+ translog files non a non-snapshot directory",
"There should be 2+ translog files for a non-snapshot directory",
translogFiles,
greaterThanOrEqualTo(2L)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
import java.util.Map;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

Expand Down Expand Up @@ -254,7 +255,7 @@ public void testCreateAndRestoreSearchableSnapshot() throws Exception {
assertSearchableSnapshotStats(restoredIndexName, cacheEnabled, nonCachedExtensions);

ensureGreen(restoredIndexName);
assertBusy(() -> assertShardFolders(restoredIndexName, true));
assertBusy(() -> assertShardFolders(restoredIndexName, true), 30, TimeUnit.SECONDS);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is consistent with another change: #84942

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this reproduces only if we close the index (eg index files are kept on the disk) and we reuse the same index name for the mounted index. This is likely resulting in files not cleaned in time.


assertThat(
client().admin()
Expand Down