Bug 745896 (EDG-20) - rest and memcached server modules aren't isolated and affect each other
Summary: rest and memcached server modules aren't isolated and affect each other
Keywords:
Status: CLOSED NEXTRELEASE
Alias: EDG-20
Product: JBoss Data Grid 6
Classification: JBoss
Component: unspecified
Version: 6.0.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 6.0.0
Assignee: Default User
QA Contact:
URL: http://jira.jboss.org/jira/browse/EDG-20
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-27 18:40 UTC by Michal Linhard
Modified: 2014-03-17 04:02 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-04 17:20:57 UTC
Type: Feature Request


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker EDG-20 0 None None None Never
Red Hat Issue Tracker ISPN-1206 0 None None None Never

Description Michal Linhard 2011-06-27 18:40:34 UTC
project_key: EDG

if we work with the same key with REST and memcached client at once, a server side class cast exception occurs because both work with different value representation:
SERVER_ERROR java.lang.ClassCastException: [B cannot be cast to org.infinispan.server.memcached.MemcachedValue
SERVER_ERROR java.lang.ClassCastException: [B cannot be cast to org.infinispan.server.core.CacheValue

test:
https://svn.devel.redhat.com/repos/jboss-qa/edg/edg-adapter/src/test/java/org/jboss/edg/adapter/manual/MemcachedProblemTest.java

Comment 1 Michal Linhard 2011-06-27 18:41:06 UTC
there was a discussion a long time ago about isolation of server modules

https://docspace.corp.redhat.com/docs/DOC-70171

last time we left the isolation to be done by using different cache managers for each server module, but I guess that's kinda outdated, I don't think we wanna have separate cache manager for each server module anymore.

Comment 2 Michal Linhard 2011-06-27 18:41:45 UTC
the problem is that since we solved JBPAPP-5277, REST and memcached modules aren't isolated anymore

Comment 3 Michal Linhard 2011-06-27 18:42:17 UTC
Link: Added: This issue relates to ISPN-1206


Comment 4 Trustin Lee 2011-06-28 01:54:25 UTC
I think this issue can be better phrased as 'REST server cannot access the entries written by other protocol servers'.  Can the REST server access the entries written via Hot Rod or direct calls?

Comment 5 Michal Linhard 2011-06-28 07:06:03 UTC
No, all server modules are basically isolated. 
HotRod is isolated from others by means of different key "encoding". All keys are stored as ByteArrayKey. In memcached and REST they are stored as plain String.

It would be cool if we were able to share data between server modules, but there is one fundamental problem. All three server modules store different metadata with the entry. We would have to unite the way how the metadata is stored for each module and define "conversions" and default values for metadata that isn't written by one but read by the other.

E.g. REST module writes mime type of the entry on PUT operation. HotRod doesn't. What kind of mime would be supplied to a value written by hotrod and read by REST ?

I'm all for starting a design document on this, but so far the consensus I think was to isolate the server modules (via isolating their keyspaces).

Comment 6 Trustin Lee 2011-06-28 14:49:01 UTC
What does isolating keyspace really mean?  Is it having a different EmbeddedCacheManager?  Then does that mean we have to create three cache manager in a single VM?

Comment 7 Michal Linhard 2011-06-29 07:31:33 UTC
By keyspace separation I meant wrapping the key of each server module to a different class, and therefore one module wouldn't be able to retrieve keys of other module.
IMHO a bit better than having cache managers for each server module. And easily revertable if we create a concept of sharing data among server modules.

Comment 8 Michal Linhard 2011-06-29 07:34:55 UTC
Of course there are memory consumption implicatons, a small research would be good, which approach is more efficient in terms of memory - different cachemanagers or keyspace separation.

Comment 9 Galder Zamarreño 2011-08-03 07:17:59 UTC
Different cache managers of keyspace separation is maybe a bit too much. As noted in https://issues.jboss.org/browse/ISPN-1206, Memcached clients can only write to the default cache, so either renaming the default memcached or REST cache should be more than enough to get around the issue. Personally I'd go for renaming the default REST cache as suggested in ISPN-1206, thoughts?

Comment 10 Michal Linhard 2011-08-03 14:30:43 UTC
I like this approach - using different cache, it's actually very straightforward, I wonder why it didin't occur to me :-)

and rest server using different cache than default (as in DefaultCacheManager.getCache()) solves it perfectly:
hotrod is isolated from it by keyspace isolation - even if we picked it via it's name
memcache is isolated from it by not being able to pick named cache

good.

Comment 11 Galder Zamarreño 2011-08-04 08:57:43 UTC
Actually, changing the default cache in REST is probably a bad idea. Even though we don't seem to specify it in the docu, there's a inherent link between sending a request to "__defaultcache" cache and the expectations you have (it maps to <default> cache in the config). So, if we change that name, you need to keep the mapping to the <default> cache which effectively breaks the protocol that has been in place since the 4.0 days.

It's actually much easier to change the default Memcached cache because there's no link to a protocol. There's only one cache which can be any. The only thing you need to maintain is that the new default cache for Memcached uses a clone configuration of the <default> cache. This breaks no protocol at all.

Comment 12 Anne-Louise Tangring 2011-09-26 19:41:27 UTC
Docs QE Status: Removed: NEW 



Note You need to log in before you can comment on or make changes to this bug.