This is an automated email from the ASF dual-hosted git repository.
blambov pushed a commit to branch cassandra-4.1
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-4.1 by this push:
new acda6fad68 Bug fix for WriteTimeoutException when using Paxos v2 with
a single datacenter
acda6fad68 is described below
commit acda6fad688e95e0a9a34de28e3b61a775e59736
Author: Marianne Lyne Manaog <[email protected]>
AuthorDate: Mon Nov 7 10:33:02 2022 +0000
Bug fix for WriteTimeoutException when using Paxos v2 with a single
datacenter
patch by Marianne Lyne Manaog; reviewed by Branimir Lambov and Benedict
Elliott Smith for CASSANDRA-17999
---
.../cassandra/service/paxos/PaxosCommit.java | 2 +-
.../apache/cassandra/distributed/test/CASTest.java | 25 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java
b/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java
index 246fed7799..4321fc918f 100644
--- a/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java
+++ b/src/java/org/apache/cassandra/service/paxos/PaxosCommit.java
@@ -260,7 +260,7 @@ public class PaxosCommit<OnDone extends Consumer<? super
PaxosCommit.Status>> ex
*/
private void response(boolean success, InetAddressAndPort from)
{
- if (consistencyForCommit.isDatacenterLocal() &&
InOurDc.endpoints().test(from))
+ if (consistencyForCommit.isDatacenterLocal() &&
!InOurDc.endpoints().test(from))
return;
long responses = responsesUpdater.addAndGet(this, success ? 0x1L :
0x100000000L);
diff --git
a/test/distributed/org/apache/cassandra/distributed/test/CASTest.java
b/test/distributed/org/apache/cassandra/distributed/test/CASTest.java
index 2007f10b2f..8e2b8ac901 100644
--- a/test/distributed/org/apache/cassandra/distributed/test/CASTest.java
+++ b/test/distributed/org/apache/cassandra/distributed/test/CASTest.java
@@ -41,6 +41,7 @@ import org.apache.cassandra.utils.FBUtilities;
import static org.apache.cassandra.distributed.api.ConsistencyLevel.ANY;
import static org.apache.cassandra.distributed.api.ConsistencyLevel.ONE;
+import static
org.apache.cassandra.distributed.api.ConsistencyLevel.LOCAL_QUORUM;
import static org.apache.cassandra.distributed.api.ConsistencyLevel.QUORUM;
import static org.apache.cassandra.distributed.api.ConsistencyLevel.SERIAL;
import static org.apache.cassandra.distributed.shared.AssertUtils.assertRows;
@@ -755,4 +756,28 @@ public class CASTest extends CASCommonTestCases
{
return THREE_NODES;
}
+
+ /**
+ * Regression test for a bug (CASSANDRA-17999) where a
WriteTimeoutException is encountered when using Paxos v2 in
+ * an LWT performance test that only has a single datacenter because Paxos
was still waiting for a response from
+ * another datacenter during the Commit/Acknowledge phase even though we
were running with LOCAL_SERIAL.
+ *
+ *
+ * <p>This specifically test for the inconsistency described/fixed by
CASSANDRA-17999.
+ */
+ @Test
+ public void testWriteTimeoutExceptionUsingPaxosInLwtPerformaceTest()
throws IOException
+ {
+
+ THREE_NODES.schemaChange(String.format("CREATE KEYSPACE IF NOT EXISTS
%s WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}",
KEYSPACE));
+
+ String tableName = tableName("t");
+ String table = KEYSPACE + "." + tableName;
+ THREE_NODES.schemaChange("CREATE TABLE " + table + " (k int PRIMARY
KEY, v int)");
+
+ THREE_NODES.coordinator(1).execute("INSERT INTO " + table + " (k, v)
VALUES (5, 5) IF NOT EXISTS", LOCAL_QUORUM);
+ THREE_NODES.coordinator(1).execute("UPDATE " + table + " SET v = 123
WHERE k = 5 IF EXISTS", LOCAL_QUORUM);
+
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]