ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling so…#996
ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling so…#996enixon wants to merge 3 commits into
Conversation
|
Recreating #767 . That pull request had to be reverted because it was causing |
|
|
||
| void closeSocket() { | ||
| try { | ||
| if (sock != null && !sock.isClosed()) { |
There was a problem hiding this comment.
Just curious: why checking 'isClosed' ? Can't we call 'close' multiple times?
There was a problem hiding this comment.
You're completely right, this check doesn't actually contribute anything - I'll remove it.
| int previousTick = servers.mt[leader].main.quorumPeer.tickTime; | ||
| servers.mt[leader].main.quorumPeer.tickTime = LEADER_TIMEOUT_MS; | ||
| // let the previous tick on the leader exhaust itself so the new tick time takes effect | ||
| Thread.sleep(previousTick); |
There was a problem hiding this comment.
How is this change related to this patch?
There was a problem hiding this comment.
It comes down to timing. This test needs the leader to lag behind the actions taking place on the other servers and this change gives the test the full advantage of the leader's changed tick time. It seems that closing the socket alters the timing such that the stale Leader gets an earlier awareness of its stale status without the change.
|
retest maven build |
|
ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum fails on this change because it relies on the old behavior to prop a Leader up long enough for reconfig to fail. I'm trying to find a way to reconstruct that same behavior - if I can't, I'll have to delete the test. |
…relies on the fixed buggy behavior
anmolnar
left a comment
There was a problem hiding this comment.
+1 lgtm
Please keep an eye on the test that you added sleep() to. I'm afraid we're facing a new flaky test.
|
merged to master. thanks. |
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket Author: Brian Nixon <nixon@fb.com> Reviewers: hanm@apache.org, eolivelli@apache.org, andor@apache.org Closes apache#996 from enixon/learner-close-socket and squashes the following commits: 57f5e89 [Brian Nixon] delete ReconfigFailureCasesTest::testLeaderTimesoutOnNewQuorum as it relies on the fixed buggy behavior 1598b3a [Brian Nixon] remove extraneous check on socket status 381889d [Brian Nixon] ZOOKEEPER-3240: Close socket on Learner shutdown to avoid dangling socket
…cket