jdeppe-pivotal commented on a change in pull request #7429:
URL: https://github.com/apache/geode/pull/7429#discussion_r822114907



##########
File path: 
geode-for-redis/src/distributedTest/java/org/apache/geode/redis/internal/commands/executor/string/StringsDUnitTest.java
##########
@@ -253,49 +252,23 @@ public void 
strLen_returnsStringLengthWhileConcurrentlyUpdatingValues() {
   }
 
   @Test
-  public void givenBucketsMoveDuringAppend_thenDataIsNotLost() throws 
Exception {
-    AtomicBoolean running = new AtomicBoolean(true);
-
-    List<String> hashtags = new ArrayList<>();
-    hashtags.add(clusterStartUp.getKeyOnServer("append", 1));
-    hashtags.add(clusterStartUp.getKeyOnServer("append", 2));
-    hashtags.add(clusterStartUp.getKeyOnServer("append", 3));
-
-    Runnable task1 = () -> appendPerformAndVerify(1, hashtags.get(0), running);
-    Runnable task2 = () -> appendPerformAndVerify(2, hashtags.get(1), running);
-    Runnable task3 = () -> appendPerformAndVerify(3, hashtags.get(2), running);
-
-    Future<Void> future1 = executor.runAsync(task1);
-    Future<Void> future2 = executor.runAsync(task2);
-    Future<Void> future3 = executor.runAsync(task3);
-
-    for (int i = 0; i < 100 && running.get(); i++) {
-      clusterStartUp.moveBucketForKey(hashtags.get(i % hashtags.size()));
-      GeodeAwaitility.await().during(Duration.ofMillis(200)).until(() -> true);
-    }
-
-    running.set(false);
-
-    future1.get();
-    future2.get();
-    future3.get();
+  public void givenBucketsMoveAndPrimarySwitches_thenNoDuplicateAppendsOccur() 
{
+    String KEY = "APPEND";
+    AtomicInteger counter = new AtomicInteger(0);
+
+    new ConcurrentLoopingThreads(1000,
+        i -> {
+          String appendString = "-" + KEY + "-" + i + "-";
+          jedisCluster.append(KEY, appendString);
+          counter.incrementAndGet();
+        },
+        i -> clusterStartUp.moveBucketForKey(KEY)).runWithAction(() -> {
+          clusterStartUp.switchPrimaryForKey(KEY, server1, server2, server3);
+          verifyAppendResult(KEY, counter.get());

Review comment:
       Strange, since it did actually trigger on duplicate entries. I've 
switched back to the original verification with the addition of only printing 
out the substring where the error is found.




-- 
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: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to