Permalink
Commits on Apr 4, 2016
  1. @daschl @daschl

    SPY-191: Don't force reconnect on E2BIG with binary protocol.

    Motivation
    ----------
    In the current codebase, a socket is forcefully reset when the server
    returns an E2BIG response, that is when the document is larger than the
    possible value size.
    
    Modifications
    -------------
    While this needs to be done on the ASCII protocol, doing so is not needed
    with binary protocol and can be considered a bug/leftover.
    
    The code is modified so that E2BIG just translates into a non-success response
    like any other error and the proper error code identifies the cause.
    
    The test cases have been modified for binary to reflect the change.
    
    Result
    ------
    Do not force reconnect / treat the issue as a server error on the binary
    protocol - the ASCII protocol is unaffected.
    
    Change-Id: Idf392d146d30b2e96dc198a93a3cc6598dae3fc6
    Reviewed-on: http://review.couchbase.org/61927
    Reviewed-by: Simon Baslé <simon@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
    daschl committed with daschl Mar 24, 2016
Commits on Jan 13, 2016
  1. @christian-esken @daschl

    SPY-190: Remove the no-operation isInterrupted() call. Document inter…

    …ruption policy.
    
    Motivation
    ----------
    Avoid confusion. Make the interruption policy more clear.
    
    Modifications
    -------------
    Remove the no-operation isInterrupted() call.
    Document interruption policy.
    
    Result
    ------
    Better understandable concurrency code.
    
    Change-Id: Iaf63f8a246c45e9ed9ebfe9c4239043cbe9e2039
    Reviewed-on: http://review.couchbase.org/58266
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    christian-esken committed with daschl Jan 5, 2016
Commits on Jun 11, 2015
  1. @fabienrenaud @daschl

    SPY-187: Expose a few more attributes of MemcachedClient

    Motivation
    ----------
    Extending MemcachedClient to access some of its protected attributes is
    not always desirable as it makes harder writing mocks for unit testing.
    
    Modifications
    -------------
    MemcachedClient now exposes operationTimeout,
    mconn, tcService and executorService.
    
    Result
    ------
    One does not have to extend MemcachedClient any more to write custom
    commands.
    
    Change-Id: I81932da64d4492512dcf1a11fe1161203fa70c5e
    Reviewed-on: http://review.couchbase.org/51546
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    fabienrenaud committed with daschl May 29, 2015
Commits on May 19, 2015
  1. @sideshowcoder @daschl

    Support Libmemcached ketama weighted

    - Add support for alternative Ketama Node key format
    
      Libmemcached uses the format for `[hostname or ip][port unless
      default]-[repetition]` while spymemcached has been using
      `[hostname]/[ip]:[port]-[repetition]` the added `KetamaNodeKeyFormat`
      allows to choose either format while retaining the caching
      optimization.
    
    - Add support for weighted ketama
      Straight port of the weighting based on Libmemcached, configured via
      passing a map of node socketaddress to weight to the configuration.
      This code is only active if the weight is actually configured
      otherwise the old ketama code is used.
    
    - Split testLibKetamaCompatTwo into 2 pieces as the length breaks
      compiling on Eclipse and Java 8 "In java a methods can't have more than
      65535 bytes." http://stackoverflow.com/questions/12257398/how-to-fix-the-code-of-method-is-exceeding-the-65535-bytes-limit
    
    Change-Id: I0263b9afc513f9a135d5d17318b3fe6bd4593437
    Reviewed-on: http://review.couchbase.org/47624
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    sideshowcoder committed with daschl Mar 3, 2015
Commits on Mar 11, 2015
  1. @daschl @daschl

    SPY-183: Allow touch operations to be cloned.

    Motivation
    ----------
    In case a touch  operation needs to be rescheduled, it needs to
    be cloneable (like any other keyed operation).
    
    Modifications
    -------------
    Apply the same clone logic as with any other keyed operation. Also
    added getter methods to the operations so that the expiration time
    can be extracted on cloning.
    
    Result
    ------
    Correct behavior when a touch op needs to be cloned.
    
    Change-Id: Iad343b4dbdcd5dfd4d9ec53bf5335dcf4775f9c9
    Reviewed-on: http://review.couchbase.org/48076
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Simon Baslé <simon@couchbase.com>
    daschl committed with daschl Mar 11, 2015
Commits on Jan 19, 2015
  1. @daschl @daschl

    Fix spring unit tests.

    Motivation
    ----------
    afterPropertiesSet() needs to be called on the factory to actually
    create the client so that it does not result in a NPE.
    
    Change-Id: I483c045451f90ff3ed01d00db7e912e7d2484b64
    Reviewed-on: http://review.couchbase.org/45554
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Simon Baslé <simon@couchbase.com>
    daschl committed with daschl Jan 19, 2015
Commits on Jan 9, 2015
  1. @daschl @daschl

    SPY-181: GetAndLock needs to be cloneable like any other keyed op.

    Motivation
    ----------
    In case a getAndLock operation needs to be rescheduled, it needs to
    be cloneable (like any other keyed operation).
    
    Modifications
    -------------
    Apply the same clone logic as with any other keyed operation. Also
    added getter methods to the operations so that the expiration time
    can be extracted on cloning.
    
    Result
    ------
    Correct behavior when a getAndLock op needs to be cloned.
    
    Change-Id: I7f4fdad62af71a42cc203b2a4b7e72f2002a286d
    Reviewed-on: http://review.couchbase.org/45129
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Simon Baslé <simon@couchbase.com>
    daschl committed with daschl Jan 9, 2015
  2. @daschl @daschl

    SPY-182: Avoid WARN logging when handling node not set.

    Motivation
    ----------
    The main purpose of setting a continous timeout on a node is to
    properly reconnect when the threshold is reached. Now if auth
    has not happened yet, it could be that ops do not have a handling
    node set yet.
    
    In those cases, it doesn't make any sense to increase the counter,
    so it should be ignored. This also has the side effect of not logging
    warnings to the user which have no impact for him.
    
    Modifications
    -------------
    Ignore the operation when its handling node is not set.
    
    Result
    ------
    No unnecessary warnings printed to the user.
    
    Change-Id: I3643d5e0bfc7474889279d0f8362f287624b89a3
    Reviewed-on: http://review.couchbase.org/45131
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Simon Baslé <simon@couchbase.com>
    daschl committed with daschl Jan 9, 2015
  3. @fabienrenaud @daschl

    Change MemcachedNodeROImpl and BaseGetOpImpl classes to public.

    Motivation
    ----------
    Implementing a custom NodeLocator requires to override the getReadonlyCopy
    method which in turn requires to use some MemcachedNode implementation.
    MemcachedNodeROImpl should be reusable outside of its package for that
    purpose. In addition, memcached being an open source project, its
    implementation can be changed or extended and commands such as GET may
    be used differently in these custom versions. The abstract BaseGetOpImpl
    should be flexible enough to be adapted to different but similar GET
    commands.
    
    Modifications
    -------------
    The MemcachedNodeROImpl class accessor changes from package-private to public.
    The BaseGetOpImpl class accessor changes from package-private to public.
    The initialization method and constructors of BaseGetOpImpl changed to
    abstract the string appended to the <GET key> command.
    
    Result
    ------
    Writing a custom NodeLocator outside of the net.spy.memcached package
    and supporting variants of GET commands is now easy.
    
    Change-Id: I49b3efc741ab4fe5780bf74ad5f99b839c9ceb7d
    Reviewed-on: http://review.couchbase.org/44565
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    fabienrenaud committed with daschl Dec 21, 2014
Commits on Dec 10, 2014
  1. @mattbertolini @daschl

    Update Spring FactoryBean to properly support isSingleton property

    Motivation
    ----------
    The current MemcachedClientFactoryBean is marked as a singleton to Spring but
    does not respect the flag. It is creating a new instance with every call to
    getObject(). According to the Spring Javadoc a FactoryBean marked with
    isSingleton true should always return the same reference. By doing this it
    will also expose an ability to safely shutdown a client instance.
    
    Modifications
    -------------
    The class was updated to implement the Spring InitializingBean and
    DesposableBean interfaces. These interfaces provide the two key lifecycle
    methods to create and shutdown the client object. The afterPropertiesSet is
    called after the FactoryBean is constructed and all of the properties have
    been set. This will create the client object and store it in a field so the
    same reference can be returned. The destroy method is called when closing the
    Spring context. It will call the client's shutdown method. I have also added a
    new property that allows a caller to specify the number of seconds to wait
    before shutting down the client. This is a well established Spring pattern
    that is used in many of their own FactoryBean implementations.
    
    Result
    ------
    A more accurate Factory bean that respects the Spring lifecycle and provides
    a safe shutdown mechanism.
    
    Change-Id: I9ae2d71ae7d3fe899bce8ec8200e215aa987400d
    Reviewed-on: http://review.couchbase.org/44144
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    mattbertolini committed with daschl Dec 9, 2014
Commits on Nov 21, 2014
  1. @daschl @daschl

    SPY-179: Reconnect has wrong ceiling, leading to very long reconnect …

    …delays.
    
    Motivation
    ----------
    This is a regression which was introduced through the change in SPY-158
    (bfaec2b).
    
    Because the time is now converted to millis right away, but the comparison checks with the 2^n
    still converted to seconds. That way, even with a very high N it is smaller than the default of
    30k.
    
    Modifications
    -------------
    The code now correctly converts the 2^n to milliseconds before comparing it, making it a comparison
    on the same unit of time again.
    
    Result
    ------
    The ceiling is now properly respected and as a result, reconnect delays are properly capped at
    their defined maximum.
    
    Change-Id: I0c976344d0f8e09bc041d94f3544620ef4fb3117
    Reviewed-on: http://review.couchbase.org/42925
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
    daschl committed with daschl Nov 7, 2014
Commits on Nov 10, 2014
  1. @daschl @daschl

    SPY-178: KetamaNodeLocator#getReadonlyCopy uses unsafe operations.

    Motivation
    ----------
    Users reported java.lang.UnsupportedOperationException when using the
    KetamaNodeLocator#getReadonlyCopy() method. It turns out the error
    only shows up when the JVM is run with the -XX:+AggressiveOpts flag.
    
    Modifications
    -------------
    Changing the iterator to properly update the TreeMap while iterating
    fixes the problem.
    
    Result
    ------
    Correct behavior for KetamaNodeLocator#getReadonlyCopy(), even when
    the -XX:+AggressiveOpts flag is enabled.
    
    Change-Id: I6e7f09892687b8896c9b295a94fb473857ec212f
    Reviewed-on: http://review.couchbase.org/43040
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>
    daschl committed with daschl Nov 10, 2014
Commits on Jun 24, 2014
  1. @daschl @daschl

    SPY-176: Enhance redistribution logic and avoid possible deadlocks.

    Motivation
    ----------
    There have been issues reported that redistribution of operations does
    not work as expected, especially with authentication scenarios. This
    has been tracked down and the following changes have been made:
    
    Modifications
    -------------
    
    	- With the old redistribute logic, it could happen that subsequent
    	  ops in the retry queue got accidentally deleted. With the copy
    	  first, this cannot happen anymore.
    	- On redistribute, if the handling node is still not set, just
    	  clone the operation to avoid NPEs. A op without a node set
    	  can happen if it is enqueued to retry because the target node
    	  is not yet authenticated.
    	- Do not try to add operations to a node which is not yet authen
    	  ticated. This can lead to costly locks with redistributions since
    	  they are run from the IO thread. Without the change, it can happen
    	  that the IO thread waits for an auth latch, but is also responsible
    	  for telling listeners when auth has completed, therefore
    	  locking everything up until the auth latch wait runs out of time.
    
    Result
    ------
    Much better resilience and performance with redistributions, especially
    if authentication takes longer than expected and from scenarios where the
    operations get redistributed/moved around from within the IO thread.
    
    Change-Id: Icbc5f9e4f568ea885500e8d2baedfa989c8ef801
    Reviewed-on: http://review.couchbase.org/38669
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Jun 23, 2014
Commits on Jun 17, 2014
  1. @tootedom @daschl

    SPY-175: Reduce memory use in binary GET

    Change-Id: I9b90aab0b54a2ae7d2c262d499ff47482b9d6c6c
    Reviewed-on: http://review.couchbase.org/38359
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    tootedom committed with daschl May 25, 2014
  2. @daschl @daschl

    SPY-174: Make sure MultiOperationCallback is threadsafe

    First, special thanks goes to @exortech for reporting and fixing the issue
    here: dustin#9
    
    Motivation
    ----------
    Certain operations like the multi get callback rely on the multi operation
    callback which has a non-thread safe component to it.
    
    Modification
    ------------
    Make the callback atomic and thread safe.
    
    Result
    ------
    No race conditions with bulk get operation callbacks.
    
    Change-Id: I511a8e5ec6e8fe50168337a4b9bbddf2360bd365
    Reviewed-on: http://review.couchbase.org/38358
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Jun 17, 2014
Commits on Jun 4, 2014
  1. @daschl @daschl

    SPY-172: Addition - test case fix.

    Just fixed the port.
    
    Change-Id: I82f55e8cef10c30bac785389b8d3c23d57553206
    Reviewed-on: http://review.couchbase.org/37839
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Jun 4, 2014
  2. @daschl @daschl

    SPY-172: Wakeup the selector if idle.

    Motivation
    ----------
    Waking the selector up from time to time and providing implementations a
    chance to run certain checks helps to improve robustness in certain
    situations.
    
    Modifications
    -------------
    The wakeup time is configurable through a system property, but is low
    impact even if set to a smaller value. If the added queue is empty (which
    means the selector has been woken up but no op has been added) a custom
    method is called where implementations can run custom code like idle polls.
    
    Result
    ------
    Better handling in idle situations.
    
    Change-Id: I43ea722b8a4fc28be4f997674ea85f73f2c66a50
    Reviewed-on: http://review.couchbase.org/37725
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Jun 2, 2014
  3. @daschl @daschl

    SPY-171: More robust shutdown handling characteristics.

    Motivation
    ----------
    It has been reported several times that the IO thread kept lingering
    around even after a shutdown() call.
    
    Modifications
    -------------
    Since its run() method is kept alive by the "running" variable, the
    code now makes sure to always set it to false, even if an exception
    occurs during the connection shutdown process.
    
    Also, a slightly misleading IOException has been removed in favor of
    just silently moving on if shutdown is in progress.
    
    Result
    ------
    More stable and predictable shutdown behavior.
    
    Change-Id: I99f3effbbb20a78a2705ee7f3f839e9753fb2a4a
    Reviewed-on: http://review.couchbase.org/37724
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Jun 2, 2014
Commits on Jun 2, 2014
  1. @daschl @daschl

    Move superfluous log message from info to debug.

    Motivation
    ----------
    In every log when connecting, a message like this shows up:
    
    INFO [Memcached IO over {MemcachedConnection to ...}] (?:?) - 
    Connection state changed for sun.nio.ch.SelectionKeyImpl@...
    
    This message is superfluous since it does not provide any addition 
    information to the user, especially not at INFO level.
    
    Modifications
    -------------
    The message has been moved to DEBUG level so that users are not 
    wondering what it means and also to streamline the log a bit.
    
    Result
    ------
    Easier log output to read and analyze for the user.
    
    Change-Id: I13ef691dd435f397dc9d5f08ff40a28202d3ddb7
    Reviewed-on: http://review.couchbase.org/37647
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl May 28, 2014
  2. @daschl @daschl

    SPY-170: Fix concurrency issue in StringUtils.isJSONObject()

    Motivation
    ----------
    A concurrency issue was reported in the StringUtils class, pointing towards
    the pattern matching of the JSON string.
    
    Modifications
    -------------
    It turned out that the matcher is not thread safe and there is a race condition
    between clearing it and then matching on it. By falling back to the thread-safe
    builder directly the race condition goes away.
    
    Result
    ------
    No concurrency issue anymore in the helper method.
    
    Change-Id: I09729af78bd241ff8dcb0869992d3ff474fb6ec1
    Reviewed-on: http://review.couchbase.org/37603
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl May 27, 2014
  3. @daschl @daschl

    SPY-134: Make sure lastReadTimestamp is concurrency safe.

    Motivation
    ----------
    When the last read timestamp is read from each node, there has been some
    suspicion that the (sometimes very long) reported times are flawed.
    
    Tracking it down further, it was discovered that the timestamp was potentially
    accessed by two or more threads, but not volatile.
    
    Modifications
    -------------
    This changeset makes the timstamp volatile and also uses nanoTime instead
    of currentTimeMillis for better accuracy.
    
    Result
    ------
    Since the timestamp is now thread safe, the actual value will now be shown
    to the user.
    
    Change-Id: I39e47408319f8adf3b2875a4a730232ecadeafe2
    Reviewed-on: http://review.couchbase.org/37646
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl May 28, 2014
Commits on May 7, 2014
  1. @daschl @daschl

    SPY-169: Also clone observe calls on redistribute.

    Motivation
    ----------
    Observe calls also need to be cloned when redistributed, for example if a socket
    gets closed or the op stil waits for an auth latch.
    
    Modifications
    -------------
    The observe operation now gets cloned similar to get, gets and so on.
    
    Result
    ------
    No assert error is raised if an observe needs to be cloned.
    
    Change-Id: I6269a1d7fb756855f94caa2fe0495133fe1a83b0
    Reviewed-on: http://review.couchbase.org/36698
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl May 5, 2014
Commits on May 5, 2014
  1. @daschl @daschl

    SPY-165: Do not cache the selectedKeys.

    Motivation
    ----------
    Caching the selected keys may cause issues if the selector is accessed by different
    threads, also the loop for the keys is not using the iterator correct.
    
    Modifications
    -------------
    Make it not cache the keys and also correctly make use of an iterator to loop through
    the keys.
    
    Result
    ------
    No stale/cached selected keys and correctly using the iterator should lead to better
    stability during failure cases.
    
    Thanks to Brad Svee (@sveesible) for suggesting the fix
    
    Change-Id: If82cdfc810c758a4196415cb709a03ebd72c3d15
    Reviewed-on: http://review.couchbase.org/36222
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Apr 23, 2014
  2. @daschl @daschl

    SPY-166: Only readd a WRITE_QUEUED operation, not clone it in addition.

    Motivation
    ----------
    When a WRITE_QUEUED operation is redistributed, it needs to be readded
    but not cloned (since its still in a sendable state).
    
    Modification
    ------------
    Return after adding the operation again.
    
    Result
    ------
    The operation is readded and not cloned afterwards too.
    
    Change-Id: I79fec436aa538a8a4074e82f69b3ed186c5126b7
    Reviewed-on: http://review.couchbase.org/36258
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Apr 24, 2014
  3. @daschl @daschl

    SPY-167: Avoid deadlock on notify listeners.

    Motivation
    ----------
    Because of how the addListener and notifyListener works, it could be that
    one deadlocks each other because they are waiting on the same locks from
    different threads.
    
    Modifications
    -------------
    The listeners are copied before notified, moving it out of the synch block.
    
    Result
    ------
    Since notify is not synched anymore, the lock should be not happening anymore.
    
    Note that also the listeners array is set to empty which avoid notifying listeners
    more than once potentially.
    
    Thanks to @adamhonen for pointing out the fix.
    
    Change-Id: I7ebda58c2eadd62d8885e3eeac79d5a971e07979
    Reviewed-on: http://review.couchbase.org/36219
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Apr 23, 2014
  4. @daschl @daschl

    SPY-168: isJSONObject should handle null or empty input values.

    Motivation
    ----------
    Before this change, the isJSONObject was suspect to NPEs and possibly also
    regex match failings on empty strings, although that does not seem to be the
    case on Java 1.7+.
    
    Modifications
    -------------
    Specific null and empty checks have been added to make the method more robust.
    
    Result
    ------
    NPEs are not raised anymore and also empty strings are checked much quicker. Test
    cases have been added to verify functionality.
    
    Side note: An exception like this was reported on empty strings, but could not be
    verified with Java 1.7 onward. It is suspected that this changeset also fixes
    the issue given the input type and code process:
    
    Original Exception: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    Stack trace:
    java.lang.String.charAt(String.java:658)
    java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3715)
    java.util.regex.Pattern$Ques.match(Pattern.java:4079)
    java.util.regex.Pattern$Begin.match(Pattern.java:3472)
    java.util.regex.Matcher.match(Matcher.java:1221)
    java.util.regex.Matcher.matches(Matcher.java:559)
    net.spy.memcached.util.StringUtils.isJsonObject(StringUtils.java:109)
    net.spy.memcached.transcoders.SerializingTranscoder.encode(Seriali
    ...
    
    Change-Id: Icaca2f3fef658cdb2c376b6b4dba12ae0327f240
    Reviewed-on: http://review.couchbase.org/36695
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl May 5, 2014
  5. @daschl @daschl

    SPY-164: Clone gets correctly.

    Motivation
    ----------
    When a gets operation is cloned, it currently gets incorrectly cloned into
    a regular get operation. This can cause issues later on.
    
    Modifications
    -------------
    Make sure that a gets() gets correctly cloned into a new gets().
    
    Result
    ------
    The cloning is now properly done, based on the operation type.
    
    Thanks to Brad Svee (@sveesible) for the fix suggestion.
    
    Change-Id: I7b8820bea20d0a0d9555f1bb9b2a46e5327a5f78
    Reviewed-on: http://review.couchbase.org/36221
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Apr 23, 2014
Commits on Apr 23, 2014
  1. @daschl @daschl

    SPY-163: Count down bulk get latch even when empty key list is provided.

    Motivation
    ----------
    When a empty iterator (or empty key list) is passed in to a get bulk operation,
    a result is never returned and the thread is blocked because it waits on a
    latch that will never be counted down (because no response will ever arrive).
    
    Modifications
    -------------
    If no chunks with keys are sent out to the servers, the latch is initialized
    to 0 right away so that the code doesn't need to wait at all.
    
    Result
    ------
    The code now returns properly with an empty map instead of blocking the thread
    forever.
    
    Change-Id: I0711c399d9f15010bc808e0f651ce6ad605c06f0
    Reviewed-on: http://review.couchbase.org/36208
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl Apr 23, 2014
Commits on Apr 14, 2014
  1. @daschl @daschl

    SPY-162: Also respect nagle setting on reconnect.

    Motivation
    ----------
    If a server connection is reset (because it is lost or a reconnection
    is triggered), the nagle setting is not re-set properly.
    
    Modifications
    -------------
    During the reconnect phase, properly re-set the nagle setting so it is
    respected on the new connection.
    
    Result
    ------
    The custom nagle setting is respected and used even across new connections.
    
    Change-Id: Ic0b513b8538a39710aaf8fd0f0f699a5c561bc09
    Reviewed-on: http://review.couchbase.org/35553
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl Apr 10, 2014
  2. @daschl @daschl

    Enhanced auth logging on sasl failure.

    Motivation:
    -----------
    In case of long-taking auth roundtrips, it could be the case - for one 
    reason or another - that a empty sasl list gets returned or the auth 
    thread gets interrupted, leading to the same effect. This needs to 
    be better debugable from the logs.
    
    Modifications:
    --------------
    Better logging has been added for auth failure scenarios, and also the 
    sasl mechs response has been refactored a bit so that the timing is 
    also reported in case of an error.
    
    Result:
    -------
    Auth errors are now easier to debug from the logs.
    
    Change-Id: I9f0fff8b2c3a6b1492fb0fd82746ff78f7b006c5
    Reviewed-on: http://review.couchbase.org/35672
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl Apr 14, 2014
Commits on Apr 4, 2014
  1. @daschl @daschl

    SPY-161: Cascade op cancellations.

    Motivation
    ----------
    When an operation is redistributed (be it because of reconnects
    and/or "not my vbucket" responses, it gets cloned. The problem
    is that the initial callback always points to the original
    operation, not the cloned one. While the clone gets the callback,
    the other way round (like cancelling from user-code) will never
    trickle through to the cloned ops.
    
    Modifications
    -------------
    In order to fix this issue, code has been added which connects
    the original op with the cloned ones, by keeping a list of
    cloned operations in the original op. To prevent overly long
    stack in malicious scenarios, an overall clone-cap of 100
    clones is introduced. If this cap is reached, the operation
    will not be cloned further but cancelled.
    
    Result
    ------
    With this modifications, timeouts and cancellations from user code
    will trickle through to the clone operations, prevent issues when
    cloned operations are around "forever".
    
    Change-Id: I304534a62202b705d78ca5f775f47afcd6be238a
    Reviewed-on: http://review.couchbase.org/34883
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Mar 25, 2014
Commits on Mar 27, 2014
  1. @daschl @daschl

    SPY-160: Avoid ConcurrentModificationException with the retry queue

    Motivation
    ----------
    ConcurrentModificationException will show up since the code can recursively
    modify itself.
    
    Modifications
    -------------
    Copy the original list into a temporary new one to avoid the exception.
    
    Result
    ------
    Redistribute on the retry list will work as expected, without an
    exception.
    
    Change-Id: Ieff1a87136bef38280b7f139192419073d6a878a
    Reviewed-on: http://review.couchbase.org/34977
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl Mar 27, 2014
  2. @daschl @daschl

    Add development pom.xml

    Motivation
    ----------
    While ivy/ant works for years now, it is a little too hard to get
    started when contributing simple patches with IDE setup. Since most
    IDEs have good maven support, adding a pom.xml to get up and running
    quickly makes it easier to contribute and develop.
    
    Modification
    ------------
    Add a pom.xml which is inteded to get up and running quickly. It is not
    designed to do release management, which still happens through the
    ant/ivy pipeline.
    
    Note that the test case fix is by intention, because otherwise the
    unit tests get messed up when ran through IntelliJ with the maven
    file imported.
    
    Result
    ------
    Contributors and developers can import the project more easily and
    contribute patches.
    
    Change-Id: I837eb73cb07560aef15301490eaab56e484be3a8
    Reviewed-on: http://review.couchbase.org/34845
    Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    daschl committed with daschl Mar 24, 2014
  3. @daschl @daschl

    SPY-160: Queue retry op instead of redistributing it immediately.

    Motivation
    ----------
    After making the original SPY-160 changes, the ops were correctly redistributed,
    but if the latch never gets counted down it gets recursively distributed and
    added. Example:
    
    	  at net.spy.memcached.protocol.TCPMemcachedNodeImpl.addOp(TCPMemcachedNodeImpl.java:344)
    	  at net.spy.memcached.MemcachedConnection.addOperation(MemcachedConnection.java:1206)
    	  at net.spy.memcached.MemcachedConnection.redistributeOperation(MemcachedConnection.java:994)
    	  at net.spy.memcached.protocol.TCPMemcachedNodeImpl.addOp(TCPMemcachedNodeImpl.java:350)
    	  at net.spy.memcached.MemcachedConnection.addOperation(MemcachedConnection.java:1206)
    	  at net.spy.memcached.MemcachedConnection.redistributeOperation(MemcachedConnection.java:994)
    	  at net.spy.memcached.protocol.TCPMemcachedNodeImpl.addOp(TCPMemcachedNodeImpl.java:350)
    	  at net.spy.memcached.MemcachedConnection.addOperation(MemcachedConnection.java:1206)
    	  at net.spy.memcached.MemcachedConnection.redistributeOperation(MemcachedConnection.java:994)
    
    Modifications
    -------------
    The changeset, instead of redistributing right now, adds the operation to the retry queue which means
    it will be handled eventually, but gives the IO thread a chance to run other tasks (including retreiving
    auth response information).
    
    Result
    ------
    The operation is queued and is not blocking the IO thread.
    
    Change-Id: I73a8e77255a54bceeb929febcadb0e555febdd67
    Reviewed-on: http://review.couchbase.org/34938
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl Mar 26, 2014
  4. @daschl @daschl

    SPY-157: Fix auth logging times.

    Motivation
    ----------
    In the previous commit which added logging, it measured nanoseconds and printed
    milliseconds. This also screwed up the debug/warn metric.
    
    Modifications
    -------------
    Correctly convert nanoseconds to milliseconds.
    
    Result
    ------
    Timings are now properly warned and formatted.
    
    Change-Id: Id174a49e03e052f9e32c98cc32aa7ad0b82bbb4d
    Reviewed-on: http://review.couchbase.org/34936
    Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
    Reviewed-by: Matt Ingenthron <matt@couchbase.com>
    daschl committed with daschl Mar 26, 2014