Merge branch cassandra-3.0 into cassandra-3.11

This commit is contained in:
Benjamin Lerer 2021-02-17 14:10:36 +01:00
commit b07a6266eb
1 changed files with 29 additions and 16 deletions

View File

@ -52,6 +52,16 @@ import static org.junit.Assert.assertTrue;
public class CASTest extends TestBaseImpl
{
/**
* The {@code cas_contention_timeout_in_ms} used during the tests
*/
private static final long CONTENTION_TIMEOUT = 1000L;
/**
* The {@code write_request_timeout_in_ms} used during the tests
*/
private static final long REQUEST_TIMEOUT = 1000L;
@Test
public void simpleUpdate() throws Throwable
{
@ -74,7 +84,8 @@ public class CASTest extends TestBaseImpl
@Test
public void incompletePrepare() throws Throwable
{
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", 200L).set("cas_contention_timeout_in_ms", 200L))))
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT))))
{
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v int, PRIMARY KEY (pk, ck))");
@ -97,7 +108,8 @@ public class CASTest extends TestBaseImpl
@Test
public void incompletePropose() throws Throwable
{
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", 200L).set("cas_contention_timeout_in_ms", 200L))))
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT))))
{
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v int, PRIMARY KEY (pk, ck))");
@ -123,7 +135,8 @@ public class CASTest extends TestBaseImpl
@Test
public void incompleteCommit() throws Throwable
{
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", 200L).set("cas_contention_timeout_in_ms", 200L))))
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT))))
{
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v int, PRIMARY KEY (pk, ck))");
@ -189,7 +202,7 @@ public class CASTest extends TestBaseImpl
// is due to the in-jvm dtest framework. This is is why we use a 4 seconds timeout here. Given this test is
// not about performance, this is probably ok, even if we ideally should dug into the underlying reason.
try (Cluster cluster = init(Cluster.create(3, config -> config.set("write_request_timeout_in_ms", 4000L)
.set("cas_contention_timeout_in_ms", 200L))))
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT))))
{
String table = KEYSPACE + ".t";
cluster.schemaChange("CREATE TABLE " + table + " (k int PRIMARY KEY, v int)");
@ -360,8 +373,8 @@ public class CASTest extends TestBaseImpl
public void testSuccessfulWriteBeforeRangeMovement() throws Throwable
{
try (Cluster cluster = Cluster.create(4, config -> config
.set("write_request_timeout_in_ms", 200L)
.set("cas_contention_timeout_in_ms", 200L)))
.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT)))
{
cluster.schemaChange("CREATE KEYSPACE " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};");
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v1 int, v2 int, PRIMARY KEY (pk, ck))");
@ -401,8 +414,8 @@ public class CASTest extends TestBaseImpl
public void testConflictingWritesWithStaleRingInformation() throws Throwable
{
try (Cluster cluster = Cluster.create(4, config -> config
.set("write_request_timeout_in_ms", 200L)
.set("cas_contention_timeout_in_ms", 200L)))
.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT)))
{
cluster.schemaChange("CREATE KEYSPACE " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};");
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v1 int, v2 int, PRIMARY KEY (pk, ck))");
@ -441,8 +454,8 @@ public class CASTest extends TestBaseImpl
public void testSucccessfulWriteDuringRangeMovementFollowedByRead() throws Throwable
{
try (Cluster cluster = Cluster.create(4, config -> config
.set("write_request_timeout_in_ms", 200L)
.set("cas_contention_timeout_in_ms", 200L)))
.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT)))
{
cluster.schemaChange("CREATE KEYSPACE " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};");
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v int, PRIMARY KEY (pk, ck))");
@ -485,8 +498,8 @@ public class CASTest extends TestBaseImpl
public void testSuccessfulWriteDuringRangeMovementFollowedByConflicting() throws Throwable
{
try (Cluster cluster = Cluster.create(4, config -> config
.set("write_request_timeout_in_ms", 200L)
.set("cas_contention_timeout_in_ms", 200L)))
.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT)))
{
cluster.schemaChange("CREATE KEYSPACE " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};");
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v1 int, v2 int, PRIMARY KEY (pk, ck))");
@ -537,8 +550,8 @@ public class CASTest extends TestBaseImpl
public void testIncompleteWriteFollowedBySuccessfulWriteWithStaleRingDuringRangeMovementFollowedByRead() throws Throwable
{
try (Cluster cluster = Cluster.create(4, config -> config
.set("write_request_timeout_in_ms", 200L)
.set("cas_contention_timeout_in_ms", 200L)))
.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT)))
{
cluster.schemaChange("CREATE KEYSPACE " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};");
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v1 int, v2 int, PRIMARY KEY (pk, ck))");
@ -601,8 +614,8 @@ public class CASTest extends TestBaseImpl
public void testIncompleteWriteFollowedBySuccessfulWriteWithStaleRingDuringRangeMovementFollowedByWrite() throws Throwable
{
try (Cluster cluster = Cluster.create(4, config -> config
.set("write_request_timeout_in_ms", 200L)
.set("cas_contention_timeout_in_ms", 200L)))
.set("write_request_timeout_in_ms", REQUEST_TIMEOUT)
.set("cas_contention_timeout_in_ms", CONTENTION_TIMEOUT)))
{
cluster.schemaChange("CREATE KEYSPACE " + KEYSPACE + " WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 3};");
cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".tbl (pk int, ck int, v1 int, v2 int, PRIMARY KEY (pk, ck))");