maedhroz commented on code in PR #2049:
URL: https://github.com/apache/cassandra/pull/2049#discussion_r1066426561


##########
test/distributed/org/apache/cassandra/distributed/test/accord/AccordCQLTest.java:
##########
@@ -2305,4 +2312,30 @@ public void testReferenceArithmeticInUpdate() throws 
Exception
              assertEmptyWithPreemptedRetry(cluster, cql);
         });
     }
+
+    @Test
+    public void testCASAndSerialRead() throws Exception
+    {
+        test("CREATE TABLE " + currentTable + " (id int, c int, v int, s int 
static, PRIMARY KEY ((id), c));",
+            cluster -> {
+                ICoordinator coordinator = cluster.coordinator(1);
+                int startingAccordCoordinateCount = getAccordCoordinateCount();
+                coordinator.execute("INSERT INTO " + currentTable + " (id, c, 
v, s) VALUES (1, 2, 3, 5);", ConsistencyLevel.ALL);
+                assertRowSerial(cluster, "SELECT id, c, v, s FROM " + 
currentTable + " WHERE id = 1 AND c = 2", 1, 2, 3, 5);
+                assertRowEqualsWithPreemptedRetry(cluster, new Object[]{true}, 
"UPDATE " + currentTable + " SET v = 4 WHERE id = 1 AND c = 2 IF v = 3");
+                assertRowSerial(cluster, "SELECT id, c, v, s FROM " + 
currentTable + " WHERE id = 1 AND c = 2", 1, 2, 4, 5);
+                assertRowEqualsWithPreemptedRetry(cluster, new Object[]{ 
false, 4 }, "UPDATE " + currentTable + " SET v = 4 WHERE id = 1 AND c = 2 IF v 
= 3");
+                assertRowSerial(cluster, "SELECT id, c, v, s FROM " + 
currentTable + " WHERE id = 1 AND c = 2", 1, 2, 4, 5);
+
+                // Test working with a static column
+                assertRowEqualsWithPreemptedRetry(cluster, new Object[]{ 
false, 5 }, "UPDATE " + currentTable + " SET v = 5 WHERE id = 1 AND c = 2 IF s 
= 4");
+                assertRowSerial(cluster, "SELECT id, c, v, s FROM " + 
currentTable + " WHERE id = 1 AND c = 2", 1, 2, 4, 5);
+                assertRowEqualsWithPreemptedRetry(cluster, new Object[]{true}, 
"UPDATE " + currentTable + " SET v = 5 WHERE id = 1 AND c = 2 IF s = 5");
+                assertRowSerial(cluster, "SELECT id, c, v, s FROM " + 
currentTable + " WHERE id = 1 AND c = 2", 1, 2, 5, 5);
+                assertRowEqualsWithPreemptedRetry(cluster, new Object[]{true}, 
"UPDATE " + currentTable + " SET s = 6 WHERE id = 1 IF s = 5");
+                assertRowSerial(cluster, "SELECT id, c, v, s FROM " + 
currentTable + " WHERE id = 1 AND c = 2", 1, 2, 5, 6);
+                // Make sure all the consensus using queries actually were run 
on Accord
+                assertEquals( 11, getAccordCoordinateCount() - 
startingAccordCoordinateCount);
+        });
+    }

Review Comment:
   > CASTestBase requires functionality I don't think we have yet in accord 
like adding and removing nodes. CASWriteTest has tests that are pretty 
specifically testing the Paxos implementation.
   
   Good points.
   
   > The former is kind of unit tested by ColumnConditionTest in that if 
ColumnCondition correctly implements the CQL and we can roundtrip it then it 
should also work for CAS.
   
   True. If the serialization is solid, there's not much else to go wrong in 
`ColumnConditionsAdapter`.
   
   > I think running with simulator is more interesting, but it was not quite 
working when I went to run it
   
   Agreed. Getting simulator working is probably the best use of further 
testing energy at this point.
   
   In any case, feel free to mark this as resolved.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to