Skip to content

Commit

Permalink
Avoid running simulate pipeline request on coordinating only node.
Browse files Browse the repository at this point in the history
Relates to #79074
  • Loading branch information
martijnvg committed Nov 28, 2021
1 parent 6aa32dd commit bc39f5a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.elasticsearch.action.ingest.SimulatePipelineRequest;
import org.elasticsearch.action.ingest.SimulatePipelineResponse;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings;
Expand Down Expand Up @@ -428,7 +429,10 @@ private SimulateDocumentBaseResult simulatePipeline() throws IOException {
}
SimulatePipelineRequest simulateRequest = new SimulatePipelineRequest(bytes, XContentType.JSON);
simulateRequest.setId("_id");
SimulatePipelineResponse simulateResponse = client().admin().cluster().simulatePipeline(simulateRequest).actionGet();
// Avoid executing on a coordinating only node, because databases are not available there and geoip processor won't do any lookups.
// (some test seeds repeatedly hit such nodes causing failures)
Client client = dataNodeClient();
SimulatePipelineResponse simulateResponse = client.admin().cluster().simulatePipeline(simulateRequest).actionGet();
assertThat(simulateResponse.getPipelineId(), equalTo("_id"));
assertThat(simulateResponse.getResults().size(), equalTo(1));
return (SimulateDocumentBaseResult) simulateResponse.getResults().get(0);
Expand Down

0 comments on commit bc39f5a

Please sign in to comment.