This is an automated email from the ASF dual-hosted git repository. benedict pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git
commit 0980e52bf5f14c3bf1353a8d68c10f5accd8c287 Author: Benedict Elliott Smith <bened...@apache.org> AuthorDate: Mon May 12 14:00:55 2025 +0100 Fix medium path decisions when fast path is delayed patch by Benedict; reviewed by Ariel Weisberg for CASSANDRA-20644 --- .../java/accord/coordinate/tracking/FastPathTracker.java | 12 ++++++------ .../coordinate/tracking/FastPathTrackerReconciler.java | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/accord-core/src/main/java/accord/coordinate/tracking/FastPathTracker.java b/accord-core/src/main/java/accord/coordinate/tracking/FastPathTracker.java index f1fa1eae..7c95b1d8 100644 --- a/accord-core/src/main/java/accord/coordinate/tracking/FastPathTracker.java +++ b/accord-core/src/main/java/accord/coordinate/tracking/FastPathTracker.java @@ -84,7 +84,7 @@ public class FastPathTracker extends PreAcceptTracker<FastPathTracker.FastPathSh return complete(NewFastPathSuccess); } - return quorumIfHasRejectedFastPath(); + return quorumIfFastPathRejectedOrDelayed(); } public final ShardOutcome<? super FastPathTracker> onFailure(@Nonnull Node.Id from) @@ -115,16 +115,16 @@ public class FastPathTracker extends PreAcceptTracker<FastPathTracker.FastPathSh { ++fastPathDelayed; - if (isFastPathDelayed() && hasReachedQuorum()) + if (fastPathIsDelayed() && hasReachedQuorum()) return mediumOrSlowSuccess(); } return NoChange; } - final ShardOutcome<? super FastPathTracker> quorumIfHasRejectedFastPath() + final ShardOutcome<? super FastPathTracker> quorumIfFastPathRejectedOrDelayed() { - return hasReachedQuorum() && hasRejectedFastPath() + return hasReachedQuorum() && (hasRejectedFastPath() || fastPathIsDelayed()) ? mediumOrSlowSuccess() : NoChange; } @@ -134,7 +134,7 @@ public class FastPathTracker extends PreAcceptTracker<FastPathTracker.FastPathSh return hasMetMediumPathCriteria() ? complete(NewMediumPathSuccess) : complete(Success); } - final boolean isFastPathDelayed() + final boolean fastPathIsDelayed() { return shard.rejectsFastPath(fastQuorumSize, fastPathDelayed); } @@ -187,7 +187,7 @@ public class FastPathTracker extends PreAcceptTracker<FastPathTracker.FastPathSh if (shard.isInFastPath(node)) ++fastPathFailures; // Quorum success can not count towards fast path success - return quorumIfHasRejectedFastPath(); + return quorumIfFastPathRejectedOrDelayed(); } } diff --git a/accord-core/src/test/java/accord/coordinate/tracking/FastPathTrackerReconciler.java b/accord-core/src/test/java/accord/coordinate/tracking/FastPathTrackerReconciler.java index 7b2a319e..87ae2692 100644 --- a/accord-core/src/test/java/accord/coordinate/tracking/FastPathTrackerReconciler.java +++ b/accord-core/src/test/java/accord/coordinate/tracking/FastPathTrackerReconciler.java @@ -66,12 +66,13 @@ public class FastPathTrackerReconciler extends TrackerReconciler<FastPathShardTr case Success: Assertions.assertTrue(tracker.all(FastPathShardTracker::hasReachedQuorum)); - Assertions.assertTrue(tracker.all(shard -> shard.hasRejectedFastPath() || shard.hasMetFastPathCriteria() || shard.isFastPathDelayed())); + Assertions.assertTrue(tracker.all(shard -> shard.hasRejectedFastPath() || shard.hasMetFastPathCriteria() || shard.fastPathIsDelayed())); Assertions.assertFalse(tracker.any(FastPathShardTracker::hasFailed)); break; case NoChange: - Assertions.assertFalse(tracker.all(shard -> shard.hasRejectedFastPath() || shard.hasMetFastPathCriteria()) && tracker.all(FastPathShardTracker::hasReachedQuorum)); + Assertions.assertFalse(tracker.all(FastPathShardTracker::hasMetFastPathCriteria)); + Assertions.assertFalse(tracker.all(shard -> shard.hasRejectedFastPath() || shard.hasMetFastPathCriteria() || shard.fastPathIsDelayed()) && tracker.all(FastPathShardTracker::hasReachedQuorum)); Assertions.assertFalse(tracker.any(FastPathShardTracker::hasFailed)); } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org