24
24
import com .carrotsearch .hppc .cursors .ObjectObjectCursor ;
25
25
import org .elasticsearch .Version ;
26
26
import org .elasticsearch .cluster .ClusterState .Custom ;
27
+ import org .elasticsearch .common .Nullable ;
27
28
import org .elasticsearch .common .collect .ImmutableOpenMap ;
28
29
import org .elasticsearch .common .io .stream .StreamInput ;
29
30
import org .elasticsearch .common .io .stream .StreamOutput ;
@@ -93,9 +94,11 @@ public static class Entry {
93
94
private final ImmutableOpenMap <String , List <ShardId >> waitingIndices ;
94
95
private final long startTime ;
95
96
private final long repositoryStateId ;
97
+ @ Nullable private final String failure ;
96
98
97
99
public Entry (Snapshot snapshot , boolean includeGlobalState , boolean partial , State state , List <IndexId > indices ,
98
- long startTime , long repositoryStateId , ImmutableOpenMap <ShardId , ShardSnapshotStatus > shards ) {
100
+ long startTime , long repositoryStateId , ImmutableOpenMap <ShardId , ShardSnapshotStatus > shards ,
101
+ String failure ) {
99
102
this .state = state ;
100
103
this .snapshot = snapshot ;
101
104
this .includeGlobalState = includeGlobalState ;
@@ -110,15 +113,26 @@ public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, Sta
110
113
this .waitingIndices = findWaitingIndices (shards );
111
114
}
112
115
this .repositoryStateId = repositoryStateId ;
116
+ this .failure = failure ;
117
+ }
118
+
119
+ public Entry (Snapshot snapshot , boolean includeGlobalState , boolean partial , State state , List <IndexId > indices ,
120
+ long startTime , long repositoryStateId , ImmutableOpenMap <ShardId , ShardSnapshotStatus > shards ) {
121
+ this (snapshot , includeGlobalState , partial , state , indices , startTime , repositoryStateId , shards , null );
113
122
}
114
123
115
124
public Entry (Entry entry , State state , ImmutableOpenMap <ShardId , ShardSnapshotStatus > shards ) {
116
125
this (entry .snapshot , entry .includeGlobalState , entry .partial , state , entry .indices , entry .startTime ,
117
- entry .repositoryStateId , shards );
126
+ entry .repositoryStateId , shards , entry .failure );
127
+ }
128
+
129
+ public Entry (Entry entry , State state , ImmutableOpenMap <ShardId , ShardSnapshotStatus > shards , String failure ) {
130
+ this (entry .snapshot , entry .includeGlobalState , entry .partial , state , entry .indices , entry .startTime ,
131
+ entry .repositoryStateId , shards , failure );
118
132
}
119
133
120
134
public Entry (Entry entry , ImmutableOpenMap <ShardId , ShardSnapshotStatus > shards ) {
121
- this (entry , entry .state , shards );
135
+ this (entry , entry .state , shards , entry . failure );
122
136
}
123
137
124
138
public Snapshot snapshot () {
@@ -157,6 +171,10 @@ public long getRepositoryStateId() {
157
171
return repositoryStateId ;
158
172
}
159
173
174
+ public String failure () {
175
+ return failure ;
176
+ }
177
+
160
178
@ Override
161
179
public boolean equals (Object o ) {
162
180
if (this == o ) return true ;
@@ -437,14 +455,21 @@ public SnapshotsInProgress(StreamInput in) throws IOException {
437
455
if (in .getVersion ().onOrAfter (REPOSITORY_ID_INTRODUCED_VERSION )) {
438
456
repositoryStateId = in .readLong ();
439
457
}
458
+ final String failure ;
459
+ if (in .getVersion ().onOrAfter (Version .V_6_7_0 )) {
460
+ failure = in .readOptionalString ();
461
+ } else {
462
+ failure = null ;
463
+ }
440
464
entries [i ] = new Entry (snapshot ,
441
465
includeGlobalState ,
442
466
partial ,
443
467
state ,
444
468
Collections .unmodifiableList (indexBuilder ),
445
469
startTime ,
446
470
repositoryStateId ,
447
- builder .build ());
471
+ builder .build (),
472
+ failure );
448
473
}
449
474
this .entries = Arrays .asList (entries );
450
475
}
@@ -476,6 +501,9 @@ public void writeTo(StreamOutput out) throws IOException {
476
501
if (out .getVersion ().onOrAfter (REPOSITORY_ID_INTRODUCED_VERSION )) {
477
502
out .writeLong (entry .repositoryStateId );
478
503
}
504
+ if (out .getVersion ().onOrAfter (Version .V_6_7_0 )) {
505
+ out .writeOptionalString (entry .failure );
506
+ }
479
507
}
480
508
}
481
509
0 commit comments