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/build.xml b/build.xml index d2d5974cd6..f5d2b7d74c 100644 --- a/build.xml +++ b/build.xml @@ -523,7 +523,7 @@ - + diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java index 8a59ca2cda..33f3d23611 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 a04e85c1bc..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) @@ -1740,6 +1742,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 ed10f04773..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; @@ -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 { 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(); }