curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jordan Zimmerman <>
Subject Re: CURATOR-122 and CURATOR-123
Date Tue, 22 Jul 2014 17:14:54 GMT
I think the problem is in ConnectionStateManager.addStateChange() :

if ( !isNegativeMessage && initialConnectMessageSent.compareAndSet(false, true) )
            localState = ConnectionState.CONNECTED;


On July 21, 2014 at 5:58:31 PM, Cameron McKenzie ( wrote:

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)  
READ_ONLY (server is restarted)  

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?  



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