driftx commented on code in PR #3206:
URL: https://github.com/apache/cassandra/pull/3206#discussion_r1543359153


##########
test/distributed/org/apache/cassandra/distributed/test/HintsMaxSizeTest.java:
##########
@@ -25,24 +25,97 @@
 import org.apache.cassandra.distributed.Cluster;
 import org.apache.cassandra.distributed.api.IInvokableInstance;
 import org.apache.cassandra.distributed.api.IIsolatedExecutor;
+import org.apache.cassandra.gms.FailureDetector;
 import org.apache.cassandra.hints.HintsService;
 import org.apache.cassandra.io.util.File;
 import org.apache.cassandra.io.util.FileUtils;
+import org.apache.cassandra.locator.InetAddressAndPort;
 import org.apache.cassandra.metrics.StorageMetrics;
 import org.apache.cassandra.service.StorageService;
 
 import static java.lang.String.format;
 import static java.lang.String.valueOf;
+import static java.util.concurrent.TimeUnit.MINUTES;
 import static java.util.concurrent.TimeUnit.SECONDS;
 import static org.apache.cassandra.distributed.api.ConsistencyLevel.ONE;
 import static org.apache.cassandra.distributed.api.Feature.GOSSIP;
 import static org.apache.cassandra.distributed.api.Feature.NETWORK;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.awaitility.Awaitility.await;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 @SuppressWarnings("Convert2MethodRef")
 public class HintsMaxSizeTest extends TestBaseImpl
 {
+    @Test
+    public void testHintsKeepRecordingAfterNodeGoesOfflineRepeatedly() throws 
Exception
+    {
+        try (Cluster cluster = init(Cluster.build(2)
+                                           .withDataDirCount(1)
+                                           .withConfig(config -> 
config.with(NETWORK, GOSSIP)
+                                                                       
.set("hinted_handoff_enabled", true)
+                                                                       
.set("max_hints_delivery_threads", "1")
+                                                                       
.set("hints_flush_period", "1s")
+                                                                       
.set("max_hint_window", "30s")
+                                                                       
.set("max_hints_size_per_host", "2MiB")
+                                                                       
.set("max_hints_file_size", "1MiB"))
+                                           .start(), 2))
+        {
+            final IInvokableInstance node1 = cluster.get(1);
+            final IInvokableInstance node2 = cluster.get(2);
+
+            waitForExistingRoles(cluster);
+
+            String createTableStatement = format("CREATE TABLE %s.cf (k text 
PRIMARY KEY, c1 text) " +
+                                                 "WITH compaction = {'class': 
'SizeTieredCompactionStrategy', 'enabled': 'false'} ", KEYSPACE);
+            cluster.schemaChange(createTableStatement);
+
+            UUID node2UUID = 
node2.callOnInstance((IIsolatedExecutor.SerializableCallable<UUID>) () -> 
StorageService.instance.getLocalHostUUID());
+
+            // shutdown the second node in a blocking manner
+            node2.shutdown().get();
+            waitUntilNodeState(node1, node2UUID, false);
+
+            Long totalHintsAfterFirstShutdown = insertData(cluster);
+
+            // check hints are there etc
+            assertHintsSizes(node1, node2UUID);
+
+            // start the second node, this will deliver hints to it from the 
first
+            node2.startup();
+            waitUntilNodeState(node1, node2UUID, true);
+
+            waitUntilNoHints(node1, node2UUID);
+            assertEquals(totalHintsAfterFirstShutdown, 
getTotalHintsCount(node1));
+
+            // all hints were delivered, so lets take that node down again to 
see if hints
+            // delivery works after node goes down for the second time
+            node2.shutdown().get();
+            waitUntilNodeState(node1, node2UUID, false);
+
+            // insert again, this will increase the number of total hints sent
+            Long totalHintsAfterSecondShutdown = insertData(cluster);
+
+            assertHintsSizes(node1, node2UUID);
+
+            // the fact it is greater than 0 means that we created new hints 
agains
+
+            // after we stopped the second node for the second time
+            assertTrue(totalHintsAfterSecondShutdown - 
totalHintsAfterFirstShutdown > 0);
+
+            // wait 1 minute plus some change to have room for node's status 
detection

Review Comment:
   no longer 1 minute



-- 
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