mirror of https://github.com/apache/cassandra
Merge branch cassandra-3.11 into trunk
This commit is contained in:
commit
c8ca54a67e
|
|
@ -58,6 +58,16 @@ public class CASTest extends TestBaseImpl
|
|||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(CASTest.class);
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
|
|
@ -80,7 +90,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))");
|
||||
|
||||
|
|
@ -103,7 +114,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))");
|
||||
|
||||
|
|
@ -129,7 +141,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))");
|
||||
|
||||
|
|
@ -190,7 +203,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)");
|
||||
|
|
@ -364,8 +377,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))");
|
||||
|
|
@ -405,8 +418,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))");
|
||||
|
|
@ -445,8 +458,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))");
|
||||
|
|
@ -489,8 +502,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))");
|
||||
|
|
@ -541,8 +554,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))");
|
||||
|
|
@ -605,8 +618,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))");
|
||||
|
|
|
|||
Loading…
Reference in New Issue