Hazelcast 3.3 - EntryProcessor is accessing "non-local" keys

113 Views Asked by At

I'm using Hazelcast 3.3.

One member writes entries to an IMap and calls map.executeOnEntries(myEntryProcessor). The task of EntryProcessor is to just print the entries on console. However, the members (3 other and the 1st one = 4 members) seem to print overlapping set of entries. My understanding was that the EntryProcessors get only entries corresponding to localKeySet(). However, it appears thats not the case.

Could someone please explain this behavior?

2

There are 2 best solutions below

0
On BEST ANSWER

Found out the issue. The problem was not with the EntryProcessors. Actually, the code which was writing data to the distributed IMap, was running on more than the desired number of members.

So, in essence, a process (launched through IExecutorService) was running on multiple instances and publishing 'overlapping sets'/ duplicate sets of data. The EntryProcessor was working in correct way.

2
On

Your reasoning is correct. An EntryProcessor should only touch local keys.

What are you using as key? Hazelcast uses the serialized version of the key as the actual key; so perhaps you have 2 different key instances that lead to the same 'toString', but their binary content is different.

I have shot myself in the foot with e.g. a HashMap being part of the key; this can lead to different binary content even though the actual content is the same, and then you get strange behavior.

If you are using e.g. Long or String as key; then I can't explain the behavior you are seeing. How difficult is it to get this reproduced?