Skip to content

Commit eb54369

Browse files
Adapt Shard Generation Assertion for 7.x (#63625) (#63765)
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
1 parent 9b8826c commit eb54369

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

server/src/main/java/org/elasticsearch/snapshots/InFlightShardSnapshotStates.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ private InFlightShardSnapshotStates(Map<String, Map<Integer, String>> generation
102102
}
103103

104104
private static boolean assertGenerationConsistency(Map<String, Map<Integer, String>> generations, String indexName,
105-
int shardId, String activeGeneration) {
105+
int shardId, @Nullable String activeGeneration) {
106106
final String bestGeneration = generations.getOrDefault(indexName, Collections.emptyMap()).get(shardId);
107-
assert bestGeneration == null || activeGeneration.equals(bestGeneration);
107+
assert bestGeneration == null || activeGeneration == null || activeGeneration.equals(bestGeneration);
108108
return true;
109109
}
110110

0 commit comments

Comments
 (0)