Hi Charlin,

Most likely you should use a single *TryGet *[1] call instead of
ContainsKey + Get,
it achieves the same logic more efficiently and without the risk of race
conditions.

Looks like the key gets removed in between the ContainsKey and Get calls
by another thread / process / node.

[1]
https://ignite.apache.org/releases/latest/dotnetdoc/api/Apache.Ignite.Core.Cache.ICache-2.html#Apache_Ignite_Core_Cache_ICache_2_TryGet__0__1__


On Mon, Feb 15, 2021 at 5:12 AM Ilya Kazakov <kazakov.i...@gmail.com> wrote:

> Hello, Charlin!
>
> Could you show any reproducer, please?
>
> ------------------------
> Thanks, Ilya!
>
> пт, 12 февр. 2021 г. в 18:43, Charlin S <charli...@hotelhub.com>:
>
>> Hi,
>> I am getting below error while running load test with ignite 2.9.1 but
>> ContainsKey is successful and thereafter  Get by key is failed
>> The given key was not present in the cache: 
>> TestModel:HH|E6661DD9C3@$@@$@@$@(null)@$@@$@(null)@$@System.Collections.Generic.KeyNotFoundException:
>> The given key was not present in the cache: testModel:HH|E6661DD9C3
>>    at
>> Apache.Ignite.Core.Impl.Cache.CacheImpl`2.<>c__DisplayClass30.<Get>b__2f(IBinaryStream
>> stream, Int64 res)
>>    at Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutLong[TR](Int32
>> type, Func`2 outAction, Func`3 inAction, Func`2 readErrorAction)
>>    at Apache.Ignite.Core.Impl.Cache.CacheImpl`2.Get(TK key)
>>
>> Code snippet:
>> [image: image.png]
>>
>> Thanks & Regards,
>> Charlin
>>
>>
>

Reply via email to