Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Aiven-specific changes on top of upstream 5.0-rc1 #25

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/cassandra5_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:
pull_request: {}

jobs:
test:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- name: checkout-code
uses: actions/checkout@v4
- name: setup jdk 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: test
continue-on-error: true
run: |
ant test
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@30eadd5010312f995f0d3b3cff7fe2984f69409e
# GitHub action belongs to a github user. Therefore we use the commit SHA that represents release 2.16.1
if: always()
with:
files: "build/test/output/*.xml"
37 changes: 37 additions & 0 deletions src/java/org/apache/cassandra/config/AivenConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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.
*/

package org.apache.cassandra.config;

/**
* A class that contains Aiven-specific configuration properties for the node it runs within.
*/
public class AivenConfig
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VIOLATION: org.apache.cassandra.config.AivenConfig
	at org.apache.cassandra.config.DatabaseDescriptorRefTest.checkViolations(DatabaseDescriptorRefTest.java:438)

{
/**
* Skip streaming when replacing nodes.
* Joining nodes receive their backup from Astacus.
* The exchange of SSTables during replacement is not necessary.
* */
public boolean skip_bootstrap_streaming = false;

/**
* Allow to set replace_address_first_boot in Cassandra properties.
*/
public String replace_address_first_boot = null;
}
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
* <p>
* Properties declared as volatile can be mutated via JMX.
*/
public class Config
public class Config extends AivenConfig
{
private static final Logger logger = LoggerFactory.getLogger(Config.class);

Expand Down
19 changes: 16 additions & 3 deletions src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -2088,9 +2088,12 @@ public static InetAddressAndPort getReplaceAddress()
if (replaceAddress != null)
return InetAddressAndPort.getByName(replaceAddress);

String replaceAddressFirsstBoot = REPLACE_ADDRESS_FIRST_BOOT.getString();
if (replaceAddressFirsstBoot != null)
return InetAddressAndPort.getByName(replaceAddressFirsstBoot);
String replaceAddressFirstBoot = REPLACE_ADDRESS_FIRST_BOOT.getString();
if (replaceAddressFirstBoot != null)
return InetAddressAndPort.getByName(replaceAddressFirstBoot);

if (conf.replace_address_first_boot != null)
return InetAddressAndPort.getByName(conf.replace_address_first_boot);

return null;
}
Expand All @@ -2100,6 +2103,16 @@ public static InetAddressAndPort getReplaceAddress()
}
}

public static boolean skipBootstrapStreaming()
{
return conf.skip_bootstrap_streaming;
}

public static boolean replaceOnFirstBootRequested()
{
return REPLACE_ADDRESS_FIRST_BOOT.getString() != null || conf.replace_address_first_boot != null;
}

public static Collection<String> getReplaceTokens()
{
return tokensFromString(REPLACE_TOKEN.getString());
Expand Down
10 changes: 8 additions & 2 deletions src/java/org/apache/cassandra/service/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@
import static org.apache.cassandra.config.CassandraRelevantProperties.PAXOS_REPAIR_ON_TOPOLOGY_CHANGE_RETRY_DELAY_SECONDS;
import static org.apache.cassandra.config.CassandraRelevantProperties.REPLACEMENT_ALLOW_EMPTY;
import static org.apache.cassandra.config.CassandraRelevantProperties.REPLACE_ADDRESS;
import static org.apache.cassandra.config.CassandraRelevantProperties.REPLACE_ADDRESS_FIRST_BOOT;
import static org.apache.cassandra.config.CassandraRelevantProperties.RESET_BOOTSTRAP_PROGRESS;
import static org.apache.cassandra.config.CassandraRelevantProperties.START_GOSSIP;
import static org.apache.cassandra.config.CassandraRelevantProperties.TEST_WRITE_SURVEY;
Expand Down Expand Up @@ -1055,7 +1054,7 @@ public boolean isReplacing()
if (replacing)
return true;

if (REPLACE_ADDRESS_FIRST_BOOT.getString() != null && SystemKeyspace.bootstrapComplete())
if (DatabaseDescriptor.replaceOnFirstBootRequested() && SystemKeyspace.bootstrapComplete())
{
logger.info("Replace address on the first boot requested; this node is already bootstrapped");
return false;
Expand Down Expand Up @@ -2144,6 +2143,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
Loading