@@ -134,6 +134,38 @@ public static Entry startedEntry(
134
134
);
135
135
}
136
136
137
+ public static Entry startedEntry (
138
+ Snapshot snapshot ,
139
+ boolean includeGlobalState ,
140
+ boolean partial ,
141
+ List <IndexId > indices ,
142
+ List <String > dataStreams ,
143
+ long startTime ,
144
+ long repositoryStateId ,
145
+ final Map <ShardId , ShardSnapshotStatus > shards ,
146
+ Map <String , Object > userMetadata ,
147
+ Version version ,
148
+ boolean remoteStoreIndexShallowCopy ,
149
+ boolean remoteStoreIndexShallowCopyV2
150
+ ) {
151
+ return new SnapshotsInProgress .Entry (
152
+ snapshot ,
153
+ includeGlobalState ,
154
+ partial ,
155
+ completed (shards .values ()) ? State .SUCCESS : State .STARTED ,
156
+ indices ,
157
+ dataStreams ,
158
+ startTime ,
159
+ repositoryStateId ,
160
+ shards ,
161
+ null ,
162
+ userMetadata ,
163
+ version ,
164
+ remoteStoreIndexShallowCopy ,
165
+ remoteStoreIndexShallowCopyV2
166
+ );
167
+ }
168
+
137
169
/**
138
170
* Creates the initial snapshot clone entry
139
171
*
@@ -168,11 +200,42 @@ public static Entry startClone(
168
200
version ,
169
201
source ,
170
202
Map .of (),
171
- false // initialising to false, will be updated in startCloning method of SnapshotsService while updating entry with
203
+ false ,
204
+ false // initialising to false, will be updated in startCloning method of SnapshotsService while updating entry with
172
205
// clone jobs
173
206
);
174
207
}
175
208
209
+ public static Entry startClone (
210
+ Snapshot snapshot ,
211
+ SnapshotId source ,
212
+ List <IndexId > indices ,
213
+ long startTime ,
214
+ long repositoryStateId ,
215
+ Version version ,
216
+ boolean remoteStoreIndexShallowCopyV2
217
+ ) {
218
+ return new SnapshotsInProgress .Entry (
219
+ snapshot ,
220
+ true ,
221
+ false ,
222
+ State .STARTED ,
223
+ indices ,
224
+ Collections .emptyList (),
225
+ startTime ,
226
+ repositoryStateId ,
227
+ Map .of (),
228
+ null ,
229
+ Collections .emptyMap (),
230
+ version ,
231
+ source ,
232
+ Map .of (),
233
+ remoteStoreIndexShallowCopyV2 ,
234
+ remoteStoreIndexShallowCopyV2 // initialising to false, will be updated in startCloning method of SnapshotsService while updating entry with
235
+ // clone jobs
236
+ );
237
+ }
238
+
176
239
/**
177
240
* Entry in the collection.
178
241
*
@@ -183,6 +246,8 @@ public static class Entry implements Writeable, ToXContent, RepositoryOperation
183
246
private final Snapshot snapshot ;
184
247
private final boolean includeGlobalState ;
185
248
private final boolean remoteStoreIndexShallowCopy ;
249
+
250
+ private final boolean remoteStoreIndexShallowCopyV2 ;
186
251
private final boolean partial ;
187
252
/**
188
253
* Map of {@link ShardId} to {@link ShardSnapshotStatus} tracking the state of each shard snapshot operation.
@@ -212,6 +277,42 @@ public static class Entry implements Writeable, ToXContent, RepositoryOperation
212
277
@ Nullable
213
278
private final String failure ;
214
279
280
+ public Entry (
281
+ Snapshot snapshot ,
282
+ boolean includeGlobalState ,
283
+ boolean partial ,
284
+ State state ,
285
+ List <IndexId > indices ,
286
+ List <String > dataStreams ,
287
+ long startTime ,
288
+ long repositoryStateId ,
289
+ final Map <ShardId , ShardSnapshotStatus > shards ,
290
+ String failure ,
291
+ Map <String , Object > userMetadata ,
292
+ Version version ,
293
+ boolean remoteStoreIndexShallowCopy ,
294
+ boolean remoteStoreIndexShallowCopyV2
295
+ ) {
296
+ this (
297
+ snapshot ,
298
+ includeGlobalState ,
299
+ partial ,
300
+ state ,
301
+ indices ,
302
+ dataStreams ,
303
+ startTime ,
304
+ repositoryStateId ,
305
+ shards ,
306
+ failure ,
307
+ userMetadata ,
308
+ version ,
309
+ null ,
310
+ Map .of (),
311
+ remoteStoreIndexShallowCopy ,
312
+ remoteStoreIndexShallowCopyV2
313
+ );
314
+ }
315
+
215
316
// visible for testing, use #startedEntry and copy constructors in production code
216
317
public Entry (
217
318
Snapshot snapshot ,
@@ -243,11 +344,12 @@ public Entry(
243
344
version ,
244
345
null ,
245
346
Map .of (),
246
- remoteStoreIndexShallowCopy
347
+ remoteStoreIndexShallowCopy ,
348
+ false
247
349
);
248
350
}
249
351
250
- private Entry (
352
+ public Entry (
251
353
Snapshot snapshot ,
252
354
boolean includeGlobalState ,
253
355
boolean partial ,
@@ -262,7 +364,8 @@ private Entry(
262
364
Version version ,
263
365
@ Nullable SnapshotId source ,
264
366
@ Nullable final Map <RepositoryShardId , ShardSnapshotStatus > clones ,
265
- boolean remoteStoreIndexShallowCopy
367
+ boolean remoteStoreIndexShallowCopy ,
368
+ boolean remoteStoreIndexShallowCopyV2
266
369
) {
267
370
this .state = state ;
268
371
this .snapshot = snapshot ;
@@ -284,7 +387,8 @@ private Entry(
284
387
this .clones = Collections .unmodifiableMap (clones );
285
388
}
286
389
this .remoteStoreIndexShallowCopy = remoteStoreIndexShallowCopy ;
287
- assert assertShardsConsistent (this .source , this .state , this .indices , this .shards , this .clones );
390
+ this .remoteStoreIndexShallowCopyV2 = remoteStoreIndexShallowCopyV2 ;
391
+ assert this .remoteStoreIndexShallowCopyV2 || assertShardsConsistent (this .source , this .state , this .indices , this .shards , this .clones );
288
392
}
289
393
290
394
private Entry (StreamInput in ) throws IOException {
@@ -307,6 +411,11 @@ private Entry(StreamInput in) throws IOException {
307
411
} else {
308
412
remoteStoreIndexShallowCopy = false ;
309
413
}
414
+ if (in .getVersion ().onOrAfter (Version .CURRENT )) {
415
+ remoteStoreIndexShallowCopyV2 = in .readBoolean ();
416
+ } else {
417
+ remoteStoreIndexShallowCopyV2 = false ;
418
+ }
310
419
}
311
420
312
421
private static boolean assertShardsConsistent (
@@ -428,7 +537,8 @@ public Entry withRepoGen(long newRepoGen) {
428
537
version ,
429
538
source ,
430
539
clones ,
431
- remoteStoreIndexShallowCopy
540
+ remoteStoreIndexShallowCopy ,
541
+ remoteStoreIndexShallowCopyV2
432
542
);
433
543
}
434
544
@@ -451,7 +561,8 @@ public Entry withClones(final Map<RepositoryShardId, ShardSnapshotStatus> update
451
561
version ,
452
562
source ,
453
563
updatedClones ,
454
- remoteStoreIndexShallowCopy
564
+ remoteStoreIndexShallowCopy ,
565
+ remoteStoreIndexShallowCopyV2
455
566
);
456
567
}
457
568
@@ -471,7 +582,8 @@ public Entry withRemoteStoreIndexShallowCopy(final boolean remoteStoreIndexShall
471
582
version ,
472
583
source ,
473
584
clones ,
474
- remoteStoreIndexShallowCopy
585
+ remoteStoreIndexShallowCopy ,
586
+ remoteStoreIndexShallowCopyV2
475
587
);
476
588
}
477
589
@@ -527,7 +639,8 @@ public Entry fail(final Map<ShardId, ShardSnapshotStatus> shards, State state, S
527
639
version ,
528
640
source ,
529
641
clones ,
530
- remoteStoreIndexShallowCopy
642
+ remoteStoreIndexShallowCopy ,
643
+ remoteStoreIndexShallowCopyV2
531
644
);
532
645
}
533
646
@@ -614,6 +727,10 @@ public boolean remoteStoreIndexShallowCopy() {
614
727
return remoteStoreIndexShallowCopy ;
615
728
}
616
729
730
+ public boolean remoteStoreIndexShallowCopyV2 () {
731
+ return remoteStoreIndexShallowCopyV2 ;
732
+ }
733
+
617
734
public Map <String , Object > userMetadata () {
618
735
return userMetadata ;
619
736
}
@@ -678,6 +795,7 @@ public boolean equals(Object o) {
678
795
if (Objects .equals (source , ((Entry ) o ).source ) == false ) return false ;
679
796
if (clones .equals (((Entry ) o ).clones ) == false ) return false ;
680
797
if (remoteStoreIndexShallowCopy != entry .remoteStoreIndexShallowCopy ) return false ;
798
+ if (remoteStoreIndexShallowCopyV2 != entry .remoteStoreIndexShallowCopyV2 ) return false ;
681
799
return true ;
682
800
}
683
801
@@ -695,6 +813,7 @@ public int hashCode() {
695
813
result = 31 * result + (source == null ? 0 : source .hashCode ());
696
814
result = 31 * result + clones .hashCode ();
697
815
result = 31 * result + (remoteStoreIndexShallowCopy ? 1 : 0 );
816
+ result = 31 * result + (remoteStoreIndexShallowCopyV2 ? 1 : 0 );
698
817
return result ;
699
818
}
700
819
@@ -766,6 +885,9 @@ public void writeTo(StreamOutput out) throws IOException {
766
885
if (out .getVersion ().onOrAfter (Version .V_2_9_0 )) {
767
886
out .writeBoolean (remoteStoreIndexShallowCopy );
768
887
}
888
+ if (out .getVersion ().onOrAfter (Version .CURRENT )) {
889
+ out .writeBoolean (remoteStoreIndexShallowCopyV2 );
890
+ }
769
891
}
770
892
771
893
@ Override
0 commit comments