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" diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index fcf0ff3a3f..ec9c27427d 100644 --- a/src/java/org/apache/cassandra/config/Config.java +++ b/src/java/org/apache/cassandra/config/Config.java @@ -123,6 +123,9 @@ 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; + 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 8b8e4e86ff..7db91d17f2 100644 --- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java +++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java @@ -1741,6 +1741,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) @@ -1749,6 +1751,16 @@ else if (System.getProperty(Config.PROPERTY_PREFIX + "replace_address_first_boot } } + 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 1f34a2a273..7e25ecbc9c 100644 --- a/src/java/org/apache/cassandra/service/StorageService.java +++ b/src/java/org/apache/cassandra/service/StorageService.java @@ -1029,7 +1029,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; @@ -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 { diff --git a/src/java/org/apache/cassandra/transport/messages/StartupMessage.java b/src/java/org/apache/cassandra/transport/messages/StartupMessage.java index f3948f4e05..108d34ffe1 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(); }