[
https://issues.jboss.org/browse/ISPN-3163?page=com.atlassian.jira.plugin....
]
Galder Zamarreño commented on ISPN-3163:
----------------------------------------
The best is probably to have type converter generate a new version and assign to the
metadata in the command, if no version given by the client. For this to work, a way to
share the version generator is needed by all parties (type converter interceptor and
server endpoints). That way, they can all share the same version generator and guarantees
that at the local level, increasing numbers are provided (different nodes will generate
different versions already...).
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