Fix SearchableSnapshotsIntegTests.testCreateAndRestoreSearchableSnapshot (#65343) (#65351)

The recovery stats assertions in this test ran without any waiting for
the recoveries to actually finish. The fact that they ran after the concurrent
searches checks generally meant that they would pass (because of searches warming caches
+ general relative slowness of searches) but there is no hard guarantees this will work
reliably as the pre-fetch threads which will update the recovery state might still be slow
to do so randomly, causing the assertions to trip.

closes #65302
This commit is contained in:
Armin Braun 2020-11-23 12:30:18 +01:00 committed by GitHub
parent b0cea04f95
commit 7fbdcb5e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 22 deletions

View File

@ -64,6 +64,7 @@ import java.util.Set;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
@ -700,8 +701,9 @@ public class SearchableSnapshotsIntegTests extends BaseSearchableSnapshotsIntegT
}
}
private void assertRecoveryStats(String indexName, boolean preWarmEnabled) {
private void assertRecoveryStats(String indexName, boolean preWarmEnabled) throws Exception {
int shardCount = getNumShards(indexName).totalNumShards;
assertBusy(() -> {
final RecoveryResponse recoveryResponse = client().admin().indices().prepareRecoveries(indexName).get();
assertThat(recoveryResponse.toString(), recoveryResponse.shardRecoveryStates().get(indexName).size(), equalTo(shardCount));
@ -726,6 +728,7 @@ public class SearchableSnapshotsIntegTests extends BaseSearchableSnapshotsIntegT
);
}
}
}, 30L, TimeUnit.SECONDS);
}
private void assertSearchableSnapshotStats(String indexName, boolean cacheEnabled, List<String> nonCachedExtensions) {