-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-4712: Fix partially shutdown of ZooKeeperServer and its processors #2154
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c4e7e42
Avoid NPE when closing SendAckRequestProcessor after other failure
jonmv 8d055cc
Fix shutdown method overrides, so, e.g., SyncRequestProcessor is shut…
jonmv d82213e
Remove shutdown(boolean) from OZKS, which was identical to that of LZKS
jonmv 13001bf
Correctly propagate ZKDB.clear during shutdown of not-running ZKS chi…
jonmv 5d7aa33
Shut down sync processor before parent ZKS; it uses TXN-log during pa…
jonmv 41e6e95
ZOOKEEPER-4712: Add test case to assert request processors got shutdo…
kezhuw 56e959d
Merge pull request #1 from kezhuw/ZOOKEEPER-4712-test-case
jonmv c0682d7
Refactor shutdown to avoid requiring repeated logic in children
jonmv 3d6f619
Fix spotbugs failure
kezhuw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
|
||
import java.io.Flushable; | ||
import java.io.IOException; | ||
import java.net.Socket; | ||
|
||
jonmv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import org.apache.zookeeper.ZooDefs.OpCode; | ||
import org.apache.zookeeper.server.Request; | ||
import org.apache.zookeeper.server.RequestProcessor; | ||
|
@@ -46,7 +48,7 @@ public void processRequest(Request si) { | |
learner.writePacket(qp, false); | ||
} catch (IOException e) { | ||
LOG.warn("Closing connection to leader, exception during packet send", e); | ||
learner.closeSockSync(); | ||
learner.closeSocket(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 on this. This is the leftover of ZOOKEEPER-4409. We should respect |
||
} | ||
} | ||
} | ||
|
@@ -56,7 +58,7 @@ public void flush() throws IOException { | |
learner.writePacket(null, true); | ||
} catch (IOException e) { | ||
LOG.warn("Closing connection to leader, exception during packet send", e); | ||
learner.closeSockSync(); | ||
learner.closeSocket(); | ||
} | ||
} | ||
|
||
|
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.
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.
nit: Why have you moved the null check inside the lock?
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.
Close could be called from different threads, and
sockBeingClosed
ensures memory visibility forsock
, as it's set aftersock
is assigned inconnectToLeader
.The only other thread I can see that closes the learner, right now, is the sync processor, which is initialised after
sock
is assigned, so it works as-was, but I still prefer to be explicit about this.