Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Near cache eviction doesn't work #9723

Closed
nitsandaniel opened this issue Jan 22, 2017 · 11 comments

Comments

Projects
None yet
3 participants
@nitsandaniel
Copy link

commented Jan 22, 2017

I'm using Hazelcast 3.7.4, and I have both lite and non-lite members.

On my lite members I'm setting near-cache as follows:

NearCacheConfig nearCacheConfig = new NearCacheConfig(0, cacheSize, EvictionPolicy.LRU.name(), 0, true, InMemoryFormat.OBJECT);
config.getMapConfig(mapName).setNearCacheConfig(nearCacheConfig);

I have configured entry listener on my lite member and could verify that it is called on change. Moreover, the old and new value content is correct.

But when I'm trying to get the value from the map I'm still getting the old value.

While debugging, I've tried to look at the map content and I could see the new value, but when I'm calling map.get(key) the old value is returned.

@jerrinot jerrinot added this to the 3.8 milestone Jan 22, 2017

@nitsandaniel

This comment has been minimized.

Copy link
Author

commented Jan 22, 2017

is this a known bug?

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Jan 22, 2017

hi @nitsandaniel, it's not a known bug, not known to me anyway. I just added categorization to make sure it's addressed before 3.8 release. I see you closed the issue. is it working for you after all?

@nitsandaniel

This comment has been minimized.

Copy link
Author

commented Jan 23, 2017

I accidentally closed it, reopened it immediately.

@ahmetmircik

This comment has been minimized.

Copy link
Member

commented Jan 23, 2017

Hi @nitsandaniel,
IMap and its near cache have isolated eviction mechanisms. When an entry is evicted from IMap, this doesn't require an eviction on near cache or vice versa. So it can be expected that near cache returns the evicted entry because it still owns it.

Since eviction doesn't affect correctness of the data, if the latest state of entry is still observable, returning it from near cache should not cause any problem even IMap doesn't have it. This makes sense to you?

@nitsandaniel

This comment has been minimized.

Copy link
Author

commented Jan 23, 2017

Actually it doesn't.

Let's say that the key 'a' was mapped to the value '1', but then changed to '2', how could it make sense that I'll still get '1' when I'm querying the map for 'a'?

I'm not talking about eviction here but value update.
Moreover, one of the near-cache constructor is invalidateOnChange, which is set to true in my code.

@ahmetmircik

This comment has been minimized.

Copy link
Member

commented Jan 23, 2017

Let's say that the key 'a' was mapped to the value '1', but then changed to '2', how could it make sense that I'll still get '1' when I'm querying the map for 'a'?

Thanks for clarification. Obviously this is an issue and it is not a known one. Can you please share a reproducer?

I'm not talking about eviction here but value update.

Ok i was describing eviction behaviour.

@nitsandaniel

This comment has been minimized.

Copy link
Author

commented Jan 23, 2017

The code snippet above is how I configure near cache.
Other than that, the usage code is very simple:

IMap<MyKey, MyValueObject>map = hazelcastInstance.getMap(mapName);
MyValueObject value = map.get(key);

@ahmetmircik ahmetmircik modified the milestones: 3.7.6, 3.8 Jan 23, 2017

@ahmetmircik

This comment has been minimized.

Copy link
Member

commented Jan 23, 2017

Thanks for reporting this, indeed it is a bug for 3.7 version. 3.8-EA don't have this issue.
Root cause of the issue is invalidations are not sent to lite-members if near cache is not configured also on other members.

For now, as a workaround you can enable near cache on other members. Possibly we can fix this issue in next 3.7 patch release which will be 3.7.6.

@nitsandaniel

This comment has been minimized.

Copy link
Author

commented Jan 23, 2017

Thanks for the quick response.

Are there planned timelines for 3.7.6 and 3.8?

@ahmetmircik

This comment has been minimized.

Copy link
Member

commented Jan 24, 2017

ETA for both is mid february.

@jerrinot

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2017

fixed by #9890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.