[
https://issues.apache.org/jira/browse/ZOOKEEPER-2155?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
linking12 updated ZOOKEEPER-2155:
---------------------------------
Description:
When I set up a ZooKeeper ensemble that uses Observers, The network is not very
good.
I find all of the watcher disappear.
I read the source code and find:
When the observer connect to leader, will dump the DataTree from leader and
rebuild in observer.
But the datawachers and childWatches is cleared for this operation.
after i change code like:
WatchManager dataWatchers = zk.getZKDatabase().getDataTree()
.getDataWatches();
WatchManager childWatchers = zk.getZKDatabase().getDataTree()
.getChildWatches();
zk.getZKDatabase().clear();
zk.getZKDatabase().deserializeSnapshot(leaderIs);
zk.getZKDatabase().getDataTree().setDataWatches(dataWatchers);
zk.getZKDatabase().getDataTree().setChildWatches(childWatchers);
The watcher do not disappear
was:
When I set up a ZooKeeper ensemble that uses Observers, The network is not very
good.
I find all of the watcher disappear.
I read the source code and find:
When the observer connect to leader, will dump the DataTree from leader and
rebuild in observer.
But the datawachers and childWatches is cleared for this operation.
WatchManager dataWatchers = zk.getZKDatabase().getDataTree()
.getDataWatches();
WatchManager childWatchers = zk.getZKDatabase().getDataTree()
.getChildWatches();
zk.getZKDatabase().clear();
zk.getZKDatabase().deserializeSnapshot(leaderIs);
zk.getZKDatabase().getDataTree().setDataWatches(dataWatchers);
zk.getZKDatabase().getDataTree().setChildWatches(childWatchers);
> network is not good, the watcher in observer env will clear
> -----------------------------------------------------------
>
> Key: ZOOKEEPER-2155
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2155
> Project: ZooKeeper
> Issue Type: Bug
> Components: quorum
> Affects Versions: 3.4.6
> Reporter: linking12
> Fix For: 3.5.0
>
>
> When I set up a ZooKeeper ensemble that uses Observers, The network is not
> very good.
> I find all of the watcher disappear.
> I read the source code and find:
> When the observer connect to leader, will dump the DataTree from leader and
> rebuild in observer.
> But the datawachers and childWatches is cleared for this operation.
> after i change code like:
> WatchManager dataWatchers = zk.getZKDatabase().getDataTree()
> .getDataWatches();
> WatchManager childWatchers = zk.getZKDatabase().getDataTree()
> .getChildWatches();
> zk.getZKDatabase().clear();
> zk.getZKDatabase().deserializeSnapshot(leaderIs);
> zk.getZKDatabase().getDataTree().setDataWatches(dataWatchers);
> zk.getZKDatabase().getDataTree().setChildWatches(childWatchers);
> The watcher do not disappear
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)