beobal commented on code in PR #3893:
URL: https://github.com/apache/cassandra/pull/3893#discussion_r1955008972


##########
test/distributed/org/apache/cassandra/distributed/test/PaxosRepair2Test.java:
##########
@@ -573,6 +584,40 @@ public void legacyPurgeRepairLoop() throws Exception
                 assertUncommitted(cluster.get(1), KEYSPACE, TABLE, 0);
                 assertUncommitted(cluster.get(2), KEYSPACE, TABLE, 0);
                 assertUncommitted(cluster.get(3), KEYSPACE, TABLE, 0);
+
+                Conditions conditions = new Conditions();
+
+                Thread keyspaceDropTask = new Thread(() -> {
+                    try
+                    {
+                        conditions.beforeKeyspaceDrop.await();
+                        cluster.schemaChange("DROP KEYSPACE " + KEYSPACE, 3);
+                        conditions.afterKeyspaceDrop.countDown();
+                    }
+                    catch (InterruptedException e)
+                    {
+                        throw new RuntimeException(e);
+                    }
+                });
+
+                keyspaceDropTask.start();
+
+                cluster.get(3).acceptOnInstance(conds -> {
+                    try
+                    {
+                        TableId tableId = 
Schema.instance.getTableMetadata(KEYSPACE, TABLE).id;
+                        Token token = 
DatabaseDescriptor.getPartitioner().getMinimumToken();
+                        Collection<Range<Token>> ranges = 
Collections.singleton(new Range<>(token, token));
+                        PaxosCleanupLocalCoordinator repair = 
PaxosCleanupLocalCoordinator.createForAutoRepair(SharedContext.Global.instance, 
tableId, ranges);
+                        conds.beforeKeyspaceDrop.countDown();
+                        conds.afterKeyspaceDrop.await();
+                        repair.start();
+                    }
+                    catch (Exception e)
+                    {
+                        throw new RuntimeException(e);
+                    }
+                }, conditions);

Review Comment:
   I would modify this very slightly just to assert that the repair is failing 
in the way we expect:  
   ```suggestion
                                   boolean failedAsExpected = 
cluster.get(3).applyOnInstance(conds -> {
                       try
                       {
                           TableId tableId = 
Schema.instance.getTableMetadata(KEYSPACE, TABLE).id;
                           Token token = 
DatabaseDescriptor.getPartitioner().getMinimumToken();
                           Collection<Range<Token>> ranges = 
Collections.singleton(new Range<>(token, token));
                           PaxosCleanupLocalCoordinator repair = 
PaxosCleanupLocalCoordinator.createForAutoRepair(SharedContext.Global.instance, 
tableId, ranges);
                           conds.beforeKeyspaceDrop.countDown();
                           conds.afterKeyspaceDrop.await();
                           repair.start();
                           PaxosCleanupResponse result = repair.get();
                           return !result.wasSuccessful && 
result.message.contains("Unknown keyspace: " + KEYSPACE);
                       }
                       catch (Exception e)
                       {
                           throw new RuntimeException(e);
                       }
                   }, conditions);
   
                   Assert.assertTrue(failedAsExpected);
   
   ```



-- 
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: pr-unsubscr...@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org
For additional commands, e-mail: pr-h...@cassandra.apache.org

Reply via email to