Richa Bali created IGNITE-5405:
----------------------------------

             Summary: Null values in comparator for EvictableEntry
                 Key: IGNITE-5405
                 URL: https://issues.apache.org/jira/browse/IGNITE-5405
             Project: Ignite
          Issue Type: Bug
          Components: cache
    Affects Versions: 2.0
            Reporter: Richa Bali


EvictableEntry has null value for corresponding key.
We cache an object with key as a unique identifier (member variable of the 
object) and value as the object itself.
EvictionPolicy used is the SortedEvictionPolicy with our custom comparator.

Entry is removed from cache for some keys but those entries are subsequently 
passed to comparator with key but null object.

Sample project is attached.
Details of sample project:
DemoEntry class containing mId and mTimeUTC. mId is the unique identifier used 
as key for cache and mTimeUTC is the member variable used in DemoComparator.
DemoComparator is used for SortedEvictionPolicy on the basis of mTimeUTC.
IgniteEvictionListener is the listener to check if the entries are evicted.

Sample run:
DemoProject:
10 entries are added to cache for which the eviction policy used is 
SortedEvictionPolicy on the basis of DemoComparator. Size is set to 5.
2 of the entries are removed and data in cache is printed.

Note: Removed keys are not used to fetch the data from cache.

Observations:
Sometimes, null value for the key (not null key) is passed to comparator. Since 
the data used in sample project is limited to 10 entries only, it is not 
reproducible in all the runs. It occurs sometimes (may be because of 
asynchronous behavior).
But if we try to retrieve even the removed value by commenting lines 62-64 of 
DemoProject, it is usually reproducible.

Attached are the sample logs where we retrieved only those values that were not 
removed.
"Null value logs.txt": logs when null value scenario occurred.
"No null value logs.txt": logs when null value scenario didn't occur.

Sample project is also attached. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to