You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "dcapwell (via GitHub)" <gi...@apache.org> on 2024/12/04 19:05:39 UTC

[PR] CASSANDRA-20127 [cassandra]

dcapwell opened a new pull request, #3723:
URL: https://github.com/apache/cassandra/pull/3723

   (no comment)


-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "belliottsmith (via GitHub)" <gi...@apache.org>.
belliottsmith merged PR #3723:
URL: https://github.com/apache/cassandra/pull/3723


-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870143871


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/AbstractPairOfSequencesPaxosSimulation.java:
##########
@@ -130,53 +131,60 @@ protected ActionList performSimple()
             {
                 LogAction logs = inst.logs();
 
-                LogResult<List<String>> errors = logs.grepForErrors();
-                if (!errors.getResult().isEmpty())
-                {
-                    List<Pair<String, String>> errorsSeen = new ArrayList<>();
-                    for (String error : errors.getResult())
-                    {
-                        for (String line : error.split("\\n"))
-                        {
-                            line = line.trim();
-                            if (line.startsWith("ERROR")) continue;
-                            if (line.startsWith("at ")) continue;
-                            errorsSeen.add(Pair.create(line.split(":")[0], error));
-                            break;
-                        }
-                    }
-                    Class<? extends Throwable>[] expected = expectedExceptions();
-                    StringBuilder sb = new StringBuilder();
-                    for (Pair<String, String> pair : errorsSeen)
-                    {
-                        String name = pair.left;
-                        String exception = pair.right;
-                        Class<?> klass;
-                        try
-                        {
-                            klass = Class.forName(name);
-                        }
-                        catch (ClassNotFoundException e)
-                        {
-                            throw new RuntimeException(e);
-                        }
-
-                        if (!Stream.of(expected).anyMatch(e -> e.isAssignableFrom(klass)))
-                            sb.append("Unexpected exception:\n").append(exception).append('\n');
-                    }
-                    if (sb.length() > 0)
-                    {
-                        AssertionError error = new AssertionError("Saw errors in node" + inst.config().num() + ": " + sb);
-                        // this stacktrace isn't helpful, can be more confusing
-                        error.setStackTrace(new StackTraceElement[0]);
-                        throw error;
-                    }
-                }
+                checkErrorLogs(inst.config().num(), logs.grepForErrors());
                 return ActionList.empty();
             }
         };
     }
 
+    @VisibleForTesting
+    protected void checkErrorLogs(int node, LogResult<List<String>> errors)
+    {
+        if (!errors.getResult().isEmpty())
+        {
+            List<Pair<String, String>> errorsSeen = new ArrayList<>();
+            for (String error : errors.getResult())
+            {
+                for (String line : error.split("\\n"))
+                {
+                    line = line.trim();
+                    if (line.startsWith("ERROR")) continue;
+                    if (line.startsWith("WARN")) continue;

Review Comment:
   I could have done `||` but tried to follow the pattern... grep for errors includes WARN logs, and durability scheduling is logging Invalidated as WARN, which is what caused the failure (there is a unit test with one of the matched lines to help prove this change works)



-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870145453


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/AccordClusterSimulation.java:
##########
@@ -39,28 +38,6 @@ public AccordClusterSimulation create(long seed) throws IOException
             random.reset(seed);
             return new AccordClusterSimulation(random, seed, uniqueNum, this);
         }
-
-        public void applyHandicaps()

Review Comment:
   been running in a loop locally and mostly looks fine to remove... since I was touching simulator figure fast to finally close this task...



-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870146835


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/PairOfSequencesAccordSimulation.java:
##########
@@ -150,6 +152,13 @@ public PairOfSequencesAccordSimulation(SimulatedSystems simulated,
         this.validator = validator;
     }
 
+    @Override
+    protected Class<? extends Throwable>[] expectedExceptions()
+    {
+        return (Class<? extends Throwable>[]) new Class<?>[] { RequestExecutionException.class,
+                                                               CoordinationFailed.class };

Review Comment:
   paxos test doesn't fail if `RequestExecutionException` are seen, which accord inherited.  But Accord has its own error types, so need to allow `CoordinationFailed`.  We could try to shrink this list, but figured if this was fine for paxos this is fine here?



-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870150386


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/PaxosTopologyChangeVerifier.java:
##########
@@ -58,7 +58,7 @@ public void before(Topology before, int[] participatingKeys)
     @Override
     public void after(Topology topologyAfter)
     {
-        afterInternal(topologyAfter.select(topologyBefore.primaryKeys));
+        afterInternal(topologyBefore == null ? topologyAfter : topologyAfter.select(topologyBefore.primaryKeys));

Review Comment:
   I was injecting errors into the read write validation logic to see how errors were handled and hit a code path where `topologyBefore` was null... not 100% sure this is correct, so do let me know... it looked correct when reviewing `select` logic



-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870144937


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/AbstractPairOfSequencesPaxosSimulation.java:
##########
@@ -130,53 +131,60 @@ protected ActionList performSimple()
             {
                 LogAction logs = inst.logs();
 
-                LogResult<List<String>> errors = logs.grepForErrors();
-                if (!errors.getResult().isEmpty())
-                {
-                    List<Pair<String, String>> errorsSeen = new ArrayList<>();
-                    for (String error : errors.getResult())
-                    {
-                        for (String line : error.split("\\n"))
-                        {
-                            line = line.trim();
-                            if (line.startsWith("ERROR")) continue;
-                            if (line.startsWith("at ")) continue;
-                            errorsSeen.add(Pair.create(line.split(":")[0], error));
-                            break;
-                        }
-                    }
-                    Class<? extends Throwable>[] expected = expectedExceptions();
-                    StringBuilder sb = new StringBuilder();
-                    for (Pair<String, String> pair : errorsSeen)
-                    {
-                        String name = pair.left;
-                        String exception = pair.right;
-                        Class<?> klass;
-                        try
-                        {
-                            klass = Class.forName(name);
-                        }
-                        catch (ClassNotFoundException e)
-                        {
-                            throw new RuntimeException(e);
-                        }
-
-                        if (!Stream.of(expected).anyMatch(e -> e.isAssignableFrom(klass)))
-                            sb.append("Unexpected exception:\n").append(exception).append('\n');
-                    }
-                    if (sb.length() > 0)
-                    {
-                        AssertionError error = new AssertionError("Saw errors in node" + inst.config().num() + ": " + sb);
-                        // this stacktrace isn't helpful, can be more confusing
-                        error.setStackTrace(new StackTraceElement[0]);
-                        throw error;
-                    }
-                }
+                checkErrorLogs(inst.config().num(), logs.grepForErrors());
                 return ActionList.empty();
             }
         };
     }
 
+    @VisibleForTesting
+    protected void checkErrorLogs(int node, LogResult<List<String>> errors)
+    {
+        if (!errors.getResult().isEmpty())
+        {
+            List<Pair<String, String>> errorsSeen = new ArrayList<>();
+            for (String error : errors.getResult())
+            {
+                for (String line : error.split("\\n"))
+                {
+                    line = line.trim();
+                    if (line.startsWith("ERROR")) continue;
+                    if (line.startsWith("WARN")) continue;
+                    if (line.startsWith("at ")) continue;
+                    errorsSeen.add(Pair.create(line.split(":")[0], error));

Review Comment:
   without the filter on `WARN` we were trying to parse the message line and not the error line... the error line is line 2, the message is line 1...



-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870148418


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/PairOfSequencesAccordSimulation.java:
##########
@@ -182,7 +191,7 @@ public class ReadWriteOperation extends Operation
 
         public ReadWriteOperation(int id, int[] primaryKeys, IntHashSet reads, IntHashSet writes, IInvokableInstance instance)
         {
-            super(primaryKeys, id, instance, "Accord", createQuery(id, reads, writes));
+            super(primaryKeys, id, instance, "Accord ReadWrite Txn", createQuery(id, reads, writes));

Review Comment:
   while running the tests in the loop I wanted to validate what actions were run and used `Action.description()` to get this visibility.  Just saying `Accord` felt weird, so made a bit more verbose.
   
   This change itself is a no-op in the single partition case, there was a bug there that caused the `idString` to get dropped



-- 
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-unsubscribe@cassandra.apache.org

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


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


Re: [PR] CASSANDRA-20127 [cassandra]

Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #3723:
URL: https://github.com/apache/cassandra/pull/3723#discussion_r1870149416


##########
test/simulator/main/org/apache/cassandra/simulator/paxos/PaxosSimulation.java:
##########
@@ -72,7 +72,7 @@ public abstract class PaxosSimulation implements Simulation, ClusterActionListen
 
     private static String createDescription(int[] primaryKeys, int id, String idString)
     {
-        return primaryKeys.length == 1 ? Integer.toString(primaryKeys[0]) : Arrays.toString(primaryKeys) + "/" + id + ": " + idString;
+        return (primaryKeys.length == 1 ? Integer.toString(primaryKeys[0]) : Arrays.toString(primaryKeys)) + "/" + id + ": " + idString;

Review Comment:
   not sure if it was intentional or not, but looking at the logs and seeing `-4` as the only description was confusing... the previous logic would only add `id` and `idString` if-and-only-if `partitionKeys.length != 1`



-- 
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-unsubscribe@cassandra.apache.org

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


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