You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by dragonsinth <gi...@git.apache.org> on 2015/07/22 03:51:50 UTC
[GitHub] curator pull request: TreeCache should inform listeners when its f...
GitHub user dragonsinth opened a pull request:
https://github.com/apache/curator/pull/92
TreeCache should inform listeners when its fully reconnected.
@Randgalt @madrob @cammckenzie
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dragonsinth/curator scottb/treecache-reinit
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/curator/pull/92.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #92
----
commit f18634ac0d7458a2a421bc3fc60ee11555ff13bf
Author: Scott Blum <dr...@apache.org>
Date: 2015-07-22T01:50:43Z
TreeCache should inform listeners when its fully reconnected.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on the pull request:
https://github.com/apache/curator/pull/92#issuecomment-177718605
Yeah, I guess you're right. In that case, I think that it looks ok to me.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
Github user dragonsinth commented on a diff in the pull request:
https://github.com/apache/curator/pull/92#discussion_r35268008
--- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCacheEvent.java ---
@@ -69,6 +69,9 @@
* While the connection is down, the TreeCache will continue to have its state from before it lost
* the connection and after the connection is restored, the TreeCache will emit normal child events
* for all of the adds, deletes and updates that happened during the time that it was disconnected.
+ * </p><p>
+ * After reconnection, the cache will resynchronize its internal state with the server, then fire a
+ * {@link #INITIALIZED} event.
* </p>
*/
CONNECTION_RECONNECTED,
--- End diff --
I don't *think* so since that can be an extremely transient failure, and wouldn't cause ephemeral nodes to disappear. Based on my testing this with ssh tunnels that I'd drop and then recreate, I'd see SUSPENDED immediately but only see LOST much later.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on the pull request:
https://github.com/apache/curator/pull/92#issuecomment-177643755
This change probably doesn't make sense unless it's in the CURATOR 3.0 branch does it? With the state management in 2.X, the LOST event doesn't meant that the session is lost, just that Curator has given up trying to reconnect based on its retry policy. This could mean that the actual session has expired or it could mean that the session is still alive.
On the Curator 3.0 branch @Randgalt reimplemented the way that state management occurs for the LOST event. The default is now that LOST will be published when Curator thinks that the session has been LOST (based on a timer while disconnected), and this is now the default behaviour.
So, perhaps this can only be merged into 3.0? I don't think that the logic will work based on the 2.x version of the codebase.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
Github user dragonsinth commented on the pull request:
https://github.com/apache/curator/pull/92#issuecomment-177219439
Rebased this, and wanted to ping for more feedback on this. A friend of mine was just asking about this change.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
Github user dragonsinth commented on a diff in the pull request:
https://github.com/apache/curator/pull/92#discussion_r35267885
--- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java ---
@@ -758,6 +758,7 @@ private void handleStateChange(ConnectionState newState)
break;
case LOST:
--- End diff --
Let me ramble a bit on my thinking, and hopefully you can help me clarify my thinking.
My intent is to follow the semantics around leaders/locks/leases/ephemeral nodes. My intuition is that I should be seeing a LOST event right about the same time the server considers my session to be timed out. So I want to inform TreeCache listeners here that they can no longer trust the internal tree state as being reasonably up to date. Once the connection is re-established, I then re-walk the tree to synchronize to the server, after which I re-publish INITIALIZED, to inform listeners that they can now reasonably trust the tree state.
The use case I want to support is when someone is using TreeCache to watch for tree changes while using the same client to (say) put ephemeral nodes into the Tree. The semantic I want to convey is that you can only trust that those nodes are really there if the TreeCache is currently in an initialized state.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
Github user dragonsinth closed the pull request at:
https://github.com/apache/curator/pull/92
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
GitHub user dragonsinth reopened a pull request:
https://github.com/apache/curator/pull/92
TreeCache should inform listeners when its fully reconnected.
@Randgalt @madrob @cammckenzie
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dragonsinth/curator scottb/treecache-reinit
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/curator/pull/92.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #92
----
commit f18634ac0d7458a2a421bc3fc60ee11555ff13bf
Author: Scott Blum <dr...@apache.org>
Date: 2015-07-22T01:50:43Z
TreeCache should inform listeners when its fully reconnected.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
Github user dragonsinth commented on the pull request:
https://github.com/apache/curator/pull/92#issuecomment-177689661
I actually think it would be okay to land it in master. Even if the event semantics are slightly fuzzier pre 3.0, the publishing of events actually does match TreeCache's internal operations-- internally TreeCache really does operate based on LOST and RECONNECTED, so the events will still be useful for anyone listening.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by Randgalt <gi...@git.apache.org>.
Github user Randgalt commented on a diff in the pull request:
https://github.com/apache/curator/pull/92#discussion_r35266454
--- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCacheEvent.java ---
@@ -69,6 +69,9 @@
* While the connection is down, the TreeCache will continue to have its state from before it lost
* the connection and after the connection is restored, the TreeCache will emit normal child events
* for all of the adds, deletes and updates that happened during the time that it was disconnected.
+ * </p><p>
+ * After reconnection, the cache will resynchronize its internal state with the server, then fire a
+ * {@link #INITIALIZED} event.
* </p>
*/
CONNECTION_RECONNECTED,
--- End diff --
Shouldn't isInitialized.set(false) occur for SUSPENDED (i.e. any connection loss)?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by Randgalt <gi...@git.apache.org>.
Github user Randgalt commented on a diff in the pull request:
https://github.com/apache/curator/pull/92#discussion_r35266385
--- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java ---
@@ -758,6 +758,7 @@ private void handleStateChange(ConnectionState newState)
break;
case LOST:
--- End diff --
LOST doesn't mean session lost. It only means that the retry policy has given up. Is this your intent?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/curator/pull/92
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] curator pull request: TreeCache should inform listeners when its f...
Posted by dragonsinth <gi...@git.apache.org>.
Github user dragonsinth commented on the pull request:
https://github.com/apache/curator/pull/92#issuecomment-123535519
Another idea that came out of this is TreeCache.isConnected() to reflect the state.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---