[
https://issues.jboss.org/browse/ISPN-3163?page=com.atlassian.jira.plugin....
]
Martin Gencur commented on ISPN-3163:
-------------------------------------
If I change the value via REST, the subsequent .gets() operation (which returns CASValue)
fails with an exception:
{code}
Reconnection due to exception handling a memcached operation on {QA sa=/127.0.0.1:16211,
#Rops=1, #Wops=0, #iq=0,
topRop=net.spy.memcached.protocol.ascii.GetsOperationImpl@f89761c, topWop=null, toWrite=0,
interested=1}. This may be due to an authentication failure.
OperationException: SERVER: SERVER_ERROR java.lang.NullPointerException
at net.spy.memcached.protocol.BaseOperationImpl.handleError(BaseOperationImpl.java:123)
at net.spy.memcached.protocol.ascii.OperationImpl.readFromBuffer(OperationImpl.java:130)
at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:401)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:333)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:219)
at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1591)
{code}
OTOH, the .get() operation (note the missing "s" in the name) works correctly
Replacing entry via HotRod which was initially stored via Memcached
does not change CAS
---------------------------------------------------------------------------------------
Key: ISPN-3163
URL:
https://issues.jboss.org/browse/ISPN-3163
Project: Infinispan
Issue Type: Bug
Affects Versions: 5.3.0.CR1
Reporter: Martin Gencur
Assignee: Galder ZamarreƱo
Fix For: 5.3.0.Final
Users might expect that CAS (check-and-set) operation will work even in compatibility
mode which is currently not true in the following scenario:
1) store a key/value via Memcached
2) change the value via HotRod or Embedded
3) use Memcached's CAS operation
In step #3 the memcached client will update the value even though the value was changed
by another client in the meantime. The memcached client was supposed to change it only if
it had not been changed in the meantime.
The following test snippet shows the problem:
{code:java}
public void testMemcachedPutHotRodEmbbeddedReplaceMemcachedCASTest() throws Exception {
final String key1 = "5";
// 1. Put with Memcached
Future<Boolean> f = cacheFactory.getMemcachedClient().set(key1, 0,
"v1");
assertTrue(f.get(60, TimeUnit.SECONDS));
CASValue oldValue = cacheFactory.getMemcachedClient().gets(key1);
// 2. Replace with Hot Rod
VersionedValue versioned = cacheFactory.getHotRodCache().getVersioned(key1);
assertTrue(cacheFactory.getHotRodCache().replaceWithVersion(key1, "v2",
versioned.getVersion()));
// 3. Replace with Embedded
assertTrue(cacheFactory.getEmbeddedCache().replace(key1, "v2",
"v3"));
// 4. Get with Memcached and verify value/CAS
CASValue newValue = cacheFactory.getMemcachedClient().gets(key1);
assertEquals("v3", newValue.getValue());
assertTrue("The version (CAS) should have changed", oldValue.getCas() !=
newValue.getCas());
//<---- fails here
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira