[ 
https://issues.apache.org/jira/browse/IGNITE-6804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16989749#comment-16989749
 ] 

Vyacheslav Koptilin edited comment on IGNITE-6804 at 12/6/19 2:45 PM:
----------------------------------------------------------------------

Hello [~nizhikov], [~avinogradov],

> Maybe we should deprecate putAll(Map) and introduce putAll(SortedMap) instead?
I don't think that {{putAll(Map)}} can be deprecated just because it is a part 
of JSR-109.

> We should just perform instanceOf check inside the putAll() method if 
> pessimistic.
-The user can use any kind of implementation of Map interface. It does not seem 
a reliable solution.- Looks like this comment does not make sense (parameter 
must extend/implement {{SortedMap}})

> This will affect atomics and optimistic transactions, which are resistant to 
> this issue.
It must be done for the atomic cache as well. Please take a look at 
{{GridDhtAtomicCache.updateAllAsyncInternal0}}
{code:java}
            // If batch store update is enabled, we need to lock all entries.
            // First, need to acquire locks on cache entries, then check filter.
            List<GridDhtCacheEntry> locked = lockEntries(req, 
req.topologyVersion());;
{code}



was (Author: slava.koptilin):
Hello [~nizhikov], [~avinogradov],

> Maybe we should deprecate putAll(Map) and introduce putAll(SortedMap) instead?
I don't think that {{putAll(Map)}} can be deprecated just because it is a part 
of JSR-109.

> We should just perform instanceOf check inside the putAll() method if 
> pessimistic.
-The user can use any kind of implementation of Map interface. It does not seem 
a reliable solution.- Look like this comment does not make sense (parameter 
must extend/implement {{SortedMap}})

> This will affect atomics and optimistic transactions, which are resistant to 
> this issue.
It must be done for the atomic cache as well. Please take a look at 
{{GridDhtAtomicCache.updateAllAsyncInternal0}}
{code:java}
            // If batch store update is enabled, we need to lock all entries.
            // First, need to acquire locks on cache entries, then check filter.
            List<GridDhtCacheEntry> locked = lockEntries(req, 
req.topologyVersion());;
{code}


> Print a warning if HashMap is passed into bulk update operations
> ----------------------------------------------------------------
>
>                 Key: IGNITE-6804
>                 URL: https://issues.apache.org/jira/browse/IGNITE-6804
>             Project: Ignite
>          Issue Type: Improvement
>          Components: cache
>            Reporter: Denis A. Magda
>            Assignee: Ilya Kasnacheev
>            Priority: Critical
>              Labels: usability
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Ignite newcomers tend to stumble on deadlocks simply because the keys are 
> passed in an unordered HashMap. Propose to do the following:
> * update bulk operations Java docs.
> * print out a warning if not SortedMap (e.g. HashMap, 
> Weak/Identity/Concurrent/Linked HashMap etc) is passed into
> a bulk method (instead of SortedMap) and contains more than 1 element. 
> However, we should make sure that we only print that warning once and not 
> every time the API is called.
> * do not produce warning for explicit optimistic transactions
> More details are here:
> http://apache-ignite-developers.2346864.n4.nabble.com/Re-Ignite-2-0-0-GridUnsafe-unmonitor-td23706.html



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to