[infinispan-dev] Query: inconsistencies with putAll

Sanne Grinovero sanne at infinispan.org
Tue Mar 27 09:51:27 EDT 2012


Hi all,
I was adding some tests for Query as I just found many basic
operations are uncovered, and found an annoying issue.

When using

cache.putAll(values);

the Query interceptor will iterate on each entry, transform each entry
key and replace those entry keys in string form with the new indexed
values.

The problem is *which index* : the index mapping information is bound
to the indexed type. So the normal put/replace/remove operations
actually rely on the return value to know where to direct the proper
index operation (to which index) - if any.

With putAll() returning void, I don't have the return values.

I could hack this to "unroll" in several individual put() operations
but I don't think that should happen in an interceptor. Also this
would defeat the purpose of using putAll, killing it's efficiency over
using several put operations.

I would generally expect people to put objects of the same type when
replacing a key.. so this works fine usually looking at the runtime
type of the new value (as it's doing), but it's not correct generally.
Worse, I can't detect the mismatch and log some warning.

Any suggestion? I'm tempted to say I need to retrieve all previous
values. I actually need only the types :-/

A simple solution would be to disallow using multiple indexes for the
same cache, but that's not a welcome change. I'd prefer to throw an
exception on putAll : not supported when indexing is enabled.

Cheers,
Sanne


More information about the infinispan-dev mailing list