Adapt Shard Generation Assertion for 7.x (#63625) (#63642)

In 7.x we can have `null` generations so we need to adjust the `assert`
accordingly.
See e.g. failure https://gradle-enterprise.elastic.co/s/dgypleytdotfu/tests/:server:internalClusterTest/org.elasticsearch.snapshots.ConcurrentSnapshotsIT/testConcurrentSnapshotWorksWithOldVersionRepo
This commit is contained in:
Armin Braun 2020-10-14 06:57:25 +02:00 committed by GitHub
parent 7e8769a666
commit 424b313784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -102,9 +102,9 @@ public final class InFlightShardSnapshotStates {
}
private static boolean assertGenerationConsistency(Map<String, Map<Integer, String>> generations, String indexName,
int shardId, String activeGeneration) {
int shardId, @Nullable String activeGeneration) {
final String bestGeneration = generations.getOrDefault(indexName, Collections.emptyMap()).get(shardId);
assert bestGeneration == null || activeGeneration.equals(bestGeneration);
assert bestGeneration == null || activeGeneration == null || activeGeneration.equals(bestGeneration);
return true;
}