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 2023/08/16 17:17:45 UTC
[GitHub] [cassandra-accord] dcapwell commented on a diff in pull request #58: Improvements to chaos and various bug fixes
dcapwell commented on code in PR #58:
URL: https://github.com/apache/cassandra-accord/pull/58#discussion_r1296194918
##########
accord-core/src/test/java/accord/burn/random/FrequentLargeRange.java:
##########
@@ -18,59 +18,123 @@
package accord.burn.random;
-import accord.utils.Invariants;
+import accord.utils.Gen.LongGen;
import accord.utils.RandomSource;
-public class FrequentLargeRange implements RandomLong
+import java.time.Duration;
+import java.util.concurrent.TimeUnit;
+import java.util.function.LongSupplier;
+import java.util.function.Predicate;
+
+public class FrequentLargeRange implements LongGen
{
- private final RandomLong small, large;
- private final double ratio;
- private final int steps;
- private final double lower, upper;
- private int run = -1;
- private long smallCount = 0, largeCount = 0;
-
- public FrequentLargeRange(RandomLong small, RandomLong large, double ratio)
+ private final LongGen small, large;
+ private final Predicate<RandomSource> runs;
+
+ public FrequentLargeRange(LongGen small, LongGen large, double ratio)
{
- Invariants.checkArgument(ratio > 0 && ratio <= 1);
this.small = small;
this.large = large;
- this.ratio = ratio;
- this.steps = (int) (1 / ratio);
- this.lower = ratio * .8;
- this.upper = ratio * 1.2;
+ this.runs = random -> random.decide(ratio);
Review Comment:
why this change? This removes the `runs` logic which we added awhile back. We found back then that we really don't see runs > 3 with this style, so the other logic helps improve run length
##########
accord-core/src/test/java/accord/impl/basic/Cluster.java:
##########
@@ -105,26 +148,17 @@ NodeSink create(Id self, RandomSource random)
return sink;
}
- private void add(Packet packet)
+ void add(Packet packet, long delay, TimeUnit unit)
{
MessageType type = packet.message.type();
if (type != null)
statsMap.computeIfAbsent(type, ignore -> new Stats()).count++;
- boolean isReply = packet.message instanceof Reply;
if (trace.isTraceEnabled())
- trace.trace("{} {} {}", clock++, isReply ? "RPLY" : "SEND", packet);
+ trace.trace("{} {} {}", clock++, packet.message instanceof Reply ? "RPLY" : "SEND", packet);
if (lookup.apply(packet.dst) == null) responseSink.accept(packet);
- else pending.add(packet);
- }
+ else if (delay == 0) pending.add(packet);
Review Comment:
your rebase looks to be missing the recent commit where I dropped this branch; `pending.add` is impl as `add(packet, 0, nanos)` so no reason to special case this
##########
accord-core/src/main/java/accord/impl/AbstractConfigurationService.java:
##########
@@ -269,6 +269,13 @@ public synchronized void reportTopology(Topology topology, boolean startSync)
}
long lastAcked = epochs.lastAcknowledged;
+ // TODO (now, review): lastAcked == 0, lastReceived = 2
+ // if we wait for epoch=1.acknowledge the test seems to wait forever... looks like burn test doesn't ack epoch=1
Review Comment:
think we can remove this TODO
##########
accord-core/src/test/java/accord/impl/list/ListHeartbeat.java:
##########
@@ -16,17 +16,18 @@
* limitations under the License.
*/
-package accord.burn.random;
+package accord.impl.list;
-import accord.utils.RandomSource;
+import accord.messages.MessageType;
+import accord.messages.Reply;
-public interface RandomInt extends RandomLong
+public enum ListHeartbeat implements Reply
Review Comment:
this is dead code now. After rebasing against eviction I changed how the heartbeat worked, so its no longer its own message but instead its just a state in the ListResult.Fault
##########
accord-core/src/test/java/accord/impl/basic/RandomDelayQueue.java:
##########
@@ -114,6 +127,12 @@ public boolean remove(Pending item)
return queue.remove(item);
}
+ @Override
+ public void add(Pending item, long minDelay, long maxDelay, TimeUnit units)
+ {
+ queue.add(new Item(now + units.toMillis(random.nextLong(minDelay, maxDelay + 1)), seq++, item));
Review Comment:
so use a uniform random in the range? Ill try to find the caller, but this goes against the bias we talked about before
##########
accord-core/src/test/java/accord/impl/basic/NodeSink.java:
##########
@@ -33,11 +40,20 @@
import accord.messages.Reply;
import accord.messages.ReplyContext;
import accord.messages.Request;
+import com.google.common.collect.ImmutableSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static accord.impl.basic.Packet.SENTINEL_MESSAGE_ID;
+import static java.util.concurrent.TimeUnit.MICROSECONDS;
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
public class NodeSink implements MessageSink
{
+ private static final boolean DEBUG = false;
+
+ public enum Action { DELIVER, DROP, FAILURE }
Review Comment:
missing recent commits
--
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