Skip to content

Commit b55b079

Browse files
Include size of snapshot in snapshot metadata #18543, bwc clean up (#30890)
1 parent 0698dd0 commit b55b079

File tree

4 files changed

+8
-74
lines changed

4 files changed

+8
-74
lines changed

docs/reference/modules/snapshots.asciidoc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -597,12 +597,7 @@ The output looks similar to the following:
597597
"size_in_bytes": 4704
598598
},
599599
"start_time_in_millis": 1526280280355,
600-
"time_in_millis": 358,
601-
602-
"number_of_files": 8,
603-
"processed_files": 8,
604-
"total_size_in_bytes": 4704,
605-
"processed_size_in_bytes": 4704
600+
"time_in_millis": 358
606601
}
607602
}
608603
]
@@ -616,9 +611,6 @@ the `stats` object contains a `total` section for all the files that are referen
616611
for those files that actually needed to be copied over as part of the incremental snapshotting. In case of a snapshot that's still
617612
in progress, there's also a `processed` section that contains information about the files that are in the process of being copied.
618613

619-
_Note_: Properties `number_of_files`, `processed_files`, `total_size_in_bytes` and `processed_size_in_bytes` are used for
620-
backward compatibility reasons with older 5.x and 6.x versions. These fields will be removed in Elasticsearch v7.0.0.
621-
622614
Multiple ids are also supported:
623615

624616
[source,sh]

rest-api-spec/src/main/resources/rest-api-spec/test/snapshot.status/10_basic.yml

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ setup:
1111

1212
---
1313
"Get snapshot status":
14-
- skip:
15-
version: " - 6.99.99"
16-
reason: "backporting in progress: https://github.com/elastic/elasticsearch/pull/29602"
1714
- do:
1815
indices.create:
1916
index: test_index
@@ -39,38 +36,10 @@ setup:
3936
- gt: { snapshots.0.stats.incremental.file_count: 0 }
4037
- gt: { snapshots.0.stats.incremental.size_in_bytes: 0 }
4138
- gt: { snapshots.0.stats.total.file_count: 0 }
39+
- gt: { snapshots.0.stats.total.size_in_bytes: 0 }
4240
- is_true: snapshots.0.stats.start_time_in_millis
4341
- is_true: snapshots.0.stats.time_in_millis
4442

45-
---
46-
"Get snapshot status with BWC fields":
47-
- do:
48-
indices.create:
49-
index: test_index
50-
body:
51-
settings:
52-
number_of_shards: 1
53-
number_of_replicas: 0
54-
55-
- do:
56-
snapshot.create:
57-
repository: test_repo_status_1
58-
snapshot: test_snapshot_bwc
59-
wait_for_completion: true
60-
61-
- do:
62-
snapshot.status:
63-
repository: test_repo_status_1
64-
snapshot: test_snapshot_bwc
65-
66-
- is_true: snapshots
67-
- match: { snapshots.0.snapshot: test_snapshot_bwc }
68-
- match: { snapshots.0.state: SUCCESS }
69-
- gt: { snapshots.0.stats.number_of_files: 0 }
70-
- gt: { snapshots.0.stats.processed_files: 0 }
71-
- gt: { snapshots.0.stats.total_size_in_bytes: 0 }
72-
- gt: { snapshots.0.stats.processed_size_in_bytes: 0 }
73-
7443
---
7544
"Get missing snapshot status throws an exception":
7645

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStats.java

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public void writeTo(StreamOutput out) throws IOException {
132132
out.writeVLong(incrementalSize);
133133
out.writeVLong(processedSize);
134134

135-
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
135+
if (out.getVersion().onOrAfter(Version.V_6_4_0)) {
136136
out.writeVInt(totalFileCount);
137137
out.writeVLong(totalSize);
138138
}
@@ -149,7 +149,7 @@ public void readFrom(StreamInput in) throws IOException {
149149
incrementalSize = in.readVLong();
150150
processedSize = in.readVLong();
151151

152-
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
152+
if (in.getVersion().onOrAfter(Version.V_6_4_0)) {
153153
totalFileCount = in.readVInt();
154154
totalSize = in.readVLong();
155155
} else {
@@ -172,15 +172,6 @@ static final class Fields {
172172
static final String START_TIME_IN_MILLIS = "start_time_in_millis";
173173
static final String TIME_IN_MILLIS = "time_in_millis";
174174
static final String TIME = "time";
175-
176-
// BWC
177-
static final String NUMBER_OF_FILES = "number_of_files";
178-
static final String PROCESSED_FILES = "processed_files";
179-
static final String TOTAL_SIZE = "total_size";
180-
static final String TOTAL_SIZE_IN_BYTES = "total_size_in_bytes";
181-
static final String PROCESSED_SIZE_IN_BYTES = "processed_size_in_bytes";
182-
static final String PROCESSED_SIZE = "processed_size";
183-
184175
}
185176

186177
@Override
@@ -211,13 +202,7 @@ public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params par
211202
builder.field(Fields.START_TIME_IN_MILLIS, getStartTime())
212203
.humanReadableField(Fields.TIME_IN_MILLIS, Fields.TIME, new TimeValue(getTime()));
213204

214-
// BWC part
215-
return builder.field(Fields.NUMBER_OF_FILES, getIncrementalFileCount())
216-
.field(Fields.PROCESSED_FILES, getProcessedFileCount())
217-
.humanReadableField(Fields.TOTAL_SIZE_IN_BYTES, Fields.TOTAL_SIZE, new ByteSizeValue(getIncrementalSize()))
218-
.humanReadableField(Fields.PROCESSED_SIZE_IN_BYTES, Fields.PROCESSED_SIZE, new ByteSizeValue(getProcessedSize()))
219-
// BWC part ends
220-
.endObject();
205+
return builder.endObject();
221206
}
222207

223208
void add(SnapshotStats stats) {

server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotStatusTests.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,7 @@ public void testToString() throws Exception {
100100
" \"size_in_bytes\" : 0\n" +
101101
" },\n" +
102102
" \"start_time_in_millis\" : 0,\n" +
103-
" \"time_in_millis\" : 0,\n" +
104-
" \"number_of_files\" : 0,\n" +
105-
" \"processed_files\" : 0,\n" +
106-
" \"total_size_in_bytes\" : 0,\n" +
107-
" \"processed_size_in_bytes\" : 0\n" +
103+
" \"time_in_millis\" : 0\n" +
108104
" },\n" +
109105
" \"indices\" : {\n" +
110106
" \"" + indexName + "\" : {\n" +
@@ -126,11 +122,7 @@ public void testToString() throws Exception {
126122
" \"size_in_bytes\" : 0\n" +
127123
" },\n" +
128124
" \"start_time_in_millis\" : 0,\n" +
129-
" \"time_in_millis\" : 0,\n" +
130-
" \"number_of_files\" : 0,\n" +
131-
" \"processed_files\" : 0,\n" +
132-
" \"total_size_in_bytes\" : 0,\n" +
133-
" \"processed_size_in_bytes\" : 0\n" +
125+
" \"time_in_millis\" : 0\n" +
134126
" },\n" +
135127
" \"shards\" : {\n" +
136128
" \"" + shardId + "\" : {\n" +
@@ -145,11 +137,7 @@ public void testToString() throws Exception {
145137
" \"size_in_bytes\" : 0\n" +
146138
" },\n" +
147139
" \"start_time_in_millis\" : 0,\n" +
148-
" \"time_in_millis\" : 0,\n" +
149-
" \"number_of_files\" : 0,\n" +
150-
" \"processed_files\" : 0,\n" +
151-
" \"total_size_in_bytes\" : 0,\n" +
152-
" \"processed_size_in_bytes\" : 0\n" +
140+
" \"time_in_millis\" : 0\n" +
153141
" }\n" +
154142
" }\n" +
155143
" }\n" +

0 commit comments

Comments
 (0)