From 41e8f584c19f74f3817a36ebc78156a3aaa9b90b Mon Sep 17 00:00:00 2001 From: Dan Hermann Date: Tue, 23 Jun 2020 07:45:27 -0500 Subject: [PATCH] [7.x] Minimum node version check before creating data stream (#58424) --- .../cluster/metadata/MetadataCreateDataStreamService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateDataStreamService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateDataStreamService.java index a047c32e1bf..a4b1bf1b1d5 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateDataStreamService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataCreateDataStreamService.java @@ -20,6 +20,7 @@ package org.elasticsearch.cluster.metadata; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.create.CreateIndexClusterStateUpdateRequest; import org.elasticsearch.action.support.ActiveShardCount; @@ -125,6 +126,10 @@ public class MetadataCreateDataStreamService { static ClusterState createDataStream(MetadataCreateIndexService metadataCreateIndexService, ClusterState currentState, 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)) { throw new IllegalArgumentException("data_stream [" + request.name + "] already exists"); }