Skip to content
This repository has been archived by the owner on Sep 24, 2019. It is now read-only.

Commit

Permalink
elastic#18543 use "file_count" to eliminate "incremental", "processed…
Browse files Browse the repository at this point in the history
…" and "total" naming confusion
  • Loading branch information
Vladimir Dolzhenko committed May 15, 2018
1 parent 3ebc769 commit 828bb12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
7 changes: 3 additions & 4 deletions docs/reference/modules/snapshots.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,15 @@ Returns this:
},
"stats": {
"incremental": {
"count": 8,
"file_count": 8,
"size_in_bytes": 4704
},
"processed": {
"count": 7,
"file_count": 7,
"size_in_bytes": 4254
},
"total": {
"count": 8,
"file_count": 8,
"size_in_bytes": 4704
},
"start_time_in_millis": 1526280280355,
Expand All @@ -599,7 +599,6 @@ Returns this:
]
}
--------------------------------------------------
// CONSOLE
// TEST[continued]

Where `stats` provides snapshot details - how many files the snapshot consists of and sizes in bytes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static final class Fields {
static final String PROCESSED = "processed";
static final String TOTAL = "total";

static final String COUNT = "count";
static final String FILE_COUNT = "file_count";
static final String SIZE = "size";
static final String SIZE_IN_BYTES = "size_in_bytes";

Expand All @@ -188,22 +188,22 @@ public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params par
builder.startObject(Fields.STATS)
// incremental starts
.startObject(Fields.INCREMENTAL)
.field(Fields.COUNT, getIncrementalFileCount())
.field(Fields.FILE_COUNT, getIncrementalFileCount())
.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(getIncrementalSize()))
// incremental ends
.endObject();

if (getProcessedFileCount() != getIncrementalFileCount()) {
// processed starts
builder.startObject(Fields.PROCESSED)
.field(Fields.COUNT, getProcessedFileCount())
.field(Fields.FILE_COUNT, getProcessedFileCount())
.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(getProcessedSize()))
// processed ends
.endObject();
}
// total starts
return builder.startObject(Fields.TOTAL)
.field(Fields.COUNT, getTotalFileCount())
.field(Fields.FILE_COUNT, getTotalFileCount())
.humanReadableField(Fields.SIZE_IN_BYTES, Fields.SIZE, new ByteSizeValue(getTotalSize()))
// all_files ends
.endObject()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ public void testToString() throws Exception {
" },\n" +
" \"stats\" : {\n" +
" \"incremental\" : {\n" +
" \"count\" : 0,\n" +
" \"file_count\" : 0,\n" +
" \"size_in_bytes\" : 0\n" +
" },\n" +
" \"total\" : {\n" +
" \"count\" : 0,\n" +
" \"file_count\" : 0,\n" +
" \"size_in_bytes\" : 0\n" +
" },\n" +
" \"start_time_in_millis\" : 0,\n" +
Expand All @@ -118,11 +118,11 @@ public void testToString() throws Exception {
" },\n" +
" \"stats\" : {\n" +
" \"incremental\" : {\n" +
" \"count\" : 0,\n" +
" \"file_count\" : 0,\n" +
" \"size_in_bytes\" : 0\n" +
" },\n" +
" \"total\" : {\n" +
" \"count\" : 0,\n" +
" \"file_count\" : 0,\n" +
" \"size_in_bytes\" : 0\n" +
" },\n" +
" \"start_time_in_millis\" : 0,\n" +
Expand All @@ -137,11 +137,11 @@ public void testToString() throws Exception {
" \"stage\" : \"" + shardStage.toString() + "\",\n" +
" \"stats\" : {\n" +
" \"incremental\" : {\n" +
" \"count\" : 0,\n" +
" \"file_count\" : 0,\n" +
" \"size_in_bytes\" : 0\n" +
" },\n" +
" \"total\" : {\n" +
" \"count\" : 0,\n" +
" \"file_count\" : 0,\n" +
" \"size_in_bytes\" : 0\n" +
" },\n" +
" \"start_time_in_millis\" : 0,\n" +
Expand Down

0 comments on commit 828bb12

Please sign in to comment.