curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McKenzie <cammcken...@apache.org>
Subject CURATOR-122 and CURATOR-123
Date Mon, 21 Jul 2014 22:58:02 GMT
I've had a bit of a look into these, and there's definitely an issue. If I
setup a simple test that creates a read only TestingServer and a
CuratorFramework that allows 'read only', then I only get a CONNECTED
message on initial connection.

I've run the debugger and this seems to be because we only get a
SyncConnected event from ZooKeeper, not a ConnectedReadOnly event. I
haven't tested this against a proper ZooKeeper cluster yet (will try to do
that today), but is this expected behaviour?

The current TestReadOnly test is a bit bogus, because it only tests that a
particular set of events occur, it doesn't test the order of them. If you
actually look at the logs for the test, it's as discussed in CURATOR-123:

CONNECTED (initial connection)
SUSPENDED (server is killed)
LOST
READ_ONLY (server is restarted)
SUSPENDED
RECONNECTED

In the addStateChange() method in the ConnectionStateManager, I can see
that on initial connection it will only ever generate a CONNECTED event,
due to the following:

boolean isNegativeMessage = ((newConnectionState == ConnectionState.LOST)
|| (newConnectionState == ConnectionState.SUSPENDED));

        if ( !isNegativeMessage && initialConnectMessageSent.compareAndSet(
false, true) )

        {

            localState = ConnectionState.CONNECTED;

        }

but as discussed above, ZooKeeper doesn't seem to be sending the READ_ONLY
event at initial connection anyway.

Any ideas?

cheers

Cam

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message