This commit is contained in:
Jonathan Shook 2020-04-06 12:06:13 -05:00
commit 28c83c4204
29 changed files with 110 additions and 68 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,7 +23,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -3,6 +3,7 @@ package io.nosqlbench.activitytype.cql.core;
import com.datastax.driver.core.*;
import com.datastax.driver.core.policies.*;
import io.netty.util.HashedWheelTimer;
import io.nosqlbench.engine.api.exceptions.BasicError;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -83,6 +84,24 @@ public class CQLOptions {
return retryPolicy;
}
public static ReconnectionPolicy reconnectPolicyFor(String spec) {
if(spec.startsWith("exponential(")){
String argsString = spec.substring(12);
String[] args = argsString.substring(0, argsString.length() - 1).split("[,;]");
if (args.length != 2){
throw new BasicError("Invalid reconnectionpolicy, try reconnectionpolicy=exponential(<baseDelay>, <maxDelay>)");
}
long baseDelay = Long.parseLong(args[0]);
long maxDelay = Long.parseLong(args[1]);
return new ExponentialReconnectionPolicy(baseDelay,maxDelay);
}else if(spec.startsWith("constant(")){
String argsString = spec.substring(9);
long constantDelayMs= Long.parseLong(argsString.substring(0, argsString.length() - 1));
return new ConstantReconnectionPolicy(constantDelayMs);
}
throw new BasicError("Invalid reconnectionpolicy, try reconnectionpolicy=exponential(<baseDelay>, <maxDelay>) or constant(<constantDelayMs>)");
}
public static SocketOptions socketOptionsFor(String spec) {
String[] assignments = spec.split("[,;]");
Map<String, String> values = new HashMap<>();

View File

@ -161,6 +161,15 @@ public class CQLSessionCache implements Shutdownable {
.map(CQLOptions::socketOptionsFor)
.ifPresent(builder::withSocketOptions);
activityDef.getParams().getOptionalString("reconnectpolicy")
.map(reconnectpolicy-> {
logger.info("reconnectpolicy=>" + reconnectpolicy);
return reconnectpolicy;
})
.map(CQLOptions::reconnectPolicyFor)
.ifPresent(builder::withReconnectionPolicy);
activityDef.getParams().getOptionalString("pooling")
.map(pooling -> {
logger.info("pooling=>" + pooling);

View File

@ -66,6 +66,11 @@ activity types.
The only option supported for this version is `retrypolicy=logging`,
which uses the default retry policy, but with logging added.
- **reconnectpolicy** default: none - Applies a reconnection policy in the driver
Supports either `reconnectpolicy=exponential(minDelayInMs,maxDelayInMs)` or `reconnectpolicy=constant(delayInMs)`.
The driver reconnects using this policy when the entire cluster becomes unavailable.
- **pooling** default: none - Applies the connection pooling options
to the policy.
Examples:

View File

@ -4,6 +4,8 @@ import com.datastax.driver.core.HostDistance;
import com.datastax.driver.core.PoolingOptions;
import com.datastax.driver.core.SocketOptions;
import com.datastax.driver.core.policies.LoadBalancingPolicy;
import com.datastax.driver.core.policies.ReconnectionPolicy;
import com.datastax.driver.core.policies.RetryPolicy;
import com.datastax.driver.core.policies.SpeculativeExecutionPolicy;
import io.nosqlbench.activitytype.cql.core.CQLOptions;
import org.junit.Test;
@ -32,6 +34,13 @@ public class CQLOptionsTest {
assertThat(lbp).isNotNull();
}
@Test
public void testReconnectPolicyPatterns() {
ReconnectionPolicy rp = CQLOptions.reconnectPolicyFor("exponential(123,321)");
rp = CQLOptions.reconnectPolicyFor("constant(123)");
}
@Test
public void testSocketOptionPatterns() {
SocketOptions so = CQLOptions.socketOptionsFor("read_timeout_ms=23423,connect_timeout_ms=2344;keep_alive:true,reuse_address:true;so_linger:323;tcp_no_delay=true;receive_buffer_size:100,send_buffer_size=1000");

View File

@ -4,7 +4,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -24,7 +24,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-cql</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<!-- test scope only -->

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<!-- test scope only -->

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,13 +23,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-stdout</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<!-- test scope only -->

View File

@ -9,7 +9,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
@ -112,7 +112,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,13 +22,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>nb-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-userlibs</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,7 +23,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
@ -47,7 +47,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docker</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -28,7 +28,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -77,7 +77,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -28,7 +28,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>docsys</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,7 +22,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -3,7 +3,7 @@
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -24,61 +24,61 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-cli</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-docs</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-core</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>engine-extensions</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-stdout</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-diag</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-tcp</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-http</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-cql</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>activitytype-cqlverify</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>mvn-defaults</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>io.nosqlbench</groupId>
<artifactId>mvn-defaults</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -23,14 +23,14 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<artifactId>nb-api</artifactId>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lang</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -22,13 +22,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -20,13 +20,13 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -24,7 +24,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-basics</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<artifactId>mvn-defaults</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
<relativePath>../mvn-defaults</relativePath>
</parent>
@ -17,38 +17,38 @@
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-realdata</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-realer</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-api</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>virtdata-lib-random</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>virtdata-lib-basics</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>virtdata-lib-curves4</artifactId>
<groupId>io.nosqlbench</groupId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.nosqlbench</groupId>
<artifactId>docsys</artifactId>
<version>3.12.79-SNAPSHOT</version>
<version>3.12.80-SNAPSHOT</version>
</dependency>
<dependency>