mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Fail with a better error when if there are no ingest nodes (#48272)
when executing enrich execute policy api.
This commit is contained in:
parent
0ec0ab64c9
commit
bbe50eca72
@ -62,6 +62,12 @@ public class TransportExecuteEnrichPolicyAction
|
|||||||
@Override
|
@Override
|
||||||
protected void masterOperation(ExecuteEnrichPolicyAction.Request request, ClusterState state,
|
protected void masterOperation(ExecuteEnrichPolicyAction.Request request, ClusterState state,
|
||||||
ActionListener<ExecuteEnrichPolicyAction.Response> listener) {
|
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()) {
|
if (request.isWaitForCompletion()) {
|
||||||
executor.runPolicy(request, new ActionListener<ExecuteEnrichPolicyStatus>() {
|
executor.runPolicy(request, new ActionListener<ExecuteEnrichPolicyStatus>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,6 +134,19 @@ public class EnrichMultiNodeIT extends ESIntegTestCase {
|
|||||||
enrich(keys, ingestOnlyNode);
|
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) {
|
private static void enrich(List<String> keys, String coordinatingNode) {
|
||||||
int numDocs = 256;
|
int numDocs = 256;
|
||||||
BulkRequest bulkRequest = new BulkRequest("my-index");
|
BulkRequest bulkRequest = new BulkRequest("my-index");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user