From 1f3138796a184be25a3f3e7bad6b8eb890d6483c Mon Sep 17 00:00:00 2001 From: Denis Potapov Date: Thu, 12 Oct 2023 15:02:22 +0200 Subject: [PATCH] Optionally skip streaming when replacing nodes The data will be provided by Astacus, streaming from other nodes is not necessary. --- src/java/org/apache/cassandra/config/Config.java | 2 ++ .../org/apache/cassandra/config/DatabaseDescriptor.java | 5 +++++ src/java/org/apache/cassandra/service/StorageService.java | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index fcf0ff3a3f..634bfe3719 100644 --- a/src/java/org/apache/cassandra/config/Config.java +++ b/src/java/org/apache/cassandra/config/Config.java @@ -123,6 +123,8 @@ public static Set splitCommaDelimited(String src) /** Triggers automatic allocation of tokens if set, based on the provided replica count for a datacenter */ public Integer allocate_tokens_for_local_replication_factor = null; + public boolean skip_bootstrap_streaming = false; + @Replaces(oldName = "native_transport_idle_timeout_in_ms", converter = Converters.MILLIS_DURATION_LONG, deprecated = true) public DurationSpec.LongMillisecondsBound native_transport_idle_timeout = new DurationSpec.LongMillisecondsBound("0ms"); diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java index 8b8e4e86ff..75f20eaab5 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -1749,6 +1749,11 @@ else if (System.getProperty(Config.PROPERTY_PREFIX + "replace_address_first_boot } } + public static boolean skipBootstrapStreaming() + { + return conf.skip_bootstrap_streaming; + } + public static Collection getReplaceTokens() { return tokensFromString(System.getProperty(Config.PROPERTY_PREFIX + "replace_token", null)); diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java index 1f34a2a273..300df7fa01 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -2060,6 +2060,13 @@ public boolean bootstrap(final Collection tokens, long bootstrapTimeoutMi invalidateLocalRanges(); repairPaxosForTopologyChange("bootstrap"); + if (DatabaseDescriptor.skipBootstrapStreaming()) + { + bootstrapFinished(); + logger.info("Bootstrap skipped for tokens {}", tokens); + return true; + } + Future bootstrapStream = startBootstrap(tokens); try {