Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail with a better error when if there are no ingest nodes #48272

Merged
merged 2 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ protected ExecuteEnrichPolicyAction.Response read(StreamInput in) throws IOExcep
@Override
protected void masterOperation(Task task, ExecuteEnrichPolicyAction.Request request, ClusterState state,
ActionListener<ExecuteEnrichPolicyAction.Response> listener) {
if (state.getNodes().getIngestNodes().isEmpty()) {
// if we don't fail here then reindex will fail with a more complicated error.
// (EnrichPolicyRunner uses a pipeline with reindex)
throw new IllegalStateException("no ingest nodes in this cluster");
}

if (request.isWaitForCompletion()) {
executor.runPolicy(request, new ActionListener<>() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,19 @@ public void testEnrichDedicatedIngestNode() {
enrich(keys, ingestOnlyNode);
}

public void testEnrichNoIngestNodes() {
Settings settings = Settings.builder()
.put(Node.NODE_MASTER_SETTING.getKey(), true)
.put(Node.NODE_DATA_SETTING.getKey(), true)
.put(Node.NODE_INGEST_SETTING.getKey(), false)
.build();
internalCluster().startNode(settings);

createSourceIndex(64);
Exception e = expectThrows(IllegalStateException.class, EnrichMultiNodeIT::createAndExecutePolicy);
assertThat(e.getMessage(), equalTo("no ingest nodes in this cluster"));
}

private static void enrich(List<String> keys, String coordinatingNode) {
int numDocs = 256;
BulkRequest bulkRequest = new BulkRequest("my-index");
Expand Down