Fix version for include_global_state in Snapshot Status API
It also adds a Rest test. Related #26853
This commit is contained in:
parent
efac982e35
commit
41f73e0acf
|
@ -147,7 +147,7 @@ public class SnapshotStatus implements ToXContentObject, Streamable {
|
|||
builder.add(SnapshotIndexShardStatus.readShardSnapshotStatus(in));
|
||||
}
|
||||
shards = Collections.unmodifiableList(builder);
|
||||
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
||||
if (in.getVersion().onOrAfter(Version.V_6_2_0)) {
|
||||
includeGlobalState = in.readOptionalBoolean();
|
||||
}
|
||||
updateShardStats();
|
||||
|
@ -161,7 +161,7 @@ public class SnapshotStatus implements ToXContentObject, Streamable {
|
|||
for (SnapshotIndexShardStatus shard : shards) {
|
||||
shard.writeTo(out);
|
||||
}
|
||||
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
|
||||
if (out.getVersion().onOrAfter(Version.V_6_2_0)) {
|
||||
out.writeOptionalBoolean(includeGlobalState);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public final class SnapshotInfo implements Comparable<SnapshotInfo>, ToXContent,
|
|||
private static final String INCLUDE_GLOBAL_STATE = "include_global_state";
|
||||
|
||||
private static final Version VERSION_INCOMPATIBLE_INTRODUCED = Version.V_5_2_0;
|
||||
private static final Version INCLUDE_GLOBAL_STATE_INTRODUCED = Version.V_7_0_0_alpha1;
|
||||
private static final Version INCLUDE_GLOBAL_STATE_INTRODUCED = Version.V_6_2_0;
|
||||
public static final Version VERBOSE_INTRODUCED = Version.V_5_5_0;
|
||||
|
||||
private static final Comparator<SnapshotInfo> COMPARATOR =
|
||||
|
|
|
@ -49,7 +49,7 @@ setup:
|
|||
snapshot: test_nonexistent_snapshot
|
||||
|
||||
---
|
||||
"Get missing snapshot info succeeds when ignoreUnavailable is true":
|
||||
"Get missing snapshot info succeeds when ignore_unavailable is true":
|
||||
|
||||
- do:
|
||||
snapshot.get:
|
||||
|
@ -96,3 +96,63 @@ setup:
|
|||
snapshot.delete:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot
|
||||
|
||||
---
|
||||
"Get snapshot info contains include_global_state":
|
||||
- skip:
|
||||
version: " - 6.1.99"
|
||||
reason: "include_global_state field has been added in the response in 6.2.0"
|
||||
|
||||
- do:
|
||||
indices.create:
|
||||
index: test_index
|
||||
body:
|
||||
settings:
|
||||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
||||
|
||||
- do:
|
||||
snapshot.create:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot_with_include_global_state
|
||||
wait_for_completion: true
|
||||
body: |
|
||||
{ "include_global_state": true }
|
||||
|
||||
- do:
|
||||
snapshot.get:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot_with_include_global_state
|
||||
|
||||
- is_true: snapshots
|
||||
- match: { snapshots.0.snapshot: test_snapshot_with_include_global_state }
|
||||
- match: { snapshots.0.state: SUCCESS }
|
||||
- match: { snapshots.0.include_global_state: true }
|
||||
|
||||
- do:
|
||||
snapshot.delete:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot_with_include_global_state
|
||||
|
||||
- do:
|
||||
snapshot.create:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot_without_include_global_state
|
||||
wait_for_completion: true
|
||||
body: |
|
||||
{ "include_global_state": false }
|
||||
|
||||
- do:
|
||||
snapshot.get:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot_without_include_global_state
|
||||
|
||||
- is_true: snapshots
|
||||
- match: { snapshots.0.snapshot: test_snapshot_without_include_global_state }
|
||||
- match: { snapshots.0.state: SUCCESS }
|
||||
- match: { snapshots.0.include_global_state: false }
|
||||
|
||||
- do:
|
||||
snapshot.delete:
|
||||
repository: test_repo_get_1
|
||||
snapshot: test_snapshot_without_include_global_state
|
||||
|
|
Loading…
Reference in New Issue