32
32
33
33
package org .opensearch .action .admin .cluster .snapshots .status ;
34
34
35
- import org .opensearch .Version ;
36
35
import org .opensearch .cluster .SnapshotsInProgress ;
37
36
import org .opensearch .cluster .SnapshotsInProgress .State ;
38
37
import org .opensearch .common .Nullable ;
@@ -87,8 +86,6 @@ public class SnapshotStatus implements ToXContentObject, Writeable {
87
86
88
87
private SnapshotStats stats ;
89
88
90
- private final long initialTotalSizeInBytes ;
91
-
92
89
@ Nullable
93
90
private final Boolean includeGlobalState ;
94
91
@@ -99,12 +96,7 @@ public class SnapshotStatus implements ToXContentObject, Writeable {
99
96
includeGlobalState = in .readOptionalBoolean ();
100
97
final long startTime = in .readLong ();
101
98
final long time = in .readLong ();
102
- if (in .getVersion ().onOrAfter (Version .V_2_17_0 )) {
103
- initialTotalSizeInBytes = in .readOptionalLong ();
104
- } else {
105
- initialTotalSizeInBytes = 0L ;
106
- }
107
- updateShardStats (startTime , time , initialTotalSizeInBytes );
99
+ updateShardStats (startTime , time );
108
100
}
109
101
110
102
SnapshotStatus (
@@ -113,18 +105,15 @@ public class SnapshotStatus implements ToXContentObject, Writeable {
113
105
List <SnapshotIndexShardStatus > shards ,
114
106
Boolean includeGlobalState ,
115
107
long startTime ,
116
- long time ,
117
- long initialTotalSizeInBytes
108
+ long time
118
109
) {
119
110
this .snapshot = Objects .requireNonNull (snapshot );
120
111
this .state = Objects .requireNonNull (state );
121
112
this .shards = Objects .requireNonNull (shards );
122
113
this .includeGlobalState = includeGlobalState ;
123
114
shardsStats = new SnapshotShardsStats (shards );
124
115
assert time >= 0 : "time must be >= 0 but received [" + time + "]" ;
125
- this .initialTotalSizeInBytes = initialTotalSizeInBytes ;
126
- assert initialTotalSizeInBytes >= 0 : "initialTotalSizeInBytes must be >= 0 but received [" + initialTotalSizeInBytes + "]" ;
127
- updateShardStats (startTime , time , initialTotalSizeInBytes );
116
+ updateShardStats (startTime , time );
128
117
}
129
118
130
119
private SnapshotStatus (
@@ -134,8 +123,7 @@ private SnapshotStatus(
134
123
Map <String , SnapshotIndexStatus > indicesStatus ,
135
124
SnapshotShardsStats shardsStats ,
136
125
SnapshotStats stats ,
137
- Boolean includeGlobalState ,
138
- long initialTotalSizeInBytes
126
+ Boolean includeGlobalState
139
127
) {
140
128
this .snapshot = snapshot ;
141
129
this .state = state ;
@@ -144,7 +132,6 @@ private SnapshotStatus(
144
132
this .shardsStats = shardsStats ;
145
133
this .stats = stats ;
146
134
this .includeGlobalState = includeGlobalState ;
147
- this .initialTotalSizeInBytes = initialTotalSizeInBytes ;
148
135
}
149
136
150
137
/**
@@ -217,9 +204,6 @@ public void writeTo(StreamOutput out) throws IOException {
217
204
out .writeOptionalBoolean (includeGlobalState );
218
205
out .writeLong (stats .getStartTime ());
219
206
out .writeLong (stats .getTime ());
220
- if (out .getVersion ().onOrAfter (Version .V_2_17_0 )) {
221
- out .writeOptionalLong (initialTotalSizeInBytes );
222
- }
223
207
}
224
208
225
209
@ Override
@@ -240,7 +224,6 @@ public SnapshotStats getStats() {
240
224
private static final String STATE = "state" ;
241
225
private static final String INDICES = "indices" ;
242
226
private static final String INCLUDE_GLOBAL_STATE = "include_global_state" ;
243
- private static final String INITIAL_TOTAL_SIZE_IN_BYTES = "initial_total_size_in_bytes" ;
244
227
245
228
@ Override
246
229
public XContentBuilder toXContent (XContentBuilder builder , Params params ) throws IOException {
@@ -252,9 +235,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
252
235
if (includeGlobalState != null ) {
253
236
builder .field (INCLUDE_GLOBAL_STATE , includeGlobalState );
254
237
}
255
- if (initialTotalSizeInBytes != 0 ) {
256
- builder .field (INITIAL_TOTAL_SIZE_IN_BYTES , initialTotalSizeInBytes );
257
- }
258
238
builder .field (SnapshotShardsStats .Fields .SHARDS_STATS , shardsStats , params );
259
239
builder .field (SnapshotStats .Fields .STATS , stats , params );
260
240
builder .startObject (INDICES );
@@ -276,7 +256,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
276
256
String uuid = (String ) parsedObjects [i ++];
277
257
String rawState = (String ) parsedObjects [i ++];
278
258
Boolean includeGlobalState = (Boolean ) parsedObjects [i ++];
279
- Long initialTotalSizeInBytes = (Long ) parsedObjects [i ++];
280
259
SnapshotStats stats = ((SnapshotStats ) parsedObjects [i ++]);
281
260
SnapshotShardsStats shardsStats = ((SnapshotShardsStats ) parsedObjects [i ++]);
282
261
@ SuppressWarnings ("unchecked" )
@@ -297,16 +276,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
297
276
shards .addAll (index .getShards ().values ());
298
277
}
299
278
}
300
- return new SnapshotStatus (
301
- snapshot ,
302
- state ,
303
- shards ,
304
- indicesStatus ,
305
- shardsStats ,
306
- stats ,
307
- includeGlobalState ,
308
- initialTotalSizeInBytes
309
- );
279
+ return new SnapshotStatus (snapshot , state , shards , indicesStatus , shardsStats , stats , includeGlobalState );
310
280
}
311
281
);
312
282
static {
@@ -315,7 +285,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
315
285
PARSER .declareString (constructorArg (), new ParseField (UUID ));
316
286
PARSER .declareString (constructorArg (), new ParseField (STATE ));
317
287
PARSER .declareBoolean (optionalConstructorArg (), new ParseField (INCLUDE_GLOBAL_STATE ));
318
- PARSER .declareLong (optionalConstructorArg (), new ParseField (INITIAL_TOTAL_SIZE_IN_BYTES ));
319
288
PARSER .declareField (
320
289
constructorArg (),
321
290
SnapshotStats ::fromXContent ,
@@ -330,8 +299,8 @@ public static SnapshotStatus fromXContent(XContentParser parser) throws IOExcept
330
299
return PARSER .parse (parser , null );
331
300
}
332
301
333
- private void updateShardStats (long startTime , long time , long initialTotalSizeInBytes ) {
334
- stats = new SnapshotStats (startTime , time , 0 , 0 , 0 , 0 , initialTotalSizeInBytes , 0 );
302
+ private void updateShardStats (long startTime , long time ) {
303
+ stats = new SnapshotStats (startTime , time , 0 , 0 , 0 , 0 , 0 , 0 );
335
304
shardsStats = new SnapshotShardsStats (shards );
336
305
for (SnapshotIndexShardStatus shard : shards ) {
337
306
// BWC: only update timestamps when we did not get a start time from an old node
0 commit comments