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

Konstantin Dudkov commented on IGNITE-3955:
-------------------------------------------

Looks like test fails in CLOCK atomicWriteOrderMode, but IMHO in that mode you 
can't use invoke (concurrent invokes possible). So I've added condition check 
to you test and pushed it to branch ignite-3955

{code}
    public void testInvokeAllMultithreaded() throws Exception {
        final IgniteCache<String, Integer> cache = jcache();
        final int threadCnt = 4;
        final int cnt = 90000;

        // it's no use to run invoke with CLOCK atomicWriteOrderMode
        if (atomicityMode() == ATOMIC && 
grid(0).context().cache().cacheConfiguration(null).getAtomicWriteOrderMode() == 
CLOCK)
            return;

        final Set<String> keys = Collections.singleton("myKey");

        GridTestUtils.runMultiThreaded(new Runnable() {
            @Override public void run() {
                for (int i = 0; i < cnt; i++) {
                    final Map<String, EntryProcessorResult<Integer>> res =
                        cache.invokeAll(keys, new CacheEntryProcessor<String, 
Integer, Integer>() {
                            @Override
                            public Integer process(MutableEntry<String, 
Integer> entry,
                                Object... objects) throws 
EntryProcessorException {
                                Integer val = entry.getValue();

                                if (val == null)
                                    val = 0;

                                val++;

                                entry.setValue(val);

                                return val;
                            }
                        });

                    assert res.size() == 1;
                }
            }
        }, threadCnt, "testInvokeAllMultithreaded");
        assertEquals(cnt * threadCnt, (int)cache.get("myKey"));
    }
{code}

> IgniteCache.invokeAll returns empty result set in ATOMIC cache
> --------------------------------------------------------------
>
>                 Key: IGNITE-3955
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3955
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 1.7
>            Reporter: Pavel Tupitsyn
>            Assignee: Konstantin Dudkov
>             Fix For: 1.8
>
>
> When entry processor is invoked from multiple threads, result set is 
> sometimes empty.
> This happens with ATOMIC cache, but not with TRANSACTIONAL.
> To reproduce, paste the following into GridCacheAbstractFullApiSelfTest.java:
> {code}
>     public void testInvokeAllMultithreaded() throws Exception {
>         final IgniteCache<String, Integer> cache = jcache();
>         final int threadCnt = 4;
>         final int cnt = 90000;
>         final Set<String> keys = Collections.singleton("myKey");
>         GridTestUtils.runMultiThreaded(new Runnable() {
>             @Override public void run() {
>                 for (int i = 0; i < cnt; i++) {
>                     final Map<String, EntryProcessorResult<Integer>> res =
>                         cache.invokeAll(keys, new CacheEntryProcessor<String, 
> Integer, Integer>() {
>                             @Override
>                             public Integer process(MutableEntry<String, 
> Integer> entry,
>                                 Object... objects) throws 
> EntryProcessorException {
>                                 Integer val = entry.getValue();
>                                 if (val == null)
>                                     val = 0;
>                                 val++;
>                                 entry.setValue(val);
>                                 return val;
>                             }
>                         });
>                     assertEquals(1, res.size());
>                 }
>             }
>         }, threadCnt, "testInvokeAllMultithreaded");
>         assertEquals(cnt*threadCnt, (int)cache.get("myKey"));
>     }
> {code}
> Run this test as part of GridCacheAtomicFullApiSelfTest.java.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to