mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-4.0' into cassandra-4.1
This commit is contained in:
commit
f416a94125
|
|
@ -19,6 +19,7 @@ Merged from 3.11:
|
|||
* Remove unnecessary String.format invocation in QueryProcessor when getting a prepared statement from cache (CASSANDRA-17202)
|
||||
* Fix the capital P usage in the CQL parser (CASSANDRA-17919)
|
||||
Merged from 3.0:
|
||||
* Pass down all contact points to driver for cassandra-stress (CASSANDRA-18025)
|
||||
* Validate the existence of a datacenter in nodetool rebuild (CASSANDRA-14319)
|
||||
* Suppress CVE-2023-2251 (CASSANDRA-18497)
|
||||
* Do not remove SSTables when cause of FSReadError is OutOfMemoryError while using best_effort disk failure policy (CASSANDRA-18336)
|
||||
|
|
|
|||
|
|
@ -125,12 +125,11 @@ public class StressSettings implements Serializable
|
|||
|
||||
try
|
||||
{
|
||||
String currentNode = node.randomNode();
|
||||
if (client != null)
|
||||
return client;
|
||||
|
||||
EncryptionOptions encOptions = transport.getEncryptionOptions();
|
||||
JavaDriverClient c = new JavaDriverClient(this, currentNode, port.nativePort, encOptions);
|
||||
JavaDriverClient c = new JavaDriverClient(this, node.nodes, port.nativePort, encOptions);
|
||||
c.connect(mode.compression());
|
||||
if (keyspace != null)
|
||||
c.execute("USE \"" + keyspace + "\";", org.apache.cassandra.db.ConsistencyLevel.ONE);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ package org.apache.cassandra.stress.util;
|
|||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
|
@ -47,7 +49,7 @@ public class JavaDriverClient
|
|||
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());
|
||||
}
|
||||
|
||||
public final String host;
|
||||
public final List<String> hosts;
|
||||
public final int port;
|
||||
public final String username;
|
||||
public final String password;
|
||||
|
|
@ -65,13 +67,18 @@ public class JavaDriverClient
|
|||
|
||||
public JavaDriverClient(StressSettings settings, String host, int port)
|
||||
{
|
||||
this(settings, host, port, new EncryptionOptions());
|
||||
this(settings, Collections.singletonList(host), port, new EncryptionOptions());
|
||||
}
|
||||
|
||||
public JavaDriverClient(StressSettings settings, String host, int port, EncryptionOptions encryptionOptions)
|
||||
public JavaDriverClient(StressSettings settings, List<String> hosts, int port)
|
||||
{
|
||||
this(settings, hosts, port, new EncryptionOptions());
|
||||
}
|
||||
|
||||
public JavaDriverClient(StressSettings settings, List<String> hosts, int port, EncryptionOptions encryptionOptions)
|
||||
{
|
||||
this.protocolVersion = settings.mode.protocolVersion;
|
||||
this.host = host;
|
||||
this.hosts = hosts;
|
||||
this.port = port;
|
||||
this.username = settings.mode.username;
|
||||
this.password = settings.mode.password;
|
||||
|
|
@ -133,10 +140,16 @@ public class JavaDriverClient
|
|||
.setMaxRequestsPerConnection(HostDistance.LOCAL, maxPendingPerConnection)
|
||||
.setNewConnectionThreshold(HostDistance.LOCAL, 100);
|
||||
|
||||
HostAndPort hap = HostAndPort.fromString(host).withDefaultPort(port);
|
||||
InetSocketAddress contact = new InetSocketAddress(InetAddress.getByName(hap.getHost()), hap.getPort());
|
||||
List<InetSocketAddress> contacts = new ArrayList<>();
|
||||
for (String host : hosts)
|
||||
{
|
||||
HostAndPort hap = HostAndPort.fromString(host).withDefaultPort(port);
|
||||
InetSocketAddress contact = new InetSocketAddress(InetAddress.getByName(hap.getHost()), hap.getPort());
|
||||
contacts.add(contact);
|
||||
}
|
||||
|
||||
Cluster.Builder clusterBuilder = Cluster.builder()
|
||||
.addContactPointsWithPorts(contact)
|
||||
.addContactPointsWithPorts(contacts)
|
||||
.withPoolingOptions(poolingOpts)
|
||||
.withoutJMXReporting()
|
||||
.withProtocolVersion(protocolVersion)
|
||||
|
|
|
|||
Loading…
Reference in New Issue