Skip to content

Commit

Permalink
[Test] Wait for no relocating shards in indices.stats/13_fields tests
Browse files Browse the repository at this point in the history
MixedClusterClientYamlTestSuiteIT sometimes fails when executing the
indices.stats/13_fields/* REST tests. It does not reproduce locally
but the execution logs show that it failed when a shard is relocating
during the set up execution. This commit change the set up so that it
now waits for all shards to be active before executing the tests.

closes #26732, #27146
  • Loading branch information
tlrx committed Jan 17, 2018
1 parent acdc164 commit 96aaca8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ setup:
- do:
indices.create:
index: test1
wait_for_active_shards: all
body:
mappings:
bar:
Expand All @@ -20,6 +21,12 @@ setup:
fields:
completion:
type: completion

- do:
cluster.health:
wait_for_active_shards: all
wait_for_no_relocating_shards: true

- do:
index:
index: test1
Expand All @@ -29,10 +36,10 @@ setup:

- do:
index:
index: test2
type: baz
id: 1
body: { "bar": "bar", "baz": "baz" }
index: test1
type: bar
id: 2
body: { "bar": "foo", "baz": "foo" }

- do:
indices.refresh: {}
Expand All @@ -57,18 +64,17 @@ setup:
completion:
field: baz.completion

- do:
indices.refresh: {}

- do:
search:
sort: bar,baz
body:
sort: [ "bar", "baz" ]

---
"Fields - blank":
- do:
indices.stats: {}

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields
- gt: { _all.total.completion.size_in_bytes: 0 }
Expand All @@ -79,6 +85,7 @@ setup:
- do:
indices.stats: { fields: bar }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
Expand All @@ -90,6 +97,7 @@ setup:
- do:
indices.stats: { fields: "bar,baz.completion" }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
Expand All @@ -102,6 +110,7 @@ setup:
- do:
indices.stats: { fields: "*" }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.baz.memory_size_in_bytes: 0 }
Expand All @@ -114,6 +123,7 @@ setup:
- do:
indices.stats: { fields: "bar*" }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
Expand All @@ -126,6 +136,7 @@ setup:
- do:
indices.stats: { fields: "bar*", metric: _all }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
Expand All @@ -138,6 +149,7 @@ setup:
- do:
indices.stats: { fields: "bar*", metric: fielddata }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
Expand All @@ -148,6 +160,7 @@ setup:
- do:
indices.stats: { fields: "bar*", metric: completion }

- match: { _shards.failed: 0}
- is_false: _all.total.fielddata
- gt: { _all.total.completion.size_in_bytes: 0 }
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
Expand All @@ -158,6 +171,7 @@ setup:
- do:
indices.stats: { fields: "bar*" , metric: [ completion, fielddata, search ]}

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
Expand All @@ -170,6 +184,7 @@ setup:
- do:
indices.stats: { fielddata_fields: bar }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
- is_false: _all.total.completion.fields
Expand All @@ -179,6 +194,7 @@ setup:
- do:
indices.stats: { fielddata_fields: "bar,baz,baz.completion" }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.baz.memory_size_in_bytes: 0 }
- is_false: _all.total.completion.fields
Expand All @@ -188,6 +204,7 @@ setup:
- do:
indices.stats: { fielddata_fields: "*" }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- gt: { _all.total.fielddata.fields.baz.memory_size_in_bytes: 0 }
- is_false: _all.total.completion.fields
Expand All @@ -197,6 +214,7 @@ setup:
- do:
indices.stats: { fielddata_fields: "*r" }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
- is_false: _all.total.completion.fields
Expand All @@ -207,6 +225,7 @@ setup:
- do:
indices.stats: { fielddata_fields: "*r", metric: _all }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
- is_false: _all.total.completion.fields
Expand All @@ -216,6 +235,7 @@ setup:
- do:
indices.stats: { fielddata_fields: "*r", metric: fielddata }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
- is_false: _all.total.completion.fields
Expand All @@ -226,6 +246,7 @@ setup:
- do:
indices.stats: { fielddata_fields: "*r", metric: [ fielddata, search] }

- match: { _shards.failed: 0}
- gt: { _all.total.fielddata.fields.bar.memory_size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields.baz
- is_false: _all.total.completion.fields
Expand All @@ -236,6 +257,7 @@ setup:
- do:
indices.stats: { completion_fields: bar.completion }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- is_false: _all.total.completion.fields.baz\.completion
- is_false: _all.total.fielddata.fields
Expand All @@ -245,6 +267,7 @@ setup:
- do:
indices.stats: { completion_fields: "bar.completion,baz,baz.completion" }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- gt: { _all.total.completion.fields.baz\.completion.size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields
Expand All @@ -254,6 +277,7 @@ setup:
- do:
indices.stats: { completion_fields: "*" }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- gt: { _all.total.completion.fields.baz\.completion.size_in_bytes: 0 }
- is_false: _all.total.fielddata.fields
Expand All @@ -263,6 +287,7 @@ setup:
- do:
indices.stats: { completion_fields: "*r*" }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- is_false: _all.total.completion.fields.baz\.completion
- is_false: _all.total.fielddata.fields
Expand All @@ -272,6 +297,7 @@ setup:
- do:
indices.stats: { completion_fields: "*r*", metric: _all }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- is_false: _all.total.completion.fields.baz\.completion
- is_false: _all.total.fielddata.fields
Expand All @@ -281,6 +307,7 @@ setup:
- do:
indices.stats: { completion_fields: "*r*", metric: completion }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- is_false: _all.total.completion.fields.baz\.completion
- is_false: _all.total.fielddata.fields
Expand All @@ -290,6 +317,7 @@ setup:
- do:
indices.stats: { completion_fields: "*r*", metric: [ completion, search ] }

- match: { _shards.failed: 0}
- gt: { _all.total.completion.fields.bar\.completion.size_in_bytes: 0 }
- is_false: _all.total.completion.fields.baz\.completion
- is_false: _all.total.fielddata.fields
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class IndexFieldDataService extends AbstractIndexComponent implements Clo
case "none":
return s;
default:
throw new IllegalArgumentException("failed to parse [" + s + "] must be one of [node,node]");
throw new IllegalArgumentException("failed to parse [" + s + "] must be one of [node,none]");
}
}, Property.IndexScope);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@

public class ShardFieldData implements IndexFieldDataCache.Listener {

final CounterMetric evictionsMetric = new CounterMetric();
final CounterMetric totalMetric = new CounterMetric();
final ConcurrentMap<String, CounterMetric> perFieldTotals = ConcurrentCollections.newConcurrentMap();
private final CounterMetric evictionsMetric = new CounterMetric();
private final CounterMetric totalMetric = new CounterMetric();
private final ConcurrentMap<String, CounterMetric> perFieldTotals = ConcurrentCollections.newConcurrentMap();

public FieldDataStats stats(String... fields) {
ObjectLongHashMap<String> fieldTotals = null;
Expand Down

0 comments on commit 96aaca8

Please sign in to comment.