Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,13 @@ public enum DefaultDriverOption implements DriverOption {
*/
NETTY_DAEMON("advanced.netty.daemon"),

/**
* @deprecated DataStax Astra secure connect bundles are no longer supported. Configuring this
* option causes session creation to fail.
*/
@Deprecated
CLOUD_SECURE_CONNECT_BUNDLE("basic.cloud.secure-connect-bundle"),

/**
* Whether the slow replica avoidance should be enabled in the default LBP.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,10 @@ public String toString() {
/** Whether the threads created by the driver should be daemon threads. */
public static final TypedDriverOption<Boolean> NETTY_DAEMON =
new TypedDriverOption<>(DefaultDriverOption.NETTY_DAEMON, GenericType.BOOLEAN);
/** @deprecated DataStax Astra secure connect bundles are no longer supported. */
@Deprecated
public static final TypedDriverOption<String> CLOUD_SECURE_CONNECT_BUNDLE =
new TypedDriverOption<>(DefaultDriverOption.CLOUD_SECURE_CONNECT_BUNDLE, GenericType.STRING);
/** Whether the slow replica avoidance should be enabled in the default LBP. */
public static final TypedDriverOption<Boolean> LOAD_BALANCING_POLICY_SLOW_AVOIDANCE =
new TypedDriverOption<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.net.InetSocketAddress;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Expand Down Expand Up @@ -169,6 +170,17 @@ public SslEngineFactory getSslEngineFactory() {
return sslEngineFactory;
}

/**
* Returns {@code null} because no cloud proxy is configured.
*
* @deprecated DataStax Astra cloud proxy support has been removed.
*/
@Deprecated
@Nullable
public InetSocketAddress getCloudProxyAddress() {
Comment thread
dkropachev marked this conversation as resolved.
return null;
}

@Nullable
public UUID getStartupClientId() {
return startupClientId;
Expand Down Expand Up @@ -390,6 +402,14 @@ public Builder withSslEngineFactory(@Nullable SslEngineFactory sslEngineFactory)
return this;
}

/** @deprecated DataStax Astra cloud proxy support has been removed. */
@Deprecated
@NonNull
public Builder withCloudProxyAddress(@Nullable InetSocketAddress cloudAddress) {
throw new UnsupportedOperationException(
"DataStax Astra cloud proxy support has been removed; use Scylla client routes instead");
}

@NonNull
public Builder withStartupClientId(@Nullable UUID startupClientId) {
this.startupClientId = startupClientId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@
import com.datastax.oss.driver.internal.core.util.concurrent.CompletableFutures;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.URL;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletionStage;
import java.util.function.Predicate;
import javax.net.ssl.SSLContext;
Expand All @@ -82,6 +86,9 @@
@NotThreadSafe
public abstract class SessionBuilder<SelfT extends SessionBuilder, SessionT> {

/** @deprecated DataStax Astra secure connect bundle support has been removed. */
@Deprecated public static final String ASTRA_PAYLOAD_KEY = "traceparent";

private static final Logger LOG = LoggerFactory.getLogger(SessionBuilder.class);

@SuppressWarnings("unchecked")
Expand All @@ -90,9 +97,45 @@ public abstract class SessionBuilder<SelfT extends SessionBuilder, SessionT> {
protected DriverConfigLoader configLoader;
protected Set<EndPoint> programmaticContactPoints = new HashSet<>();
protected CqlIdentifier keyspace;
/** @deprecated DataStax Astra secure connect bundle support has been removed. */
@Deprecated protected Callable<InputStream> cloudConfigInputStream;

protected ProgrammaticArguments.Builder programmaticArgumentsBuilder =
ProgrammaticArguments.builder();

/** @deprecated DataStax Astra secure connect bundle support has been removed. */
@Deprecated
@NonNull
public SelfT withCloudSecureConnectBundle(@NonNull Path cloudConfigPath) {
throw unsupportedAstra();
}

/** @deprecated DataStax Astra secure connect bundle support has been removed. */
@Deprecated
@NonNull
public SelfT withCloudSecureConnectBundle(@NonNull URL cloudConfigUrl) {
throw unsupportedAstra();
}

/** @deprecated DataStax Astra secure connect bundle support has been removed. */
@Deprecated
@NonNull
public SelfT withCloudSecureConnectBundle(@NonNull InputStream cloudConfigInputStream) {
throw unsupportedAstra();
}

/** @deprecated DataStax Astra cloud proxy support has been removed. */
@Deprecated
@NonNull
public SelfT withCloudProxyAddress(@Nullable InetSocketAddress cloudProxyAddress) {
throw unsupportedAstra();
}

private static UnsupportedOperationException unsupportedAstra() {
return new UnsupportedOperationException(
"DataStax Astra support has been removed; use Scylla contact points or client routes instead");
}

/**
* Sets the configuration loader to use.
*
Expand Down Expand Up @@ -762,6 +805,10 @@ protected final CompletionStage<CqlSession> buildDefaultSessionAsync() {
: defaultConfigLoader(programmaticArguments.getClassLoader());

DriverExecutionProfile defaultConfig = configLoader.getInitialConfig().getDefaultProfile();
if (cloudConfigInputStream != null
|| defaultConfig.isDefined(DefaultDriverOption.CLOUD_SECURE_CONNECT_BUNDLE)) {
throw unsupportedAstra();
}
List<String> configContactPoints =
defaultConfig.getStringList(DefaultDriverOption.CONTACT_POINTS, Collections.emptyList());

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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 com.datastax.oss.driver.api.core.session;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.CqlSessionBuilder;
import com.datastax.oss.driver.api.core.config.DefaultDriverOption;
import com.datastax.oss.driver.api.core.config.DriverConfigLoader;
import com.datastax.oss.driver.api.core.config.OptionsMap;
import com.datastax.oss.driver.api.core.config.TypedDriverOption;
import com.datastax.oss.driver.api.core.context.DriverContext;
import java.io.ByteArrayInputStream;
import java.net.InetSocketAddress;
import java.net.URL;
import java.nio.file.Paths;
import org.junit.Test;

@SuppressWarnings("deprecation")
public class AstraApiCompatibilityTest {

@Test
public void should_retain_deprecated_builder_signatures_and_reject_astra() throws Exception {
assertThatThrownBy(() -> CqlSession.builder().withCloudSecureConnectBundle(Paths.get("bundle")))
.isInstanceOf(UnsupportedOperationException.class)
.hasMessageContaining("Astra");
assertThatThrownBy(
() -> CqlSession.builder().withCloudSecureConnectBundle(new URL("file:/bundle")))
.isInstanceOf(UnsupportedOperationException.class);
assertThatThrownBy(
() ->
CqlSession.builder()
.withCloudSecureConnectBundle(new ByteArrayInputStream(new byte[0])))
.isInstanceOf(UnsupportedOperationException.class);
assertThatThrownBy(
() -> CqlSession.builder().withCloudProxyAddress(new InetSocketAddress(9042)))
.isInstanceOf(UnsupportedOperationException.class);
}

@Test
public void should_retain_deprecated_argument_and_option_signatures() {
assertThat(TypedDriverOption.CLOUD_SECURE_CONNECT_BUNDLE.getRawOption())
.isSameAs(DefaultDriverOption.CLOUD_SECURE_CONNECT_BUNDLE);
assertThatThrownBy(
() ->
ProgrammaticArguments.builder().withCloudProxyAddress(new InetSocketAddress(9042)))
.isInstanceOf(UnsupportedOperationException.class);
assertThat(ProgrammaticArguments.builder().build().getCloudProxyAddress()).isNull();
}

@Test
public void should_reject_configured_astra_bundle_before_connecting() {
OptionsMap options = OptionsMap.driverDefaults();
options.put(TypedDriverOption.CLOUD_SECURE_CONNECT_BUNDLE, "bundle.zip");

assertThatThrownBy(
() ->
CqlSession.builder()
.withConfigLoader(DriverConfigLoader.fromMap(options))
.buildAsync()
.toCompletableFuture()
.join())
.hasCauseInstanceOf(UnsupportedOperationException.class)
.hasMessageContaining("Astra");
}

@Test
public void should_reject_legacy_astra_bundle_stream_before_connecting() {
assertThatThrownBy(
() ->
new LegacyAstraSessionBuilder()
.withConfigLoader(DriverConfigLoader.fromMap(OptionsMap.driverDefaults()))
.buildAsync()
.toCompletableFuture()
.join())
.hasCauseInstanceOf(UnsupportedOperationException.class)
.hasMessageContaining("Astra");
}

private static class LegacyAstraSessionBuilder extends CqlSessionBuilder {
private LegacyAstraSessionBuilder() {
cloudConfigInputStream =
() -> {
throw new AssertionError("The unsupported bundle stream must not be opened");
};
}

@Override
protected DriverContext buildContext(
DriverConfigLoader configLoader, ProgrammaticArguments programmaticArguments) {
throw new AssertionError("The driver context must not be created for an unsupported bundle");
}
}
}
25 changes: 13 additions & 12 deletions upgrade_guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ standard SASL PLAIN authentication; DSE proxy authorization and GSSAPI have no r

#### DataStax Astra secure-connect-bundle support was removed

This release intentionally removes the DataStax Astra secure-connect-bundle integration and its
public API. The following members are no longer available:
This release removes the DataStax Astra secure-connect-bundle integration. The following public
members remain as deprecated compatibility stubs:

- `SessionBuilder.withCloudSecureConnectBundle(Path)`
- `SessionBuilder.withCloudSecureConnectBundle(URL)`
Expand All @@ -97,16 +97,17 @@ public API. The following members are no longer available:
- `DefaultDriverOption.CLOUD_SECURE_CONNECT_BUNDLE`
- `TypedDriverOption.CLOUD_SECURE_CONNECT_BUNDLE`

The old `datastax-java-driver.basic.cloud.secure-connect-bundle` configuration key is now an
unknown option and no longer supplies connection information. If that was the only connection
setting, the resulting configuration contains no contact points, so the driver falls back to its
default contact point, `127.0.0.1:9042`.

This is an intentional binary- and source-compatibility break. This driver no longer has built-in
support for connecting to DataStax Astra. Plain contact points cannot replace an Astra secure
connect bundle because the bundle also provides TLS identity and trust material, metadata, and SNI
proxy routing. Applications that need Astra must use 4.19.2.2 or an earlier release that supports
secure connect bundles, or migrate to an Astra-compatible driver.
The builder methods throw `UnsupportedOperationException` when called.
`ProgrammaticArguments.getCloudProxyAddress()` returns `null`, preserving reads of the absent proxy.
Setting the protected `cloudConfigInputStream` field or the
`datastax-java-driver.basic.cloud.secure-connect-bundle` configuration key causes session creation
to fail before connecting. The constants remain available for source and binary compatibility but
do not restore Astra support.

This driver no longer has built-in support for connecting to DataStax Astra. Plain contact points
cannot replace an Astra secure connect bundle because the bundle also provides TLS identity and
trust material, metadata, and SNI proxy routing. Applications that need Astra must use 4.19.2.2 or
an earlier release that supports secure connect bundles, or migrate to an Astra-compatible driver.

For ScyllaDB deployments, configure explicit `basic.contact-points` or programmatic contact points.
For supported ScyllaDB private-endpoint deployments, use
Expand Down
Loading