This is an automated email from the ASF dual-hosted git repository.

benedict pushed a commit to branch cep-15-accord
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cep-15-accord by this push:
     new 87a10cfa24 improve AccordLoadTest to support more keys
87a10cfa24 is described below

commit 87a10cfa24909c5cc53be824689fe3630f4262f5
Author: Benedict Elliott Smith <[email protected]>
AuthorDate: Mon Sep 30 18:18:45 2024 +0100

    improve AccordLoadTest to support more keys
---
 modules/accord                                     |  2 +-
 .../distributed/test/accord/AccordLoadTest.java    | 22 ++++++++++++++++------
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/modules/accord b/modules/accord
index 2a7aceb96c..4a39a2d0d2 160000
--- a/modules/accord
+++ b/modules/accord
@@ -1 +1 @@
-Subproject commit 2a7aceb96cb1e03bcfe150403b9d245b1d2562f9
+Subproject commit 4a39a2d0d286f6b03538ce44fbf7c9cbc1b1cf48
diff --git 
a/test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java
 
b/test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java
index c5aa059a4c..8478a060d7 100644
--- 
a/test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java
+++ 
b/test/distributed/org/apache/cassandra/distributed/test/accord/AccordLoadTest.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.distributed.test.accord;
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.BitSet;
 import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
@@ -82,11 +83,10 @@ public class AccordLoadTest extends AccordTestBase
                  final int batchSize = 1000;
                  final int concurrency = 100;
                  final int ratePerSecond = 1000;
-                 final int keyCount = 10;
+                 final int keyCount = 100000;
                  final float readChance = 0.33f;
                  long nextRepairAt = repairInterval;
-                 for (int i = 1; i <= keyCount; i++)
-                     coordinator.execute("INSERT INTO " + 
qualifiedAccordTableName + " (k, v) VALUES (0, 0) USING TIMESTAMP 0;", 
ConsistencyLevel.ALL, i);
+                 final BitSet initialised = new BitSet();
 
                  Random random = new Random();
 //                 CopyOnWriteArrayList<Throwable> exceptions = new 
CopyOnWriteArrayList<>();
@@ -103,21 +103,31 @@ public class AccordLoadTest extends AccordTestBase
                          inFlight.acquire();
                          rateLimiter.acquire();
                          long commandStart = System.nanoTime();
+                         int k = random.nextInt(keyCount);
                          if (random.nextFloat() < readChance)
                          {
                              coordinator.executeWithResult((success, fail) -> {
                                  inFlight.release();
                                  if (fail == null) 
histogram.add(NANOSECONDS.toMicros(System.nanoTime() - commandStart));
                                  //                             else 
exceptions.add(fail);
-                             }, "SELECT * FROM " + qualifiedAccordTableName + 
" WHERE k = ?;", ConsistencyLevel.SERIAL, random.nextInt(keyCount));
+                             }, "SELECT * FROM " + qualifiedAccordTableName + 
" WHERE k = ?;", ConsistencyLevel.SERIAL, k);
                          }
-                         else
+                         else if (initialised.get(i))
                          {
                              coordinator.executeWithResult((success, fail) -> {
                                  inFlight.release();
                                  if (fail == null) 
histogram.add(NANOSECONDS.toMicros(System.nanoTime() - commandStart));
     //                             else exceptions.add(fail);
-                             }, "UPDATE " + qualifiedAccordTableName + " SET v 
+= 1 WHERE k = ? IF EXISTS;", ConsistencyLevel.SERIAL, ConsistencyLevel.QUORUM, 
random.nextInt(keyCount));
+                             }, "UPDATE " + qualifiedAccordTableName + " SET v 
+= 1 WHERE k = ? IF EXISTS;", ConsistencyLevel.SERIAL, ConsistencyLevel.QUORUM, 
k);
+                         }
+                         else
+                         {
+                             initialised.set(i);
+                             coordinator.executeWithResult((success, fail) -> {
+                                 inFlight.release();
+                                 if (fail == null) 
histogram.add(NANOSECONDS.toMicros(System.nanoTime() - commandStart));
+                                 //                             else 
exceptions.add(fail);
+                             }, "UPDATE " + qualifiedAccordTableName + " SET v 
= 0 WHERE k = ? IF NOT EXISTS;", ConsistencyLevel.SERIAL, 
ConsistencyLevel.QUORUM, k);
                          }
                      }
 


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

Reply via email to