Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Disable optimization by default, remove assert. SPY-88.

This is only a workaround at the moment for SPY-88, but
it was found that the addition of the assert with a
javadoc change and changing OperationState to volatile
would cause failures in test cases like the
testParallelSetGet() indicating there is a thread
safety issue.

While trying to find the specific cause, it seems the best
approach for now is to disable optimization.

The assert, while correct, is also being disabled since
it seems to trigger issues with getBulk which seems to
call the complete() more frequently than it should.

This combination of changes seems to be a tested, stable
workaround until a proper fix may be implemented.

Change-Id: I755b18aa487247a445657726ae2dc8dad6a27991
Reviewed-on: http://review.couchbase.org/18670
Reviewed-by: Michael Wiederhold <mike@couchbase.com>
Tested-by: Matt Ingenthron <matt@couchbase.com>
  • Loading branch information...
commit 568149bf02d37a761932c97100bf54dca5a3448b 1 parent 8fa2060
@ingenthr ingenthr authored ingenthr committed
View
2  src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java
@@ -56,7 +56,7 @@
protected Locator locator = Locator.ARRAY_MOD;
protected long opTimeout = -1;
protected boolean isDaemon = false;
- protected boolean shouldOptimize = true;
+ protected boolean shouldOptimize = false;
protected boolean useNagle = false;
protected long maxReconnectDelay =
DefaultConnectionFactory.DEFAULT_MAX_RECONNECT_DELAY;
View
2  src/main/java/net/spy/memcached/DefaultConnectionFactory.java
@@ -315,7 +315,7 @@ public boolean useNagleAlgorithm() {
* @see net.spy.memcached.ConnectionFactory#shouldOptimize()
*/
public boolean shouldOptimize() {
- return true;
+ return false;
}
/*
View
4 src/main/java/net/spy/memcached/internal/OperationFuture.java
@@ -172,9 +172,7 @@ public T get(long duration, TimeUnit units) throws InterruptedException,
"Operation timed out.", op));
}
- if (op != null) {
- assert op.getState() == OperationState.COMPLETE;
- }
+ /* TODO: re-add assertion that op.getState() == OperationState.COMPLETE */
return objRef.get();
}
View
2  src/test/java/net/spy/memcached/ConnectionFactoryBuilderTest.java
@@ -97,7 +97,7 @@ public void testDefaults() throws Exception {
}
assertFalse(f.isDaemon());
- assertTrue(f.shouldOptimize());
+ assertFalse(f.shouldOptimize());
assertFalse(f.useNagleAlgorithm());
assertEquals(f.getOpQueueMaxBlockTime(),
DefaultConnectionFactory.DEFAULT_OP_QUEUE_MAX_BLOCK_TIME);
Please sign in to comment.
Something went wrong with that request. Please try again.