Hi Xuefu,
Thanks for you response. Let me express more:
/**
* The watcher class which sets the de-register flag when the znode
corresponding to this server // 3. from the declare, it seems, the purpose
is to stop this hs2 instance forever, but this seems not correct in case the
znode is deleted as of session expired
* instance is deleted. Additionally, it shuts down the server if there are no
more active client
* sessions at the time of receiving a 'NodeDeleted' notification from ZooKeeper.
*/
private class DeRegisterWatcher implements Watcher {
@Override
public void process(WatchedEvent event) {
if (event.getType().equals(Watcher.Event.EventType.NodeDeleted)) { // 1.
znode is deleted(for eg. znode session expired etc)
if (znode != null) {
try {
znode.close(); // 2. inside this close, the state is set to State.CLOSED
so this hiveserver will deregister from the zookeeper forever. suppose all
hs2 instance do like this, then no hs2 instance can be found from zk. then
how end user can get hs2 instance? am i right?
LOG.warn("This HiveServer2 instance is now de-registered from ZooKeeper. "
+ "The server will be shut down after the last client sesssion completes.");
} catch (IOException e) {
LOG.error("Failed to close the persistent ephemeral znode", e);
} finally {
HiveServer2.this.setRegisteredWithZooKeeper(false);
// If there are no more active client sessions, stop the server
if (cliService.getSessionManager().getOpenSessionCount() == 0) {
LOG.warn("This instance of HiveServer2 has been removed from the list of server
"
+ "instances available for dynamic service discovery. "
+ "The last client session has ended - will shutdown now.");
HiveServer2.this.stop();
}
}
}
}
}
}
________________________________
wenli
Regards
From: Xuefu Zhang<mailto:[email protected]>
Date: 2015-10-13 00:51
To: [email protected]<mailto:[email protected]>
Subject: Re: regarding hiveserver2 DeRegisterWatcher
Can you articulate further why HiveServer2 is not working in such an event?
What's current behavior and what's expected from an end user's standpoint?
Thanks,
Xuefu
On Mon, Oct 12, 2015 at 6:52 AM, Wangwenli
<[email protected]<mailto:[email protected]>> wrote:
now hiveserver2 has multiple instance register to zookeeper, if zookeeper
recover from fault, the znode represent the hs2 instance got deleted(eg.
session timeout), the hiveserver2 will receive NodeDeleted event, in this
event, this hiveserver instance will unregister from zookeeper, suppose all
hiveserver instance do like this, then from end user perspective ,the
hiveserver cluster is no working.
so as per my opinion, the DeRegisterWatcher feature is not required. how
do you think ?
________________________________
wenli
Regards