Skip to content

Commit 002abda

Browse files
committed
Fix build
Signed-off-by: Lakshya Taragi <lakshya.taragi@gmail.com>
1 parent cbcfb42 commit 002abda

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void testStatusApiConsistency() {
115115
assertEquals(snapshotStatus.getStats().getTime(), snapshotInfo.endTime() - snapshotInfo.startTime());
116116
}
117117

118-
public void testStatusAPICallForShallowCopySnapshot() {
118+
public void testStatusAPICallForShallowCopySnapshot() throws Exception {
119119
disableRepoConsistencyCheck("Remote store repository is being used for the test");
120120
internalCluster().startClusterManagerOnlyNode();
121121
internalCluster().startDataOnlyNode();
@@ -135,15 +135,24 @@ public void testStatusAPICallForShallowCopySnapshot() {
135135
final String snapshot = "snapshot";
136136
createFullSnapshot(snapshotRepoName, snapshot);
137137

138-
final SnapshotStatus snapshotStatus = getSnapshotStatus(snapshotRepoName, snapshot);
139-
assertThat(snapshotStatus.getState(), is(SnapshotsInProgress.State.SUCCESS));
138+
assertBusy(() -> {
139+
final SnapshotStatus snapshotStatus = client().admin()
140+
.cluster()
141+
.prepareSnapshotStatus(snapshotRepoName)
142+
.setSnapshots(snapshot)
143+
.execute()
144+
.actionGet()
145+
.getSnapshots()
146+
.get(0);
147+
assertThat(snapshotStatus.getState(), is(SnapshotsInProgress.State.SUCCESS));
140148

141-
final SnapshotIndexShardStatus snapshotShardState = stateFirstShard(snapshotStatus, indexName);
142-
assertThat(snapshotShardState.getStage(), is(SnapshotIndexShardStage.DONE));
143-
assertThat(snapshotShardState.getStats().getTotalFileCount(), greaterThan(0));
144-
assertThat(snapshotShardState.getStats().getTotalSize(), greaterThan(0L));
145-
assertThat(snapshotShardState.getStats().getIncrementalFileCount(), greaterThan(0));
146-
assertThat(snapshotShardState.getStats().getIncrementalSize(), greaterThan(0L));
149+
final SnapshotIndexShardStatus snapshotShardState = stateFirstShard(snapshotStatus, indexName);
150+
assertThat(snapshotShardState.getStage(), is(SnapshotIndexShardStage.DONE));
151+
assertThat(snapshotShardState.getStats().getTotalFileCount(), greaterThan(0));
152+
assertThat(snapshotShardState.getStats().getTotalSize(), greaterThan(0L));
153+
assertThat(snapshotShardState.getStats().getIncrementalFileCount(), greaterThan(0));
154+
assertThat(snapshotShardState.getStats().getIncrementalSize(), greaterThan(0L));
155+
}, 1, TimeUnit.MINUTES);
147156
}
148157

149158
public void testStatusAPICallInProgressSnapshot() throws Exception {

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/SnapshotStatus.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ public SnapshotStats getStats() {
240240
private static final String STATE = "state";
241241
private static final String INDICES = "indices";
242242
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";
244243

245244
@Override
246245
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
@@ -252,9 +251,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
252251
if (includeGlobalState != null) {
253252
builder.field(INCLUDE_GLOBAL_STATE, includeGlobalState);
254253
}
255-
if (initialTotalSizeInBytes != 0) {
256-
builder.field(INITIAL_TOTAL_SIZE_IN_BYTES, initialTotalSizeInBytes);
257-
}
258254
builder.field(SnapshotShardsStats.Fields.SHARDS_STATS, shardsStats, params);
259255
builder.field(SnapshotStats.Fields.STATS, stats, params);
260256
builder.startObject(INDICES);
@@ -276,7 +272,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
276272
String uuid = (String) parsedObjects[i++];
277273
String rawState = (String) parsedObjects[i++];
278274
Boolean includeGlobalState = (Boolean) parsedObjects[i++];
279-
Long initialTotalSizeInBytes = (Long) parsedObjects[i++];
280275
SnapshotStats stats = ((SnapshotStats) parsedObjects[i++]);
281276
SnapshotShardsStats shardsStats = ((SnapshotShardsStats) parsedObjects[i++]);
282277
@SuppressWarnings("unchecked")
@@ -297,16 +292,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
297292
shards.addAll(index.getShards().values());
298293
}
299294
}
300-
return new SnapshotStatus(
301-
snapshot,
302-
state,
303-
shards,
304-
indicesStatus,
305-
shardsStats,
306-
stats,
307-
includeGlobalState,
308-
initialTotalSizeInBytes
309-
);
295+
return new SnapshotStatus(snapshot, state, shards, indicesStatus, shardsStats, stats, includeGlobalState, 0L);
310296
}
311297
);
312298
static {
@@ -315,7 +301,6 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
315301
PARSER.declareString(constructorArg(), new ParseField(UUID));
316302
PARSER.declareString(constructorArg(), new ParseField(STATE));
317303
PARSER.declareBoolean(optionalConstructorArg(), new ParseField(INCLUDE_GLOBAL_STATE));
318-
PARSER.declareLong(optionalConstructorArg(), new ParseField(INITIAL_TOTAL_SIZE_IN_BYTES));
319304
PARSER.declareField(
320305
constructorArg(),
321306
SnapshotStats::fromXContent,

0 commit comments

Comments
 (0)