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

jonmeredith 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 1a5302608f Test Failure: HintsDisabledTest.testHintedHandoffDisabled
1a5302608f is described below

commit 1a5302608f3506c4940fa170976336081ddd4a88
Author: Jon Meredith <[email protected]>
AuthorDate: Wed Apr 26 13:40:45 2023 -0600

    Test Failure: HintsDisabledTest.testHintedHandoffDisabled
    
    patch by Jon Meredith; reviewed by Paulo Motta for CASSANDRA-18482
---
 .../distributed/test/HintsDisabledTest.java        | 29 +++++++++++++---------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git 
a/test/distributed/org/apache/cassandra/distributed/test/HintsDisabledTest.java 
b/test/distributed/org/apache/cassandra/distributed/test/HintsDisabledTest.java
index 64d023fa50..00c7e7cfdd 100644
--- 
a/test/distributed/org/apache/cassandra/distributed/test/HintsDisabledTest.java
+++ 
b/test/distributed/org/apache/cassandra/distributed/test/HintsDisabledTest.java
@@ -21,19 +21,21 @@ package org.apache.cassandra.distributed.test;
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
+import org.awaitility.Awaitility;
 import org.junit.Test;
 
-import 
com.google.monitoring.runtime.instrumentation.common.util.concurrent.Uninterruptibles;
-import org.apache.cassandra.db.ColumnFamilyStore;
+import org.apache.cassandra.concurrent.Stage;
 import org.apache.cassandra.distributed.Cluster;
 import org.apache.cassandra.distributed.api.ConsistencyLevel;
 import org.apache.cassandra.distributed.api.IMessageFilters;
 import org.apache.cassandra.metrics.StorageMetrics;
+import org.apache.cassandra.utils.concurrent.CountDownLatch;
 
 import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
 import static org.apache.cassandra.distributed.api.Feature.NETWORK;
 import static org.apache.cassandra.net.Verb.MUTATION_REQ;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertTrue;
 
 public class HintsDisabledTest extends TestBaseImpl
 {
@@ -43,7 +45,7 @@ public class HintsDisabledTest extends TestBaseImpl
         try (Cluster cluster = init(Cluster.build(2)
                                            .withDataDirCount(1)
                                            .withConfig(config -> 
config.with(NETWORK, GOSSIP)
-                                                                       
.set("write_request_timeout", "10ms")
+                                                                       
.set("write_request_timeout", "1000ms")
                                                                        
.set("hinted_handoff_enabled", false))
                                            .start(), 2))
         {
@@ -51,24 +53,27 @@ public class HintsDisabledTest extends TestBaseImpl
                                                         "WITH compaction = 
{'class': 'SizeTieredCompactionStrategy', 'enabled': 'false'} ", KEYSPACE);
             cluster.schemaChange(createTableStatement);
 
+            CountDownLatch dropped = CountDownLatch.newCountDownLatch(1);
             // Drop all messages from node1 to node2 so hints should be created
-            IMessageFilters.Filter drop1to2 = 
cluster.filters().verbs(MUTATION_REQ.id).from(1).to(2).drop();
+            IMessageFilters.Filter drop1to2 = 
cluster.filters().verbs(MUTATION_REQ.id).messagesMatching((from, to, m) -> {
+                if (from != 1 || to != 2)
+                    return false;
+                dropped.decrement();
+                return true;
+            }).drop();
 
             cluster.coordinator(1).execute(withKeyspace("INSERT INTO %s.cf (k, 
c1) VALUES (?, ?) USING TIMESTAMP 1;"),
                                            ConsistencyLevel.ONE,
                                            String.valueOf(1),
                                            String.valueOf(1));
-
-            // Wait 15ms for write to timeout (write_request_timeout=10ms)
-            Uninterruptibles.sleepUninterruptibly(15, TimeUnit.MILLISECONDS);
+            // make sure the write response handler has completed after a 
chance to hint
+            assertTrue(dropped.awaitUninterruptibly(1, TimeUnit.MINUTES));
+            cluster.get(1).runOnInstance(() -> {
+                Awaitility.waitAtMost(1, TimeUnit.MINUTES).until(() -> 
Stage.INTERNAL_RESPONSE.executor().getPendingTaskCount() == 0);
+            });
 
             // Check that no hints were created on node1
             assertThat(cluster.get(1).callOnInstance(() -> 
Long.valueOf(StorageMetrics.totalHints.getCount()))).isEqualTo(0L);
         }
     }
-
-    private static int getNumberOfSSTables(Cluster cluster, int node)
-    {
-        return cluster.get(node).callOnInstance(() -> 
ColumnFamilyStore.getIfExists(KEYSPACE, "cf").getLiveSSTables().size());
-    }
 }


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

Reply via email to