[Rollup] Rename job config size to page_size (elastic/x-pack-elasticsearch#4309)

Renaming should hopefully make it more clear that this is the size
of pages to process during rolling up, nothing to do with the size
of the various groups, metrics, etc.

Original commit: elastic/x-pack-elasticsearch@8a0a44f04b
This commit is contained in:
Zachary Tong 2018-04-10 13:34:40 -07:00 committed by GitHub
parent cf965dca27
commit 20dbd75623
20 changed files with 74 additions and 74 deletions

View File

@ -453,7 +453,7 @@ setups['sensor_rollup_job'] = '''
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -523,7 +523,7 @@ setups['sensor_started_rollup_job'] = '''
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "* * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -641,7 +641,7 @@ setups['sensor_prefab_data'] = '''
rollup_index: "sensor_rollup"
index_pattern: "sensor-*"
timeout: "20s"
size: 1000
page_size: 1000
groups:
date_histogram:
delay: "7d"

View File

@ -88,7 +88,7 @@ Which will yield the following response:
}
],
"timeout" : "20s",
"size" : 1000
"page_size" : 1000
},
"status" : {
"job_state" : "stopped"
@ -135,7 +135,7 @@ PUT _xpack/rollup/job/sensor2 <1>
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -207,7 +207,7 @@ Which will yield the following response:
}
],
"timeout" : "20s",
"size" : 1000
"page_size" : 1000
},
"status" : {
"job_state" : "stopped"
@ -255,7 +255,7 @@ Which will yield the following response:
}
],
"timeout" : "20s",
"size" : 1000
"page_size" : 1000
},
"status" : {
"job_state" : "stopped"

View File

@ -31,7 +31,7 @@ started with the <<rollup-start-job,Start Job API>>.
`cron` (required)::
(string) A cron string which defines when the rollup job should be executed.
`size` (required)::
`page_size` (required)::
(int) The number of bucket results that should be processed on each iteration of the rollup indexer. A larger value
will tend to execute faster, but will require more memory during processing.
@ -59,7 +59,7 @@ PUT _xpack/rollup/job/sensor
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",

View File

@ -52,7 +52,7 @@ PUT _xpack/rollup/job/sensor
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",

View File

@ -17,7 +17,7 @@ PUT _xpack/rollup/job/sensor
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -75,7 +75,7 @@ In the above example, there are several pieces of logistical configuration for t
defined in the <<rollup-groups-config,grouping configuration>>) but to only run the indexer on a daily basis at midnight, as defined by the cron.
The cron pattern is defined just like Watcher's Cron Schedule.
`size` (required)::
`page_size` (required)::
(int) The number of bucket results that should be processed on each iteration of the rollup indexer. A larger value
will tend to execute faster, but will require more memory during processing. This has no effect on how the data is rolled up, it is
merely used for tweaking the speed/memory cost of the indexer.

View File

@ -53,7 +53,7 @@ PUT _xpack/rollup/job/sensor
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",

View File

@ -31,7 +31,7 @@ PUT _xpack/rollup/job/sensor
"index_pattern": "sensor-*",
"rollup_index": "sensor_rollup",
"cron": "*/30 * * * * ?",
"size" :1000,
"page_size" :1000,
"groups" : {
"date_histogram": {
"field": "timestamp",

View File

@ -41,7 +41,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
public static final ParseField TIMEOUT = new ParseField("timeout");
public static final ParseField CURRENT = new ParseField("current");
public static final ParseField CRON = new ParseField("cron");
public static final ParseField SIZE = new ParseField("size");
public static final ParseField PAGE_SIZE = new ParseField("page_size");
private static final ParseField INDEX_PATTERN = new ParseField("index_pattern");
private static final ParseField ROLLUP_INDEX = new ParseField("rollup_index");
@ -55,7 +55,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
private List<MetricConfig> metricsConfig = Collections.emptyList();
private TimeValue timeout = TimeValue.timeValueSeconds(20);
private String cron;
private int size;
private int pageSize;
public static final ObjectParser<RollupJobConfig.Builder, Void> PARSER = new ObjectParser<>(NAME, false, RollupJobConfig.Builder::new);
@ -68,10 +68,10 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
PARSER.declareString(RollupJobConfig.Builder::setIndexPattern, INDEX_PATTERN);
PARSER.declareString(RollupJobConfig.Builder::setRollupIndex, ROLLUP_INDEX);
PARSER.declareString(RollupJobConfig.Builder::setCron, CRON);
PARSER.declareInt(RollupJobConfig.Builder::setSize, SIZE);
PARSER.declareInt(RollupJobConfig.Builder::setPageSize, PAGE_SIZE);
}
RollupJobConfig(String id, String indexPattern, String rollupIndex, String cron, int size, GroupConfig groupConfig,
RollupJobConfig(String id, String indexPattern, String rollupIndex, String cron, int pageSize, GroupConfig groupConfig,
List<MetricConfig> metricsConfig, TimeValue timeout) {
this.id = id;
this.indexPattern = indexPattern;
@ -80,7 +80,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
this.metricsConfig = metricsConfig;
this.timeout = timeout;
this.cron = cron;
this.size = size;
this.pageSize = pageSize;
}
public RollupJobConfig(StreamInput in) throws IOException {
@ -91,7 +91,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
groupConfig = in.readOptionalWriteable(GroupConfig::new);
metricsConfig = in.readList(MetricConfig::new);
timeout = new TimeValue(in);
size = in.readInt();
pageSize = in.readInt();
}
public RollupJobConfig() {}
@ -124,8 +124,8 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
return cron;
}
public int getSize() {
return size;
public int getPageSize() {
return pageSize;
}
@Override
@ -169,7 +169,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
if (timeout != null) {
builder.field(TIMEOUT.getPreferredName(), timeout);
}
builder.field(SIZE.getPreferredName(), size);
builder.field(PAGE_SIZE.getPreferredName(), pageSize);
builder.endObject();
return builder;
}
@ -183,7 +183,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
out.writeOptionalWriteable(groupConfig);
out.writeList(metricsConfig);
timeout.writeTo(out);
out.writeInt(size);
out.writeInt(pageSize);
}
@Override
@ -205,13 +205,13 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
&& Objects.equals(this.groupConfig, that.groupConfig)
&& Objects.equals(this.metricsConfig, that.metricsConfig)
&& Objects.equals(this.timeout, that.timeout)
&& Objects.equals(this.size, that.size);
&& Objects.equals(this.pageSize, that.pageSize);
}
@Override
public int hashCode() {
return Objects.hash(id, indexPattern, rollupIndex, cron, groupConfig,
metricsConfig, timeout, size);
metricsConfig, timeout, pageSize);
}
@Override
@ -234,7 +234,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
private List<MetricConfig> metricsConfig = Collections.emptyList();
private TimeValue timeout = TimeValue.timeValueSeconds(20);
private String cron;
private int size = 0;
private int pageSize = 0;
public Builder(RollupJobConfig job) {
this.id = job.getId();
@ -244,7 +244,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
this.metricsConfig = job.getMetricsConfig();
this.timeout = job.getTimeout();
this.cron = job.getCron();
this.size = job.getSize();
this.pageSize = job.getPageSize();
}
public static RollupJobConfig.Builder fromXContent(String id, XContentParser parser) {
@ -320,12 +320,12 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
return this;
}
public int getSize() {
return size;
public int getPageSize() {
return pageSize;
}
public RollupJobConfig.Builder setSize(int size) {
this.size = size;
public RollupJobConfig.Builder setPageSize(int pageSize) {
this.pageSize = pageSize;
return this;
}
@ -342,8 +342,8 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
if (cron == null || cron.isEmpty()) {
throw new IllegalArgumentException("A cron schedule is mandatory.");
}
if (size <= 0) {
throw new IllegalArgumentException("Parameter [" + SIZE.getPreferredName()
if (pageSize <= 0) {
throw new IllegalArgumentException("Parameter [" + PAGE_SIZE.getPreferredName()
+ "] is mandatory and must be a positive long.");
}
// Cron doesn't have a parse helper method to see if the cron is valid,
@ -353,7 +353,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
if (groupConfig == null && (metricsConfig == null || metricsConfig.isEmpty())) {
throw new IllegalArgumentException("At least one grouping or metric must be configured.");
}
return new RollupJobConfig(id, indexPattern, rollupIndex, cron, size, groupConfig,
return new RollupJobConfig(id, indexPattern, rollupIndex, cron, pageSize, groupConfig,
metricsConfig, timeout);
}
@ -387,7 +387,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
if (timeout != null) {
builder.field(TIMEOUT.getPreferredName(), timeout);
}
builder.field(SIZE.getPreferredName(), size);
builder.field(PAGE_SIZE.getPreferredName(), pageSize);
builder.endObject();
return builder;
}
@ -401,7 +401,7 @@ public class RollupJobConfig implements NamedWriteable, ToXContentObject {
out.writeOptionalWriteable(groupConfig);
out.writeList(metricsConfig);
timeout.writeTo(out);
out.writeInt(size);
out.writeInt(pageSize);
}
}
}

View File

@ -30,7 +30,7 @@ public class ConfigTestHelpers {
builder.setIndexPattern(ESTestCase.randomAlphaOfLengthBetween(1,10));
builder.setRollupIndex(ESTestCase.randomAlphaOfLengthBetween(1,10));
builder.setGroupConfig(ConfigTestHelpers.getGroupConfig().build());
builder.setSize(ESTestCase.randomIntBetween(1,10));
builder.setPageSize(ESTestCase.randomIntBetween(1,10));
if (ESTestCase.randomBoolean()) {
List<MetricConfig> metrics = IntStream.range(1, ESTestCase.randomIntBetween(1,10))
.mapToObj(n -> ConfigTestHelpers.getMetricConfig().build())

View File

@ -400,7 +400,7 @@ public abstract class RollupIndexer {
if (metadata.isEmpty() == false) {
composite.setMetaData(metadata);
}
composite.size(config.getSize());
composite.size(config.getPageSize());
return composite;
}

View File

@ -149,7 +149,7 @@ public class RollupIT extends ESIntegTestCase {
config.setGroupConfig(groupConfig.build());
config.setMetricsConfig(Collections.singletonList(metricConfig));
config.setCron("* * * * * ? *");
config.setSize(10);
config.setPageSize(10);
PutRollupJobAction.Request request = new PutRollupJobAction.Request();
request.setConfig(config.build());
@ -182,7 +182,7 @@ public class RollupIT extends ESIntegTestCase {
config.setGroupConfig(groupConfig.build());
config.setMetricsConfig(Collections.singletonList(metricConfig));
config.setCron("* * * * * ? *");
config.setSize(10);
config.setPageSize(10);
PutRollupJobAction.Request request = new PutRollupJobAction.Request();
request.setConfig(config.build());
@ -248,7 +248,7 @@ public class RollupIT extends ESIntegTestCase {
config.setGroupConfig(groupConfig.build());
config.setMetricsConfig(Collections.singletonList(metricConfig));
config.setCron("* * * * * ? *");
config.setSize(10);
config.setPageSize(10);
PutRollupJobAction.Request request = new PutRollupJobAction.Request();
request.setConfig(config.build());
@ -261,7 +261,7 @@ public class RollupIT extends ESIntegTestCase {
config2.setGroupConfig(groupConfig.build());
config2.setMetricsConfig(Collections.singletonList(metricConfig));
config2.setCron("* * * * * ? *");
config2.setSize(10);
config2.setPageSize(10);
PutRollupJobAction.Request request2 = new PutRollupJobAction.Request();
request2.setConfig(config2.build());
@ -392,7 +392,7 @@ public class RollupIT extends ESIntegTestCase {
config.setGroupConfig(groupConfig.build());
config.setMetricsConfig(Collections.singletonList(metricConfig));
config.setCron("* * * * * ? *");
config.setSize(1000);
config.setPageSize(1000);
PutRollupJobAction.Request request = new PutRollupJobAction.Request();
request.setConfig(config.build());

View File

@ -135,13 +135,13 @@ public class ConfigTests extends ESTestCase {
public void testBadSize() {
RollupJobConfig.Builder job = ConfigTestHelpers.getRollupJob("foo");
job.setSize(-1);
job.setPageSize(-1);
Exception e = expectThrows(IllegalArgumentException.class, job::build);
assertThat(e.getMessage(), equalTo("Parameter [size] is mandatory and must be a positive long."));
assertThat(e.getMessage(), equalTo("Parameter [page_size] is mandatory and must be a positive long."));
job.setSize(0);
job.setPageSize(0);
e = expectThrows(IllegalArgumentException.class, job::build);
assertThat(e.getMessage(), equalTo("Parameter [size] is mandatory and must be a positive long."));
assertThat(e.getMessage(), equalTo("Parameter [page_size] is mandatory and must be a positive long."));
}
public void testEmptyDateHistoField() {

View File

@ -452,7 +452,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
.setGroupConfig(groupConfig)
.setMetricsConfig(metricConfigs)
.setCron(ConfigTestHelpers.getCronString())
.setSize(randomIntBetween(1, 100))
.setPageSize(randomIntBetween(1, 100))
.build();
}

View File

@ -21,7 +21,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -50,7 +50,7 @@ setup:
index_pattern: "foo"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"
@ -96,7 +96,7 @@ setup:
index_pattern: "foo"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"
@ -142,7 +142,7 @@ setup:
index_pattern: "foo"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"

View File

@ -24,7 +24,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -51,7 +51,7 @@ setup:
index_pattern: "foo"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"
@ -107,7 +107,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -133,7 +133,7 @@ setup:
"index_pattern": "bar",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -161,7 +161,7 @@ setup:
index_pattern: "foo"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"
@ -186,7 +186,7 @@ setup:
index_pattern: "bar"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"

View File

@ -32,7 +32,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -83,7 +83,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -142,7 +142,7 @@ setup:
"index_pattern": "foo2",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -167,7 +167,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "different_index",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",

View File

@ -24,7 +24,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -51,7 +51,7 @@ setup:
index_pattern: "foo"
rollup_index: "foo_rollup"
cron: "*/30 * * * * ?"
size: 10
page_size: 10
groups :
date_histogram:
interval: "1h"
@ -85,7 +85,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -112,7 +112,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",
@ -144,7 +144,7 @@ setup:
"foo": "bar"
},
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",

View File

@ -23,7 +23,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -234,7 +234,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -382,7 +382,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "timestamp",
@ -532,7 +532,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "timestamp",

View File

@ -21,7 +21,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",

View File

@ -21,7 +21,7 @@ setup:
"index_pattern": "foo",
"rollup_index": "foo_rollup",
"cron": "*/30 * * * * ?",
"size" :10,
"page_size" :10,
"groups" : {
"date_histogram": {
"field": "the_field",