[
https://issues.apache.org/jira/browse/IGNITE-1180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14651582#comment-14651582
]
Denis Magda edited comment on IGNITE-1180 at 8/3/15 8:22 AM:
-------------------------------------------------------------
Well, I would add {{randomEntry()}} methods to both
{{GridUnsafePartitionedMap}} and {{GridUnsafeMap}} and implement it this way:
1) Peeking a random partition in {{GridUnsafePartitionedMap}}. The partition is
an instance of {{GridUnsafeMap}};
2) In the peeked partition choosing a random segment;
3) In the segment peeking a random pointer to an entry that lays between
[segment's header start; segment's end];
4) Recreating the entry using the pointer and return to a caller.
Algorithmic complexity should be around O(S * N/64) as
{{IgniteCache.randomEntry()}} states.
was (Author: dmagda):
Well, I would add {{randomEntry()}} methods to both
{{GridUnsafePartitionedMap}} and {{GridUnsafeMap}} and implement it this way:
1) Peeking a random partition in {{GridUnsafePartitionedMap}}. The partition is
an instance of {{GridUnsafeMap}};
2) In the peeked partition choosing a random segment;
3) In the segment peeking a random pointer to an entry that lays between
[segment's header start; segment's end];
4) Putting the entry into the heap and return to a caller.
Algorithmic complexity should be around O(S * N/64) as
{{IgniteCache.randomEntry()}} states.
> IgniteCache.randomEntry() doesn't work when offheap mode is used
> ----------------------------------------------------------------
>
> Key: IGNITE-1180
> URL: https://issues.apache.org/jira/browse/IGNITE-1180
> Project: Ignite
> Issue Type: Bug
> Components: cache
> Reporter: Denis Magda
> Fix For: ignite-1.4
>
>
> {{IgniteCache.randomEntry()}} always returns {{null}} when
> {{CacheMemoryMode.OFFHEAP_TIERED}} mode is used.
> How to reproduce:
> - create partitioned or replicated cache;
> - populate it with data;
> - make a call {{IgniteCache.randomEntry()}}.
> Also OffHeap versions of {{CacheVersionedEntryAbstractTest}} may be used to
> reproduce the issue.
> These tests will be merged to master when IGNITE-946 is closed. Unmute these
> tests on TC when the issue is fixed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)