From 78c22fead028f92dd08eac5f92e60f2e1654aad4 Mon Sep 17 00:00:00 2001 From: Denis Potapov Date: Thu, 12 Oct 2023 11:13:05 +0200 Subject: [PATCH 1/5] Add Github Action running tests --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..b66d6c05f0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +name: Build cassandra + +# Default to read-only access to all APIs. +permissions: read-all + +on: + push: {} + pull_request: {} + +jobs: + test: + runs-on: ubuntu-latest + permissions: + checks: write + pull-requests: write + steps: + - name: checkout-code + uses: actions/checkout@v3 + - name: setup jdk 8 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '8' + - name: test + continue-on-error: true + run: | + ant test + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + if: always() + with: + files: "build/test/output/*.xml" From d9b7a8c4010dcd05a8c3c66bff44b5eeca0f40f5 Mon Sep 17 00:00:00 2001 From: Denis Potapov Date: Thu, 12 Oct 2023 15:02:22 +0200 Subject: [PATCH 2/5] 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 8a59ca2cda..7468ae5eea 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 a04e85c1bc..97faaaee8e 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -1740,6 +1740,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 ed10f04773..b209740c3c 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -2034,6 +2034,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 { From 2d95192226a4df3370e83f4b1c566fd321e21521 Mon Sep 17 00:00:00 2001 From: Denis Potapov Date: Thu, 12 Oct 2023 15:47:26 +0200 Subject: [PATCH 3/5] Add replace_address_first_boot to yaml config It's more convenient to set it there in Astacus. Option semantics is preserved, the value specified in Java properties has priority. --- src/java/org/apache/cassandra/config/Config.java | 1 + .../org/apache/cassandra/config/DatabaseDescriptor.java | 7 +++++++ src/java/org/apache/cassandra/service/StorageService.java | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index 7468ae5eea..33f3d23611 100644 --- a/src/java/org/apache/cassandra/config/Config.java +++ b/src/java/org/apache/cassandra/config/Config.java @@ -124,6 +124,7 @@ public static Set splitCommaDelimited(String src) public Integer allocate_tokens_for_local_replication_factor = null; public boolean skip_bootstrap_streaming = false; + public String replace_address_first_boot = null; @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 97faaaee8e..9d5b544420 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -1732,6 +1732,8 @@ public static InetAddressAndPort getReplaceAddress() return InetAddressAndPort.getByName(System.getProperty(Config.PROPERTY_PREFIX + "replace_address", null)); else if (System.getProperty(Config.PROPERTY_PREFIX + "replace_address_first_boot", null) != null) return InetAddressAndPort.getByName(System.getProperty(Config.PROPERTY_PREFIX + "replace_address_first_boot", null)); + else if (conf.replace_address_first_boot != null) + return InetAddressAndPort.getByName(conf.replace_address_first_boot); return null; } catch (UnknownHostException e) @@ -1745,6 +1747,11 @@ public static boolean skipBootstrapStreaming() return conf.skip_bootstrap_streaming; } + public static boolean replaceOnFirstBootRequested() + { + return System.getProperty("cassandra.replace_address_first_boot", null) != null || conf.replace_address_first_boot != null; + } + 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 b209740c3c..d3ccb43bec 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -994,7 +994,7 @@ public boolean isReplacing() if (replacing) return true; - if (System.getProperty("cassandra.replace_address_first_boot", null) != null && SystemKeyspace.bootstrapComplete()) + if (DatabaseDescriptor.replaceOnFirstBootRequested() && SystemKeyspace.bootstrapComplete()) { logger.info("Replace address on first boot requested; this node is already bootstrapped"); return false; From 1f2b1f5cae39108c2e7ae5b304a94026fb83f0ba Mon Sep 17 00:00:00 2001 From: Denis Potapov Date: Thu, 12 Oct 2023 15:51:32 +0200 Subject: [PATCH 4/5] Stop advertising Aiven custom authenticator We decorate standard PasswordAuthenticator with a few platform specific features, that don't change the externally observable behavior - so it's absolutely compatible with PasswordAuthenticator. A few tools and client libraries do not support custom authenticators. For example: ZDM Proxy. They fail whenever they see anything but PasswordAuthenticator nevertheless they are in fact completely compatible. So we want to stop advertising our custom authenticator and pretend that it's a standard PasswordAuthenticator. --- .../cassandra/transport/messages/StartupMessage.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/cassandra/transport/messages/StartupMessage.java b/src/java/org/apache/cassandra/transport/messages/StartupMessage.java index 37afb22868..e76ee8131e 100644 --- a/src/java/org/apache/cassandra/transport/messages/StartupMessage.java +++ b/src/java/org/apache/cassandra/transport/messages/StartupMessage.java @@ -118,8 +118,12 @@ else if (compression.equals("lz4")) clientState.setDriverVersion(options.get(DRIVER_VERSION)); } - if (DatabaseDescriptor.getAuthenticator().requireAuthentication()) - return new AuthenticateMessage(DatabaseDescriptor.getAuthenticator().getClass().getName()); + if (DatabaseDescriptor.getAuthenticator().requireAuthentication()) { + String authenticatorClassName = DatabaseDescriptor.getAuthenticator().getClass().getName(); + if (authenticatorClassName.equals("io.aiven.cassandra.auth.AivenAuthenticator")) + authenticatorClassName = "org.apache.cassandra.auth.PasswordAuthenticator"; + return new AuthenticateMessage(authenticatorClassName); + } else return new ReadyMessage(); } From 158a1778559fb07819b4eb586d4436d2d51ab20c Mon Sep 17 00:00:00 2001 From: Alan Franzoni Date: Mon, 25 Sep 2023 18:42:09 +0200 Subject: [PATCH 5/5] Update snappy-java to latest version --- build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.xml b/build.xml index d2d5974cd6..f5d2b7d74c 100644 --- a/build.xml +++ b/build.xml @@ -523,7 +523,7 @@ - +