[7.x] Minimum node version check before creating data stream (#58424)
This commit is contained in:
parent
943efb78fd
commit
41e8f584c1
|
@ -20,6 +20,7 @@ package org.elasticsearch.cluster.metadata;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.elasticsearch.Version;
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.admin.indices.create.CreateIndexClusterStateUpdateRequest;
|
import org.elasticsearch.action.admin.indices.create.CreateIndexClusterStateUpdateRequest;
|
||||||
import org.elasticsearch.action.support.ActiveShardCount;
|
import org.elasticsearch.action.support.ActiveShardCount;
|
||||||
|
@ -125,6 +126,10 @@ public class MetadataCreateDataStreamService {
|
||||||
static ClusterState createDataStream(MetadataCreateIndexService metadataCreateIndexService,
|
static ClusterState createDataStream(MetadataCreateIndexService metadataCreateIndexService,
|
||||||
ClusterState currentState,
|
ClusterState currentState,
|
||||||
CreateDataStreamClusterStateUpdateRequest request) throws Exception {
|
CreateDataStreamClusterStateUpdateRequest request) throws Exception {
|
||||||
|
if (currentState.nodes().getMinNodeVersion().before(Version.V_7_9_0)) {
|
||||||
|
throw new IllegalStateException("data streams require minimum node version of " + Version.V_7_9_0);
|
||||||
|
}
|
||||||
|
|
||||||
if (currentState.metadata().dataStreams().containsKey(request.name)) {
|
if (currentState.metadata().dataStreams().containsKey(request.name)) {
|
||||||
throw new IllegalArgumentException("data_stream [" + request.name + "] already exists");
|
throw new IllegalArgumentException("data_stream [" + request.name + "] already exists");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue