li4wang commented on code in PR #1961: URL: https://github.com/apache/zookeeper/pull/1961#discussion_r1067613912
########## zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java: ########## @@ -1151,6 +1213,9 @@ protected void setLocalSessionFlag(Request si) { } public void submitRequest(Request si) { + if (state == State.MAINTENANCE) { + throw new IllegalStateException("Zookeeper server is in maintenance state"); + } Review Comment: > If you throw an exception here, the request will fail on the client side. I haven't tried it myself, have you valdiated that the client is able to seemlessly retry the command without bothering the user? I checked the scenario of sending client request while zk is in maintenance state. Here is what I found. 1. Connection/session creation will be retried but read/write operation will not. 2. The read/write request will fail even no exception is thrown here, because the request fails before sending to ZookeeperServer. Here is what happens: a) `ServerCnxn` detects that ZK server is not running and close the socket/channel. b) `ClientSocketCnxn.doTransport()` then detects that socket/channel is closed and throws IOException c) 'SendThread' catches the Exception, adds `ConnectionLoss` error reply header, clears up the outgoingQueue ann pendingQueue, and attempts to re-connect to server d) Zookeeper check the header and sends ConnectionLoss to user -- 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: notifications-unsubscr...@zookeeper.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org