GeezerVison is showing github.com — Refactor JGroups pull state logic and update cluster documentation by diegolovison · Pull Request #998 · Hyperfoil/Hyperfoil
Conversation
Partial fix: #993 ( the issue was updated )
Done:
- Correctness: repullState() has no pendingOps guard
- Test coverage: "removed queue still passes / needs a failing test"
- All 5 stale comments/docs items
- The minor mutate()/writeLock javadoc item
Open:
- JGroupsChaosTest injects faults below NAKACK2/UNICAST3
- JGroupsChaosTest's pending-op queue is never exercised
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Diego, the repullState guard does fix the race from #993. With the PR's tests on master production code
(plus only the no-op beforePullResponsesApplied hook so the test base compiles), RepullStateRaceTest fails
20/20, and on head it passes every run. A few things before merging:
-
The coalescing in repullState() drops a second repull. If a pull is already in flight, the new code returns,
but that pull was cast to the previous view, so a member readmitted by a later view change is never asked. On
master, both pulls ran. I wrote a scratch test with nodes peer/Q/X. Peer has lost X's slice (purge+admit, like
RepullStateRaceTest). X's unicasts are muted (DISCARD above UNICAST3), peer runs repull #1, X is unmuted after
500 ms, and peer runs repull #2. On master, X's data is back at ~502 ms (3/3). On head, it is still missing after
30 s (3/3). Suggested fix: when beginPull() finds a pull in flight, set a repullRequested flag under
pullLock. After completePull drains, if it is set, pull again. That also closes the existing gap where a
readmit during the join pull is skipped.
-
shouldConvergeWhenNodeJoinsMidWorkloadUnderDelay never queues anything. I added a temporary print of the
pendingOps size in endPull. It shows queued=1 in JoinPullRaceTest and RepullStateRaceTest, but
queued=0 at every node in 8/8 runs of this test. With beginPull() removed from join(), JoinPullRaceTest
fails 5/5 and this test passes 5/5. So the Javadoc's "forcing the system to use the pendingOps queue" is not true
today. Either make it overlap for real and assert that something was queued, or drop the claim. JoinPullRaceTest
already covers that #993 item.
-
Repulls now hold every delta until the pull completes. With one unresponsive member, that is the full 5 s.
Muting one node's unicasts and registering a consumer on a healthy node: the registration showed up at the pulling
node after ~4.8 s on head (5/5), versus ~28 ms on master (3/3). This is probably the right trade, but please
document it next to pendingOps.
-
Please keep the original Javadoc and add only what the issue asked for. The rewrite drops rationale:
- why
repullState exists at all (tombstone plus early announcement)
- the MFC-blocking note in
mutate, which is the actual cost of the trade-off the issue asked to document
- the SHUFFLE
max_time default note
Also, "If we put faults above NAKACK2, the tests would fail" needs either a run behind it or a softer wording.
-
Teardown. The assertions still run after heal() and poll, so I don't see it hiding failures. For what it's worth, I measured it: with master's teardown order, SHARED_LOOPBACK logs NullPointerException ... Protocol.up in 5/5 chaos runs, and with yours in 1/20. So it does help, but that belongs in the commit message. Also note that in JGroups 5.5.7 DELAY's
handler thread never exits. It is for(;;) around a non-blocking drainTo, and every exception is swallowed. A
scratch test showed it still alive after destroy() and burning ~995 ms of CPU per second. With the new test,
by my count of instances (I did not take a thread dump), each chaos run leaves 6 of them spinning in the surefire JVM. The new comment suggests the thread "finishes its
work". It doesn't.
-
Smaller items:
- Make
beforePullResponsesApplied/afterSliceEncoded package-private rather than protected API.
- The reflection helpers only target Hyperfoil's own members (nothing JGroups-internal).
ClusterState.purge/admit
are package-private already, so a package-private state() accessor would let the compiler catch renames.
newManager(String, Runnable...) now ignores every hook after the first.
- The PR description should state the problem and the evidence, and say which #993 items are addressed or
declined (faults above NAKACK2).
- Please squash the 9 commits ("Refection refactor", "format", ...) into one, or fix+tests and docs.
The docs changes (hyperfoil default name, node_name uniqueness, ClusterState locking) match the code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
if (pendingOps != null) {
|
|
|
return;
|
|
|
}
|
|
|
if (!beginPull()) {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This drops a repull issued while another pull is in flight. That pull was cast to the earlier view, so a member readmitted later is never asked. Scratch test: master recovers X at ~502 ms (3/3), head never does within 30 s (3/3). Suggest a repullRequested flag that completePull honours after draining.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* would apply its deltas before the slice they were queued to follow, and {@link ClusterState} would then
|
|
|
* reject that slice as stale. A join already pulls for itself, so there is nothing to add.
|
|
|
* Calling {@link #beginPull} creates a new queue only if one does not already exist. If another
|
|
|
* pull is already running, this method does nothing (the other pull will handle the updates).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the other pull will handle the updates" only holds if the other pull was cast to the same view. Please also keep the original paragraph explaining why repullState exists (tombstone plus early announcement).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* from peers, but before saving it. This helps test what happens when another data change
|
|
|
* ({@link #mutate}) happens at the exact same time. It does nothing in real production.
|
|
|
*/
|
|
|
protected void beforePullResponsesApplied() {
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Package-private instead of protected? Same for afterSliceEncoded. The tests are in the same package.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* <p>
|
|
|
* We use the {@code DELAY} fault here on purpose. It makes the network slow, which stretches the time
|
|
|
* it takes for the new node to download the full state. This creates a longer window of time for small
|
|
|
* data updates (deltas) to arrive during the download, forcing the system to use the {@code pendingOps} queue.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Measured pendingOps size at drain: 0 at every node in 8/8 runs, and the test passes 5/5 with the join queue removed. It does not force the queue.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* <li><b>Testing realistic chaos:</b> By putting faults below NAKACK2, we test what happens
|
|
|
* on a real network. We prove that the system stays stable even if the raw network loses,
|
|
|
* duplicates, or reorders messages.</li>
|
|
|
* <li><b>Breaking the rules:</b> If we put faults <i>above</i> NAKACK2, the tests would fail.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a run behind "the tests would fail"? If not, please phrase it as the design assumption.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
// the network links and causes errors in the log.
|
|
|
// (The system would safely resend the lost message anyway, but we want to avoid messy log errors).
|
|
|
try {
|
|
|
Thread.sleep(200);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 5.5.7, DELAY's handler thread never finishes: for(;;) around a non-blocking drainTo, and exceptions are swallowed. It stays alive after destroy() at ~1 core of CPU. The reordering does cut the SHARED_LOOPBACK NPEs (Protocol.up) from 5/5 runs to 1/20, so please say that in the comment or the commit message, not that the thread finishes.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
* Use this for tests where you need to start the join process manually.
|
|
|
*/
|
|
|
protected JGroupsClusterManager newManager(String clusterName, Runnable... afterSliceEncoded) {
|
|
|
return newManager(clusterName, afterSliceEncoded.length == 0 ? null : afterSliceEncoded[0], null);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Silently ignores every hook after the first. Either keep the loop or change the signature to a single Runnable.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@jabolina if you could take a look at:
The other changes are testing, you can skip if you wish.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|