Change-Id: I49a3f3238e80c0e9c445df6ac2f32f634300811f Reviewed-on: https://review.northscale.com:8443/1298 Reviewed-by: Trond Norbye <email@example.com> Reviewed-by: Eric Lambert <firstname.lastname@example.org> Reviewed-by: Dustin Sallings <email@example.com> Tested-by: Matt Ingenthron <firstname.lastname@example.org>
This change will ensure that autentication failures do not hang the thread adding an operation. The default behavior is to try to authenticate forever and whine to the log if authentication continues to fail. Optionally, a developer may define net.spy.memcached.auth.AuthThreshold with an integer value to set a maximum number of authentication attempts before shutting down. Authentication threads are now spawned and managed by an AuthTreadMonitor class, ensuring that for any given connection there can only be one outstanding AuthThread. Change-Id: I0af4ab41d27239e7b555dca7d993e6228b7df5b8
Change-Id: I3437c4a69d9673d3fc7a2d0611012389b28e3d2f Reviewed-on: https://review.northscale.com:8443/1287 Reviewed-by: Dustin Sallings <email@example.com> Tested-by: Dustin Sallings <firstname.lastname@example.org>
When SASL authentication is requested of a MemcachedClient it should always ensure that auth takes place before anything else on the queue is processed. After some experimentation, it seems The best way to handle this is to extend the MemcachedNode interface to add some methods. This in turn allows for the changes to be implemented in the TCPMemcachedNodeImpl class. There is special handling with the inputQueue and addOperation if a reconnect occurs during authentication. It's a bit harder at the BinaryMemcachedNodeImpl, though arguably makes more sense there. Since these are all pretty well hidden as an implementation detail, it's okay for it to be here. Who knows, maybe someday ascii will have SASL. Probably not though.
The contribution by Blair Zajac inverts the ConnectionFactoryBuilder defaults to match that of the DefaultConnectionFactory. This updates the tests to check for the new default, and test the new change.
With this change, the MemcachedClient has a method of using the connection observer to determine a connected server is consistently timing out, indicating it has hard-failed. This will destroy that connection so things may rehash or reconnect, depending on the hash behavior.
This is just the default stringification, clients can use whatever they want, but by default, this seems to provide consistent results with libketama.
DefaultConnectionFactory#isDaemon() is false while ConnectionFactoryBuilder builds a ConectionFactory that by default returns true for #isDaemon(), so to make them consistent, modify ConnectionFactoryBuilder to have #isDaemon() be false.
This means that instead of raising a queue overflow exception on insert, the client can optionally block waiting for space to become available instead (with a timeout that will result in the same exception).