You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Akash Shinde <ak...@gmail.com> on 2020/02/28 17:10:54 UTC

cache.containsKey returns false

Hi,
I am using Ignite 2.6 version.

I have partitioned cache, read-through and write-through is enabled.
Back-up count is 1 and total number of server nodes in cluster are  3.

When I try to get the data from a cache for a key using cache.get(key)
method, ignite reads the value from database using provided cache loader
and returns the value by read-through approach.

But when I execute cache().containsKey(key) on client node, I get false.

But the strange this is this behavior is not same for all keys of the same
cache.
For key1 I get false but for key2 I get true. But both the keys are present
in cache.

I executed the SQL on every node (one node at a time) using web-console, I
got data present only on one node out of three. This seems to be primary
for this particular key.

Can someone please advise why this is happening? Is it a bug in ignite?
This seems to be a very basic case.



Thanks,
Akash

Re: cache.containsKey returns false

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

As far as my understanding goes, this is how readThrough work. It may
update only subset of REPLICATED cache partitions across cluster.

Regards,
-- 
Ilya Kasnacheev


пт, 28 февр. 2020 г. в 21:09, Prasad Bhalerao <prasadbhalerao1983@gmail.com
>:

> Hi,
>
> We have not set any expiration/ eviction policy.
> We were getting false for key "key1", so we checked the key/value by
> querying cache using web console and the value is present in cache. But
> still getting false for key "key1" on subsequent containskey execution.
>
> But for key "key2" we were getting true.
>
> Thanks,
> Prasad
>
> On Fri 28 Feb, 2020, 10:58 PM Denis Magda <dmagda@apache.org wrote:
>
>> Hi Akash,
>>
>> Do you execute the cache.contains() method after reading-through the
>> record with cache.get()? Do you have any expiration/eviction policies set
>> that may purge the record from memory after being loaded from disk?
>>
>> -
>> Denis
>>
>>
>> On Fri, Feb 28, 2020 at 9:11 AM Akash Shinde <ak...@gmail.com>
>> wrote:
>>
>>> Hi,
>>> I am using Ignite 2.6 version.
>>>
>>> I have partitioned cache, read-through and write-through is enabled.
>>> Back-up count is 1 and total number of server nodes in cluster are  3.
>>>
>>> When I try to get the data from a cache for a key using cache.get(key)
>>> method, ignite reads the value from database using provided cache loader
>>> and returns the value by read-through approach.
>>>
>>> But when I execute cache().containsKey(key) on client node, I get false.
>>>
>>> But the strange this is this behavior is not same for all keys of the
>>> same cache.
>>> For key1 I get false but for key2 I get true. But both the keys are
>>> present in cache.
>>>
>>> I executed the SQL on every node (one node at a time) using web-console,
>>> I got data present only on one node out of three. This seems to be primary
>>> for this particular key.
>>>
>>> Can someone please advise why this is happening? Is it a bug in ignite?
>>> This seems to be a very basic case.
>>>
>>>
>>>
>>> Thanks,
>>> Akash
>>>
>>

Re: cache.containsKey returns false

Posted by Prasad Bhalerao <pr...@gmail.com>.
Hi,

We have not set any expiration/ eviction policy.
We were getting false for key "key1", so we checked the key/value by
querying cache using web console and the value is present in cache. But
still getting false for key "key1" on subsequent containskey execution.

But for key "key2" we were getting true.

Thanks,
Prasad

On Fri 28 Feb, 2020, 10:58 PM Denis Magda <dmagda@apache.org wrote:

> Hi Akash,
>
> Do you execute the cache.contains() method after reading-through the
> record with cache.get()? Do you have any expiration/eviction policies set
> that may purge the record from memory after being loaded from disk?
>
> -
> Denis
>
>
> On Fri, Feb 28, 2020 at 9:11 AM Akash Shinde <ak...@gmail.com>
> wrote:
>
>> Hi,
>> I am using Ignite 2.6 version.
>>
>> I have partitioned cache, read-through and write-through is enabled.
>> Back-up count is 1 and total number of server nodes in cluster are  3.
>>
>> When I try to get the data from a cache for a key using cache.get(key)
>> method, ignite reads the value from database using provided cache loader
>> and returns the value by read-through approach.
>>
>> But when I execute cache().containsKey(key) on client node, I get false.
>>
>> But the strange this is this behavior is not same for all keys of the
>> same cache.
>> For key1 I get false but for key2 I get true. But both the keys are
>> present in cache.
>>
>> I executed the SQL on every node (one node at a time) using web-console,
>> I got data present only on one node out of three. This seems to be primary
>> for this particular key.
>>
>> Can someone please advise why this is happening? Is it a bug in ignite?
>> This seems to be a very basic case.
>>
>>
>>
>> Thanks,
>> Akash
>>
>

Re: cache.containsKey returns false

Posted by Denis Magda <dm...@apache.org>.
Hi Akash,

Do you execute the cache.contains() method after reading-through the record
with cache.get()? Do you have any expiration/eviction policies set that may
purge the record from memory after being loaded from disk?

-
Denis


On Fri, Feb 28, 2020 at 9:11 AM Akash Shinde <ak...@gmail.com> wrote:

> Hi,
> I am using Ignite 2.6 version.
>
> I have partitioned cache, read-through and write-through is enabled.
> Back-up count is 1 and total number of server nodes in cluster are  3.
>
> When I try to get the data from a cache for a key using cache.get(key)
> method, ignite reads the value from database using provided cache loader
> and returns the value by read-through approach.
>
> But when I execute cache().containsKey(key) on client node, I get false.
>
> But the strange this is this behavior is not same for all keys of the same
> cache.
> For key1 I get false but for key2 I get true. But both the keys are
> present in cache.
>
> I executed the SQL on every node (one node at a time) using web-console, I
> got data present only on one node out of three. This seems to be primary
> for this particular key.
>
> Can someone please advise why this is happening? Is it a bug in ignite?
> This seems to be a very basic case.
>
>
>
> Thanks,
> Akash
>