File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.restore
server/src/main/java/org/elasticsearch/snapshots Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,6 @@ setup:
2424---
2525" Create a snapshot and then restore it " :
2626
27- - skip :
28- version : " all"
29- reason : " AwaitsFix https://github.com/elastic/elasticsearch/issues/64152"
30-
3127 - do :
3228 snapshot.create :
3329 repository : test_repo_restore_1
Original file line number Diff line number Diff line change @@ -386,10 +386,17 @@ public ClusterState execute(ClusterState currentState) {
386386 aliases .add (alias .value );
387387 }
388388 }
389- indexMdBuilder .settings (Settings .builder ()
390- .put (snapshotIndexMetadata .getSettings ())
391- .put (IndexMetadata .SETTING_INDEX_UUID , currentIndexMetadata .getIndexUUID ())
392- .put (IndexMetadata .SETTING_HISTORY_UUID , UUIDs .randomBase64UUID ()));
389+ final Settings .Builder indexSettingsBuilder = Settings .builder ()
390+ .put (snapshotIndexMetadata .getSettings ())
391+ .put (IndexMetadata .SETTING_INDEX_UUID , currentIndexMetadata .getIndexUUID ());
392+ // Only add a restore uuid if either all nodes in the cluster support it (version >= 7.9) or if the
393+ // index itself was created after 7.9 and thus won't be restored to a node that doesn't support the
394+ // setting anyway
395+ if (snapshotIndexMetadata .getCreationVersion ().onOrAfter (Version .V_7_9_0 ) ||
396+ currentState .nodes ().getMinNodeVersion ().onOrAfter (Version .V_7_9_0 )) {
397+ indexSettingsBuilder .put (SETTING_HISTORY_UUID , UUIDs .randomBase64UUID ());
398+ }
399+ indexMdBuilder .settings (indexSettingsBuilder );
393400 IndexMetadata updatedIndexMetadata = indexMdBuilder .index (renamedIndexName ).build ();
394401 rtBuilder .addAsRestore (updatedIndexMetadata , recoverySource );
395402 blocks .updateBlocks (updatedIndexMetadata );
You can’t perform that action at this time.
0 commit comments