Skip to content

Commit

Permalink
Merge pull request #21 from aiven/aiven-4.1.3-test
Browse files Browse the repository at this point in the history
Apply Aiven-specific changes on top of upstream 4.1.3
  • Loading branch information
sjamgade authored Nov 21, 2023
2 parents 2a4cd36 + 158a177 commit bca8676
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 4 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@
<license name="The Apache Software License, Version 2.0" url="https://www.apache.org/licenses/LICENSE-2.0.txt"/>
<scm connection="${scm.connection}" developerConnection="${scm.developerConnection}" url="${scm.url}"/>
<dependencyManagement>
<dependency groupId="org.xerial.snappy" artifactId="snappy-java" version="1.1.10.1"/>
<dependency groupId="org.xerial.snappy" artifactId="snappy-java" version="1.1.10.4"/>
<dependency groupId="org.lz4" artifactId="lz4-java" version="1.8.0"/>
<dependency groupId="com.ning" artifactId="compress-lzf" version="0.8.4" scope="provided"/>
<dependency groupId="com.github.luben" artifactId="zstd-jni" version="1.5.5-1"/>
Expand Down
3 changes: 3 additions & 0 deletions src/java/org/apache/cassandra/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ public static Set<String> 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");

Expand Down
12 changes: 12 additions & 0 deletions src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<String> getReplaceTokens()
{
return tokensFromString(System.getProperty(Config.PROPERTY_PREFIX + "replace_token", null));
Expand Down
9 changes: 8 additions & 1 deletion src/java/org/apache/cassandra/service/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2034,6 +2034,13 @@ public boolean bootstrap(final Collection<Token> tokens, long bootstrapTimeoutMi
invalidateLocalRanges();
repairPaxosForTopologyChange("bootstrap");

if (DatabaseDescriptor.skipBootstrapStreaming())
{
bootstrapFinished();
logger.info("Bootstrap skipped for tokens {}", tokens);
return true;
}

Future<StreamState> bootstrapStream = startBootstrap(tokens);
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit bca8676

Please sign in to comment.