-
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-4541 Ephemeral znode owned by closed session visible in 1 of 3 servers #1925
Changes from 3 commits
e670dac
0444ede
02d9f8a
96f2104
83812a9
4aab1fd
ed275cb
51663e1
47eb1e8
84be071
ffa326b
840808c
882d640
5f5834b
3483274
0507f7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ public Learner getLearner() { | |
* @param request | ||
jonmv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*/ | ||
public void commitRequest(Request request) { | ||
if (syncRequestProcessorEnabled) { | ||
if (syncProcessor != null) { | ||
// Write to txnlog and take periodic snapshot | ||
syncProcessor.processRequest(request); | ||
} | ||
|
@@ -107,6 +107,9 @@ protected void setupRequestProcessors() { | |
syncProcessor = new SyncRequestProcessor(this, null); | ||
syncProcessor.start(); | ||
} | ||
else { | ||
syncProcessor = null; | ||
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. syncProcessor as an ObserverZooKeeperServer field should have a default value of null. 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. No, I'm just used to always assigning (to final fields). This can be removed again. |
||
} | ||
} | ||
|
||
/* | ||
|
@@ -127,18 +130,6 @@ public String getState() { | |
return "observer"; | ||
} | ||
|
||
@Override | ||
public synchronized void shutdown() { | ||
if (!canShutdown()) { | ||
LOG.debug("ZooKeeper server is not running, so not proceeding to shutdown!"); | ||
return; | ||
} | ||
super.shutdown(); | ||
if (syncRequestProcessorEnabled && syncProcessor != null) { | ||
syncProcessor.shutdown(); | ||
} | ||
} | ||
|
||
@Override | ||
public void dumpMonitorValues(BiConsumer<String, Object> response) { | ||
super.dumpMonitorValues(response); | ||
|
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; | ||
|
||
import org.apache.zookeeper.ZooDefs.OpCode; | ||
import org.apache.zookeeper.server.Request; | ||
import org.apache.zookeeper.server.RequestProcessor; | ||
|
@@ -64,7 +66,8 @@ public void flush() throws IOException { | |
} catch (IOException e) { | ||
LOG.warn("Closing connection to leader, exception during packet send", e); | ||
try { | ||
if (!learner.sock.isClosed()) { | ||
Socket socket = learner.sock; | ||
if ( socket != null && ! learner.sock.isClosed()) { | ||
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. Should probably use 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. Thanks, that was of course the intention :) Fixed! 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. hi jonmv, i have read the jira-4541. I am confusing. ZK1 does not send ack to leader , ZK1 recieves commit from leader. It seems not conform ZAB protocol. Please help me figure out, thanks |
||
learner.sock.close(); | ||
} | ||
} catch (IOException e1) { | ||
|
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.
I'm a little worried about the modification here has an impact on the invoking chain.
Before modification: Leader.shutdown(String) -> LeaderZooKeeperServer.shutdown() -> ZooKeeperServer.shutdown()
After modification: Leader.shutdown() -> ZooKeeperServer.shutdown()
LeaderZooKeeperServer.shutdown is skipped and containerManager does not stop.
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.
ZooKeeperServer.shutdown()
only callsshutdown(false)
, which is implemented inLeaderZooKeeperServer
, and which stops thecontainerManager
.shutdown()
isn't overridden anywhere anymore.