|
iamct
2012-06-04, 02:41
Wangpei
2012-06-04, 04:01
iamct
2012-06-04, 06:36
iamct
2012-06-04, 06:37
Wangpei
2012-06-04, 10:44
iamct
2012-06-04, 14:45
李赫元
2012-06-04, 15:47
Patrick Hunt
2012-06-04, 22:24
Wangpei
2012-06-05, 01:55
iamct
2012-06-05, 08:25
Michi Mutsuzaki
2012-06-05, 17:44
iamct
2012-06-06, 02:56
Michi Mutsuzaki
2012-06-06, 07:23
|
-
when the zookeeper Expired ,may I have to rebuild the watch on a znode?iamct 2012-06-04, 02:41
I had seted a watch on one znode.When the zookeeper session expired,I create
a new zookeeper session. The watch I had seted is effective ? I can/t find a answer in FAQ. How can i do? -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?Wangpei 2012-06-04, 04:01
No. setting watcher is binds to session, so it will not triggered anymore.
you have to set the watcher again on the new session, do it yourself. My way is writing a reconnect watcher decorator, this class add a connection watcher and it rebuild watcher. A connection wrapper should simplify the code. -----邮件原件----- 发件人: iamct [mailto:[EMAIL PROTECTED]] 发送时间: 2012年6月4日 10:42 收件人: [EMAIL PROTECTED] 主题: when the zookeeper Expired ,may I have to rebuild the watch on a znode? I had seted a watch on one znode.When the zookeeper session expired,I create a new zookeeper session. The watch I had seted is effective ? I can/t find a answer in FAQ. How can i do? -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?iamct 2012-06-04, 06:36
Thank you very much。
Can you give a example? -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577515.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?iamct 2012-06-04, 06:37
Thank you !
And you said “No. setting watcher is binds to session, so it will not triggered anymore. you have to set the watcher again on the new session, do it yourself. My way is writing a reconnect watcher decorator, this class add a connection watcher and it rebuild watcher. A connection wrapper should simplify the code.” can you give me a example? Thank you very much! -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577517.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?Wangpei 2012-06-04, 10:44
curator is a good high level client lib, it may help you much.
my implement is a home-made lib, I do not found curator that time :( with a connection wrapper like curator client, the watcher decorator is quite simple. Inner connection watcher will trigger when old session expired and new session open again. this connection watcher set the watcher, checks Stat and trigger the watcher if needed. -----邮件原件----- 发件人: iamct [mailto:[EMAIL PROTECTED]] 发送时间: 2012年6月4日 14:36 收件人: [EMAIL PROTECTED] 主题: Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode? Thank you very much。 Can you give a example? -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577515.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?iamct 2012-06-04, 14:45
Thank you!
I have another question。 I set a watch on one znode。 A change happen,the service my client had connected sent the packet ,but this time,my client becomes partitioned from the ZK serving cluster。 When my session reconnect,may I get the event? I think it is not。 but in the http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches said : ZooKeeper provides an ordering guarantee: a client will never see a change for which it has set a watch until it first sees the watch event. -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577520.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?李赫元 2012-06-04, 15:47
ZK only guarantee on write sequence to zookeeper, not watch recv by client.
2012/6/4 iamct <[EMAIL PROTECTED]>: > Thank you! > I have another question。 > > I set a watch on one znode。 A change happen,the service my client had > connected sent the packet ,but this time,my client becomes partitioned from > the ZK serving cluster。 > When my session reconnect,may I get the event? > > I think it is not。 > but in the > http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches > said : ZooKeeper provides an ordering guarantee: a client will never see a > change for which it has set a watch until it first sees the watch event. > > > > > -- > View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577520.html > Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?Patrick Hunt 2012-06-04, 22:24
On Mon, Jun 4, 2012 at 7:45 AM, iamct <[EMAIL PROTECTED]> wrote:
> > I set a watch on one znode。 A change happen,the service my client had > connected sent the packet ,but this time,my client becomes partitioned from > the ZK serving cluster。 > When my session reconnect,may I get the event? > Yes, you will get the notification when (if) the session eventually reconnects to the service. > I think it is not。 > but in the > http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches > said : ZooKeeper provides an ordering guarantee: a client will never see a > change for which it has set a watch until it first sees the watch event. > That's correct. When the client reconnects you'll get any notifications that you missed. Patrick
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?Wangpei 2012-06-05, 01:55
If it is the same session that it connect to another server, I believe the answer is yes.
If the old session is expired and a new session is create, the watch not get the event. You need to set watch with new session, and those calls will return the changed data/state. So you need to process those in your reconnect logic. A tip: do not keep whole data or children, just the version or cversion. -----邮件原件----- 发件人: iamct [mailto:[EMAIL PROTECTED]] 发送时间: 2012年6月4日 22:46 收件人: [EMAIL PROTECTED] 主题: Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode? Thank you! I have another question。 I set a watch on one znode。 A change happen,the service my client had connected sent the packet ,but this time,my client becomes partitioned from the ZK serving cluster。 When my session reconnect,may I get the event? I think it is not。 but in the http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#ch_zkWatches said : ZooKeeper provides an ordering guarantee: a client will never see a change for which it has set a watch until it first sees the watch event. -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577520.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?iamct 2012-06-05, 08:25
Thank you all
I have another question。 I set a watch (getData)on a znode。the getData api said : <p> * If the watch is non-null and the call is successful (no exception is * thrown), a watch will be left on the node with the given path. The watch * will be triggered by a successful operation that sets data on the node, or * deletes the node. * <p> I used the method “Is there an easy way to expire a session for testing?” to imitate the expire (in https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ�� in the process,I can/t update the znode ,why the watch be triggered. I found the WatchedEvent state is Disconnected and Expired. I can/t found the triggered condition in the zookeeper wiki and api. I am confuse. help me! Thank you ! -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577533.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?Michi Mutsuzaki 2012-06-05, 17:44
The event is called "None" (not a great name) in Java API. It's for
notifying the watches that the session state has changed. http://zookeeper.apache.org/doc/r3.4.1/api/org/apache/zookeeper/Watcher.Event.EventType.html It's up to you to decide how to handle these events. This page provides a good insight about error handling in zookeeper. http://wiki.apache.org/hadoop/ZooKeeper/ErrorHandling --Michi On Tue, Jun 5, 2012 at 1:25 AM, iamct <[EMAIL PROTECTED]> wrote: > Thank you all > I have another question。 > > I set a watch (getData)on a znode。the getData api said : > <p> > * If the watch is non-null and the call is successful (no exception is > * thrown), a watch will be left on the node with the given path. The > watch > * will be triggered by a successful operation that sets data on the > node, or > * deletes the node. > * <p> > > I used the method “Is there an easy way to expire a session for testing?” to > imitate the expire > (in https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ��� > > in the process,I can/t update the znode ,why the watch be triggered. > I found the WatchedEvent state is Disconnected and Expired. > > I can/t found the triggered condition in the zookeeper wiki and api. I am > confuse. > > help me! Thank you ! > > > > > > > > -- > View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577533.html > Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?iamct 2012-06-06, 02:56
Thank you!
but i thank it/s not my answer。 My questiong is:using java api,I set a watch ( methed:getData(final String path, Watcher watcher, Stat stat) ) I know the watch can be triggered when NodeDataChanged and NodeDeleted ���the api tell me only the two EventType )。 but I found the watch was triggered by EventType.NOne when i try testing to expired a session。 (https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ Is there an easy way to expire a session for testing?) -- View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577535.html Sent from the zookeeper-user mailing list archive at Nabble.com.
-
Re: when the zookeeper Expired ,may I have to rebuild the watch on a znode?Michi Mutsuzaki 2012-06-06, 07:23
Watches are not considered triggered when the watch handlers get
called with EventType.None, They are merely being notified that the client got disconnected from ZooKeeper and they won't receive any watch events until the session gets re-established. When the client gets reconnected to ZooKeeper, it might find out that the session has been expired. In that case, all the watches associated with that sessions are lost. This page explains why ZooKeeper notifies watches about session events. http://zookeeper.apache.org/doc/r3.2.2/zookeeperProgrammers.html#ch_zkWatches {quote} When you disconnect from a server (for example, when the server fails), you will not get any watches until the connection is reestablished. For this reason session events are sent to all outstanding watch handlers. Use session events to go into a safe mode: you will not be receiving events while disconnected, so your process should act conservatively in that mode. {quote} --Michi On Tue, Jun 5, 2012 at 7:56 PM, iamct <[EMAIL PROTECTED]> wrote: > Thank you! > but i thank it/s not my answer。 > My questiong is:using java api,I set a watch > ( methed:getData(final String path, Watcher watcher, Stat stat) ) > > I know the watch can be triggered when NodeDataChanged and NodeDeleted (the > api tell me only the two EventType )。 > > but I found the watch was triggered by EventType.NOne when i try testing to > expired a session。 > > (https://cwiki.apache.org/confluence/display/ZOOKEEPER/FAQ > Is there an easy way to expire a session for testing?) > > -- > View this message in context: http://zookeeper-user.578899.n2.nabble.com/when-the-zookeeper-Expired-may-I-have-to-rebuild-the-watch-on-a-znode-tp7577513p7577535.html > Sent from the zookeeper-user mailing list archive at Nabble.com. |