Bug 1171479

Summary: C++ HotRod Client has wrong cache size after the key/value is expired when using lifespan
Product: [JBoss] JBoss Data Grid 6 Reporter: Benny <chuchen>
Component: CPP ClientAssignee: Ion Savin <isavin>
Status: CLOSED CURRENTRELEASE QA Contact: Alan Field <afield>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: afield, dmehra, dstahl, jpallich, mgencur, mhusnain, pzapataf, sjacobs, ttarrant
Target Milestone: ER8   
Target Release: 6.4.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1153111    
Attachments:
Description Flags
C++ sample code to reproduce this issue
none
Java HotRod Client doesn't have this issue none

Description Benny 2014-12-07 15:39:25 UTC
Created attachment 965582 [details]
C++ sample code to reproduce this issue

Description of problem:
C++ HotRod Client has wrong cache size after the key/value is expired when using lifespan


Version-Release number of selected component (if applicable):
RHEL 6.4 64 bit
JBoss Data Grid 6.3.0 GA
C++ HotRod Client

Steps to Reproduce:
1. Start JDG 6.3.0 server;
2. Using C++ HotRod Client to connect to server;
3. Using C++ HotRod Client to create a key/value to set the lifespan is 3 seconds, and the size is 1 and you can get the key/value;
4. After 3 seconds, you will not get the key/value but the size is still 1;

Comment 1 Benny 2014-12-07 15:40:31 UTC
this issue doesn't exist in JAVA HotRod client.

Comment 3 Benny 2014-12-07 15:41:47 UTC
Created attachment 965583 [details]
Java HotRod Client doesn't have this issue

Comment 4 Ion Savin 2014-12-12 11:39:41 UTC
The native client is using HotRod Protocol 1.2 and size() is implemented using server statistics, more specifically the "currentNumberOfEntries" stat which doesn't seem to be updated as soon as the entry expires.

Version 2.0 of the protocol introduced a proper Size operation. We would need to implement 2.0 in the native client to fix this (the java client is already using this operation and this is why for that client the test works fine).

Comment 5 Tristan Tarrant 2014-12-12 12:22:02 UTC
Additionally the "currentNumberOfEntries" statistic is broken since it returns the size of the data container of the node responding to the request which doesn't take into account: eviction/expiration/persistence/distribution/etc.

Comment 7 Alan Field 2014-12-16 13:09:08 UTC
One possible fix for this issue would be to use the same HotRod protocol version (1.2) in the Java and C++ clients in the product. Then they would be consistent with each other until the new protocol is implemented in all of the clients.

Comment 8 Ion Savin 2014-12-23 11:11:28 UTC
I just realised that for the JDG Java client the behavior is actually identical as the size operation is not used and the same stat ("currentNumberOfEntries") is used instead.

Tested using JDG-6.4.0-ER7-redhat-1 using the attached code and both clients give the correct answer if a get() is performed on the expired keys prior to size() and the wrong answer if a prior get() is not performed.

Comment 9 Divya Mehra 2014-12-23 13:52:21 UTC
Let's exclude this from CR1 until we have had another chat with Tristan about this.

Comment 11 Alan Field 2015-01-08 22:40:57 UTC
Verified with JDG 6.4.0 ER8

Comment 14 Tristan Tarrant 2015-01-15 12:58:04 UTC
In the case of a cache with eviction/passivation to a cachestore, the entries present on the cachestore will be included in the count returned by the size() operation