@@ -459,7 +459,7 @@ public void deleteSnapshot(SnapshotId snapshotId, long repositoryStateId) {
459459 if (indexMetaData != null ) {
460460 for (int shardId = 0 ; shardId < indexMetaData .getNumberOfShards (); shardId ++) {
461461 try {
462- delete (snapshotId , snapshot . version (), indexId , new ShardId (indexMetaData .getIndex (), shardId ));
462+ delete (snapshotId , indexId , new ShardId (indexMetaData .getIndex (), shardId ));
463463 } catch (SnapshotException ex ) {
464464 final int finalShardId = shardId ;
465465 logger .warn (() -> new ParameterizedMessage ("[{}] failed to delete shard data for shard [{}][{}]" ,
@@ -865,7 +865,7 @@ public void snapshotShard(IndexShard shard, Store store, SnapshotId snapshotId,
865865
866866 @ Override
867867 public void restoreShard (IndexShard shard , SnapshotId snapshotId , Version version , IndexId indexId , ShardId snapshotShardId , RecoveryState recoveryState ) {
868- final RestoreContext snapshotContext = new RestoreContext (shard , snapshotId , version , indexId , snapshotShardId , recoveryState );
868+ final RestoreContext snapshotContext = new RestoreContext (shard , snapshotId , indexId , snapshotShardId , recoveryState );
869869 try {
870870 snapshotContext .restore ();
871871 } catch (Exception e ) {
@@ -875,7 +875,7 @@ public void restoreShard(IndexShard shard, SnapshotId snapshotId, Version versio
875875
876876 @ Override
877877 public IndexShardSnapshotStatus getShardSnapshotStatus (SnapshotId snapshotId , Version version , IndexId indexId , ShardId shardId ) {
878- Context context = new Context (snapshotId , version , indexId , shardId );
878+ Context context = new Context (snapshotId , indexId , shardId );
879879 BlobStoreIndexShardSnapshot snapshot = context .loadSnapshot ();
880880 return IndexShardSnapshotStatus .newDone (snapshot .startTime (), snapshot .time (),
881881 snapshot .incrementalFileCount (), snapshot .totalFileCount (),
@@ -917,8 +917,8 @@ public void verify(String seed, DiscoveryNode localNode) {
917917 * @param snapshotId snapshot id
918918 * @param shardId shard id
919919 */
920- private void delete (SnapshotId snapshotId , Version version , IndexId indexId , ShardId shardId ) {
921- Context context = new Context (snapshotId , version , indexId , shardId , shardId );
920+ private void delete (SnapshotId snapshotId , IndexId indexId , ShardId shardId ) {
921+ Context context = new Context (snapshotId , indexId , shardId , shardId );
922922 context .delete ();
923923 }
924924
@@ -930,10 +930,6 @@ public String toString() {
930930 ']' ;
931931 }
932932
933- BlobStoreFormat <BlobStoreIndexShardSnapshot > indexShardSnapshotFormat (Version version ) {
934- return indexShardSnapshotFormat ;
935- }
936-
937933 /**
938934 * Context for snapshot/restore operations
939935 */
@@ -945,15 +941,12 @@ private class Context {
945941
946942 protected final BlobContainer blobContainer ;
947943
948- protected final Version version ;
949-
950- Context (SnapshotId snapshotId , Version version , IndexId indexId , ShardId shardId ) {
951- this (snapshotId , version , indexId , shardId , shardId );
944+ Context (SnapshotId snapshotId , IndexId indexId , ShardId shardId ) {
945+ this (snapshotId , indexId , shardId , shardId );
952946 }
953947
954- Context (SnapshotId snapshotId , Version version , IndexId indexId , ShardId shardId , ShardId snapshotShardId ) {
948+ Context (SnapshotId snapshotId , IndexId indexId , ShardId shardId , ShardId snapshotShardId ) {
955949 this .snapshotId = snapshotId ;
956- this .version = version ;
957950 this .shardId = shardId ;
958951 blobContainer = blobStore ().blobContainer (basePath ().add ("indices" ).add (indexId .getId ()).add (Integer .toString (snapshotShardId .getId ())));
959952 }
@@ -974,7 +967,7 @@ public void delete() {
974967 int fileListGeneration = tuple .v2 ();
975968
976969 try {
977- indexShardSnapshotFormat ( version ) .delete (blobContainer , snapshotId .getUUID ());
970+ indexShardSnapshotFormat .delete (blobContainer , snapshotId .getUUID ());
978971 } catch (IOException e ) {
979972 logger .debug ("[{}] [{}] failed to delete shard snapshot file" , shardId , snapshotId );
980973 }
@@ -995,7 +988,7 @@ public void delete() {
995988 */
996989 BlobStoreIndexShardSnapshot loadSnapshot () {
997990 try {
998- return indexShardSnapshotFormat ( version ) .read (blobContainer , snapshotId .getUUID ());
991+ return indexShardSnapshotFormat .read (blobContainer , snapshotId .getUUID ());
999992 } catch (IOException ex ) {
1000993 throw new SnapshotException (metadata .name (), snapshotId , "failed to read shard snapshot file for " + shardId , ex );
1001994 }
@@ -1176,7 +1169,7 @@ private class SnapshotContext extends Context {
11761169 * @param snapshotStatus snapshot status to report progress
11771170 */
11781171 SnapshotContext (Store store , SnapshotId snapshotId , IndexId indexId , IndexShardSnapshotStatus snapshotStatus , long startTime ) {
1179- super (snapshotId , Version . CURRENT , indexId , store .shardId ());
1172+ super (snapshotId , indexId , store .shardId ());
11801173 this .snapshotStatus = snapshotStatus ;
11811174 this .store = store ;
11821175 this .startTime = startTime ;
@@ -1316,7 +1309,6 @@ public void snapshot(final IndexCommit snapshotIndexCommit) {
13161309 // finalize the snapshot and rewrite the snapshot index with the next sequential snapshot index
13171310 finalize (newSnapshotsList , fileListGeneration + 1 , blobs , "snapshot creation [" + snapshotId + "]" );
13181311 snapshotStatus .moveToDone (System .currentTimeMillis ());
1319-
13201312 }
13211313
13221314 /**
@@ -1479,8 +1471,8 @@ private class RestoreContext extends Context {
14791471 * @param snapshotShardId shard in the snapshot that data should be restored from
14801472 * @param recoveryState recovery state to report progress
14811473 */
1482- RestoreContext (IndexShard shard , SnapshotId snapshotId , Version version , IndexId indexId , ShardId snapshotShardId , RecoveryState recoveryState ) {
1483- super (snapshotId , version , indexId , shard .shardId (), snapshotShardId );
1474+ RestoreContext (IndexShard shard , SnapshotId snapshotId , IndexId indexId , ShardId snapshotShardId , RecoveryState recoveryState ) {
1475+ super (snapshotId , indexId , shard .shardId (), snapshotShardId );
14841476 this .recoveryState = recoveryState ;
14851477 this .targetShard = shard ;
14861478 }
0 commit comments