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

Bump Spark Cassandra Connector to 3.4.1 #142

Merged
merged 2 commits into from
Feb 5, 2025
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
13 changes: 8 additions & 5 deletions jaeger-spark-dependencies-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<artifactId>jaeger-spark-dependencies-cassandra</artifactId>

<properties>
<spark-cassandra-connector.version>2.4.3</spark-cassandra-connector.version>
<spark-cassandra-connector.version>3.4.1</spark-cassandra-connector.version>
</properties>

<dependencies>
Expand All @@ -47,7 +47,7 @@

<dependency>
<groupId>com.datastax.spark</groupId>
<artifactId>spark-cassandra-connector-unshaded_${version.scala.binary}</artifactId>
<artifactId>spark-cassandra-connector_${version.scala.binary}</artifactId>
<version>${spark-cassandra-connector.version}</version>
</dependency>

Expand All @@ -73,11 +73,14 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.codahale.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.0.2</version>
<groupId>org.testcontainers</groupId>
<artifactId>cassandra</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public static final class Builder {
String localDc = Utils.getEnv("CASSANDRA_LOCAL_DC", null);
// local[*] master lets us run & test the job locally without setting a Spark cluster
String sparkMaster = Utils.getEnv("SPARK_MASTER", "local[*]");
String username = Utils.getEnv("CASSANDRA_USERNAME", "");
String password = Utils.getEnv("CASSANDRA_PASSWORD", "");
// needed when not in local mode
String[] jars;

Expand All @@ -88,8 +90,6 @@ public static final class Builder {
System.getProperty("javax.net.ssl.keyStore", ""));
sparkProperties.put("spark.cassandra.connection.ssl.keyStore.password",
System.getProperty("javax.net.ssl.keyStorePassword", ""));
sparkProperties.put("spark.cassandra.auth.username", Utils.getEnv("CASSANDRA_USERNAME", ""));
sparkProperties.put("spark.cassandra.auth.password", Utils.getEnv("CASSANDRA_PASSWORD", ""));
}

/** When set, this indicates which jars to distribute to the cluster. */
Expand All @@ -105,6 +105,20 @@ public Builder keyspace(String keyspace) {
return this;
}

/** Cassandra username. */
public Builder username(String username) {
Utils.checkNoTNull("username", username);
this.username = username;
return this;
}

/** Cassandra username. */
public Builder password(String password) {
Utils.checkNoTNull("password", password);
this.password = password;
return this;
}

/** Day to process dependencies for. Defaults to today. */
public Builder day(LocalDate day) {
this.day = day.atStartOfDay(ZoneOffset.UTC);
Expand Down Expand Up @@ -143,6 +157,8 @@ public CassandraDependenciesJob build() {
.setAppName(getClass().getName());
conf.set("spark.cassandra.connection.host", parseHosts(builder.contactPoints));
conf.set("spark.cassandra.connection.port", parsePort(builder.contactPoints));
conf.set("spark.cassandra.auth.username", builder.username);
conf.set("spark.cassandra.auth.password", builder.password);
if (builder.localDc != null) {
conf.set("connection.local_dc", builder.localDc);
}
Expand Down Expand Up @@ -196,7 +212,7 @@ static String parseHosts(String contactPoints) {
List<String> result = new LinkedList<>();
for (String contactPoint : contactPoints.split(",")) {
HostAndPort parsed = HostAndPort.fromString(contactPoint);
result.add(parsed.getHostText());
result.add(parsed.getHost());
}
return Joiner.on(',').join(result);
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.testcontainers.containers.CassandraContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.HttpWaitStrategy;
Expand All @@ -45,7 +46,7 @@ public class CassandraDependenciesJobTest extends DependenciesTest {
@BeforeClass
public static void beforeClass() {
network = Network.newNetwork();
cassandra = new CassandraContainer("cassandra:4.1")
cassandra = new CassandraContainer<>("cassandra:4.1")
.withNetwork(network)
.withNetworkAliases("cassandra")
.withExposedPorts(9042);
Expand Down Expand Up @@ -117,6 +118,8 @@ protected void deriveDependencies() {
.contactPoints("localhost:" + cassandraPort)
.day(LocalDate.now())
.keyspace("jaeger_v1_dc1")
.username(cassandra.getUsername())
.password(cassandra.getPassword())
.build()
.run("peer.service");
}
Expand Down
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<version.io.zipkin.reporter-zipkin-sender-okhttp3>1.0.2</version.io.zipkin.reporter-zipkin-sender-okhttp3>
<version.junit>4.13.2</version.junit>
<version.org.assertj>3.24.2</version.org.assertj>
<version.org.testcontainers>1.18.1</version.org.testcontainers>
<version.org.testcontainers>1.20.4</version.org.testcontainers>
<version.com.squareup.okhttp3-okhttp>3.14.9</version.com.squareup.okhttp3-okhttp>
<version.org.awaitility-awaitility>4.2.0</version.org.awaitility-awaitility>

Expand Down Expand Up @@ -137,6 +137,16 @@
<artifactId>testcontainers</artifactId>
<version>${version.org.testcontainers}</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>cassandra</artifactId>
<version>${version.org.testcontainers}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0-jre</version>
</dependency>
<!-- Forcibly bump Commons Collection version to avoid CVE-2015-7501 -->
<dependency>
<groupId>commons-collections</groupId>
Expand Down