@@ -265,6 +265,9 @@ public static class SnapshotRecoverySource extends RecoverySource {
265
265
private final boolean isSearchableSnapshot ;
266
266
private final boolean remoteStoreIndexShallowCopy ;
267
267
private final String sourceRemoteStoreRepository ;
268
+ private final String sourceRemoteTranslogRepository ;
269
+
270
+ private final long pinnedTimestamp ;
268
271
269
272
public SnapshotRecoverySource (String restoreUUID , Snapshot snapshot , Version version , IndexId indexId ) {
270
273
this (restoreUUID , snapshot , version , indexId , false , false , null );
@@ -278,6 +281,30 @@ public SnapshotRecoverySource(
278
281
boolean isSearchableSnapshot ,
279
282
boolean remoteStoreIndexShallowCopy ,
280
283
@ Nullable String sourceRemoteStoreRepository
284
+ ) {
285
+ this (
286
+ restoreUUID ,
287
+ snapshot ,
288
+ version ,
289
+ indexId ,
290
+ isSearchableSnapshot ,
291
+ remoteStoreIndexShallowCopy ,
292
+ sourceRemoteStoreRepository ,
293
+ null ,
294
+ 0L
295
+ );
296
+ }
297
+
298
+ public SnapshotRecoverySource (
299
+ String restoreUUID ,
300
+ Snapshot snapshot ,
301
+ Version version ,
302
+ IndexId indexId ,
303
+ boolean isSearchableSnapshot ,
304
+ boolean remoteStoreIndexShallowCopy ,
305
+ @ Nullable String sourceRemoteStoreRepository ,
306
+ @ Nullable String sourceRemoteTranslogRepository ,
307
+ long pinnedTimestamp
281
308
) {
282
309
this .restoreUUID = restoreUUID ;
283
310
this .snapshot = Objects .requireNonNull (snapshot );
@@ -286,6 +313,8 @@ public SnapshotRecoverySource(
286
313
this .isSearchableSnapshot = isSearchableSnapshot ;
287
314
this .remoteStoreIndexShallowCopy = remoteStoreIndexShallowCopy ;
288
315
this .sourceRemoteStoreRepository = sourceRemoteStoreRepository ;
316
+ this .sourceRemoteTranslogRepository = sourceRemoteTranslogRepository ;
317
+ this .pinnedTimestamp = pinnedTimestamp ;
289
318
}
290
319
291
320
SnapshotRecoverySource (StreamInput in ) throws IOException {
@@ -309,6 +338,13 @@ public SnapshotRecoverySource(
309
338
remoteStoreIndexShallowCopy = false ;
310
339
sourceRemoteStoreRepository = null ;
311
340
}
341
+ if (in .getVersion ().onOrAfter (Version .V_2_17_0 )) {
342
+ sourceRemoteTranslogRepository = in .readOptionalString ();
343
+ pinnedTimestamp = in .readLong ();
344
+ } else {
345
+ sourceRemoteTranslogRepository = null ;
346
+ pinnedTimestamp = 0L ;
347
+ }
312
348
}
313
349
314
350
public String restoreUUID () {
@@ -341,10 +377,18 @@ public String sourceRemoteStoreRepository() {
341
377
return sourceRemoteStoreRepository ;
342
378
}
343
379
380
+ public String sourceRemoteTranslogRepository () {
381
+ return sourceRemoteTranslogRepository ;
382
+ }
383
+
344
384
public boolean remoteStoreIndexShallowCopy () {
345
385
return remoteStoreIndexShallowCopy ;
346
386
}
347
387
388
+ public long pinnedTimestamp () {
389
+ return pinnedTimestamp ;
390
+ }
391
+
348
392
@ Override
349
393
protected void writeAdditionalFields (StreamOutput out ) throws IOException {
350
394
out .writeString (restoreUUID );
@@ -362,6 +406,10 @@ protected void writeAdditionalFields(StreamOutput out) throws IOException {
362
406
out .writeBoolean (remoteStoreIndexShallowCopy );
363
407
out .writeOptionalString (sourceRemoteStoreRepository );
364
408
}
409
+ if (out .getVersion ().onOrAfter (Version .V_2_17_0 )) {
410
+ out .writeOptionalString (sourceRemoteTranslogRepository );
411
+ out .writeLong (pinnedTimestamp );
412
+ }
365
413
}
366
414
367
415
@ Override
@@ -378,7 +426,8 @@ public void addAdditionalFields(XContentBuilder builder, ToXContent.Params param
378
426
.field ("restoreUUID" , restoreUUID )
379
427
.field ("isSearchableSnapshot" , isSearchableSnapshot )
380
428
.field ("remoteStoreIndexShallowCopy" , remoteStoreIndexShallowCopy )
381
- .field ("sourceRemoteStoreRepository" , sourceRemoteStoreRepository );
429
+ .field ("sourceRemoteStoreRepository" , sourceRemoteStoreRepository )
430
+ .field ("sourceRemoteTranslogRepository" , sourceRemoteTranslogRepository );
382
431
}
383
432
384
433
@ Override
@@ -403,8 +452,11 @@ public boolean equals(Object o) {
403
452
&& isSearchableSnapshot == that .isSearchableSnapshot
404
453
&& remoteStoreIndexShallowCopy == that .remoteStoreIndexShallowCopy
405
454
&& sourceRemoteStoreRepository != null
406
- ? sourceRemoteStoreRepository .equals (that .sourceRemoteStoreRepository )
407
- : that .sourceRemoteStoreRepository == null ;
455
+ ? sourceRemoteStoreRepository .equals (that .sourceRemoteStoreRepository )
456
+ : that .sourceRemoteStoreRepository == null && sourceRemoteTranslogRepository != null
457
+ ? sourceRemoteTranslogRepository .equals (that .sourceRemoteTranslogRepository )
458
+ : that .sourceRemoteTranslogRepository == null && pinnedTimestamp == that .pinnedTimestamp ;
459
+
408
460
}
409
461
410
462
@ Override
@@ -416,10 +468,11 @@ public int hashCode() {
416
468
version ,
417
469
isSearchableSnapshot ,
418
470
remoteStoreIndexShallowCopy ,
419
- sourceRemoteStoreRepository
471
+ sourceRemoteStoreRepository ,
472
+ sourceRemoteTranslogRepository ,
473
+ pinnedTimestamp
420
474
);
421
475
}
422
-
423
476
}
424
477
425
478
/**
0 commit comments