mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.0' into cassandra-3.11
This commit is contained in:
commit
e1e88e5bc4
|
|
@ -1,6 +1,7 @@
|
|||
3.11.16
|
||||
* Remove unnecessary String.format invocation in QueryProcessor when getting a prepared statement from cache (CASSANDRA-17202)
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -202,12 +202,11 @@ public class StressSettings implements Serializable
|
|||
|
||||
try
|
||||
{
|
||||
String currentNode = node.randomNode();
|
||||
if (client != null)
|
||||
return client;
|
||||
|
||||
EncryptionOptions.ClientEncryptionOptions 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 (setKeyspace)
|
||||
c.execute("USE \"" + schema.keyspace + "\";", org.apache.cassandra.db.ConsistencyLevel.ONE);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,16 @@
|
|||
*/
|
||||
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;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
||||
import com.google.common.net.HostAndPort;
|
||||
import com.datastax.driver.core.*;
|
||||
import com.datastax.driver.core.policies.DCAwareRoundRobinPolicy;
|
||||
import com.datastax.driver.core.policies.LoadBalancingPolicy;
|
||||
|
|
@ -41,7 +46,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;
|
||||
|
|
@ -59,13 +64,13 @@ public class JavaDriverClient
|
|||
|
||||
public JavaDriverClient(StressSettings settings, String host, int port)
|
||||
{
|
||||
this(settings, host, port, new EncryptionOptions.ClientEncryptionOptions());
|
||||
this(settings, Collections.singletonList(host), port, new EncryptionOptions.ClientEncryptionOptions());
|
||||
}
|
||||
|
||||
public JavaDriverClient(StressSettings settings, String host, int port, EncryptionOptions.ClientEncryptionOptions encryptionOptions)
|
||||
public JavaDriverClient(StressSettings settings, List<String> hosts, int port, EncryptionOptions.ClientEncryptionOptions 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;
|
||||
|
|
@ -127,9 +132,16 @@ public class JavaDriverClient
|
|||
.setMaxRequestsPerConnection(HostDistance.LOCAL, maxPendingPerConnection)
|
||||
.setNewConnectionThreshold(HostDistance.LOCAL, 100);
|
||||
|
||||
List<InetSocketAddress> contacts = new ArrayList<>();
|
||||
for (String host : hosts)
|
||||
{
|
||||
HostAndPort hap = HostAndPort.fromString(host).withDefaultPort(port);
|
||||
InetSocketAddress contact = new InetSocketAddress(InetAddress.getByName(hap.getHostText()), hap.getPort());
|
||||
contacts.add(contact);
|
||||
}
|
||||
|
||||
Cluster.Builder clusterBuilder = Cluster.builder()
|
||||
.addContactPoint(host)
|
||||
.withPort(port)
|
||||
.addContactPointsWithPorts(contacts)
|
||||
.withPoolingOptions(poolingOpts)
|
||||
.withoutJMXReporting()
|
||||
.withProtocolVersion(protocolVersion)
|
||||
|
|
|
|||
Loading…
Reference in New Issue