-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-28563 Closing ZooKeeper in ZKMainServer #5869
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
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.
lgtm. Just a few nitpicks.
The problem of non-daemon Netty threads has probably already been resolved by:
ZOOKEEPER-4804 Use daemon threads for Netty client
and the original HACK is probably not needed either, but otherwise looks okay.
private static class HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain extends ZooKeeperMain | ||
implements Closeable { |
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.
Probably not scope of this ticket, but ZOOKEEPER-1897 resolved long ago. Do we still need this class?
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.
We have bumped our zookeeper dependency to 3.8.x, do we still need this?
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.
Thank you for reviewing the code and thank you for mentioning ZOOKEEPER-4804.
I did not know that non-daemon Netty threads issue had been resolved in ZooKeeper.
It seems that the HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain
class is no longer necessary.
Instead of using HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain
, it might be better to use ZooKeeperMain
directly.
ZooKeeperMain
also closes ZooKeeper
when a timeout occurs.
However, it seems that the ZOOKEEPER-4804 patch is not applied in the 3.8.4 version used by HBase.
Therefore, in order to remove HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain
, it appears that a ZooKeeper version upgrade(3.8.4 -> 3.9.x) is necessary.
Two options are suggested below. Which option would be the most appropriate?
- Upgrade ZooKeeper to version 3.9.x and remove
HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain
.
Is it safe to upgrade ZooKeeper to version 3.9.x? I am concerned that other issues may arise. - Always ensure
HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain
performs closing. (Current approach)
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.
Better also add ZOOKEEPER-4804 in the comment so others will know why we still need this hack.
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.
Thank you for your advice.
I have added ZOOKEEPER-4804 to the comments.
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.
Sounds good to me, thanks.
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 pleased to inform that the code review has been approved and the CI checks have passed successfully.
If possible, would you kindly merge this code? I apologize for any inconvenience, but I don't have the necessary permissions to perform the merge myself.
Alternatively, if there are any additional steps required to proceed with the merge, please advise me.
@@ -61,6 +61,7 @@ public static ZooKeeper ensureConnectedZooKeeper(ZooKeeper zookeeper, int timeou | |||
while (!zookeeper.getState().isConnected()) { | |||
Threads.sleep(1); | |||
if (stopWatch.elapsed(TimeUnit.MILLISECONDS) > timeout) { | |||
zookeeper.close(); |
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 suspect you added this to cover the case when constructor of HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain
failes and close() not getting called. I think you might want to do this within the constructor by putting ZooKeeperHelper.ensureConnectedZooKeeper(this.zk, 30000);
in a try-catch block to keep responsibility inside the class.
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.
Thank you for reviewing
I have changed the code to handle ZooKeeperConnectionException in the constructor.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Andor Molnár <andor@apache.org> (cherry picked from commit 23fa363)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Andor Molnár <andor@apache.org> (cherry picked from commit 23fa363)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Andor Molnár <andor@apache.org> (cherry picked from commit 23fa363)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Andor Molnár <andor@apache.org> (cherry picked from commit 23fa363)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Andor Molnár <andor@apache.org> (cherry picked from commit 23fa363)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Reviewed-by: Andor Molnár <andor@apache.org>
HBASE-28563
close
to HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain