[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maxim Muzafarov updated IGNITE-5994:
Fix Version/s: 2.8
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
> Components: cache
>Affects Versions: 2.1
>Reporter: Alexander Menshikov
>Assignee: Alexander Menshikov
>Priority: Minor
> Labels: newbie
> Fix For: 2.8
>
> Attachments: IgniteCacheSelfTest.java,
> master_8629b50d6f_ignite-5994.patch
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> {noformat}
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> {noformat}
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zhang Yuan updated IGNITE-5994:
---
Attachment: master_8629b50d6f_ignite-5994.patch
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
> Components: cache
>Affects Versions: 2.1
>Reporter: Alexander Menshikov
>Assignee: Zhang Yuan
>Priority: Minor
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java,
> master_8629b50d6f_ignite-5994.patch
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> {noformat}
> final EntryProcessor
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yakov Zhdanov updated IGNITE-5994:
--
Description:
The IgniteInternalCache.invoke() always return an EntryProcessorResult, but the
IgniteInternalCache.invokeAsync().get() can return the null in case when an
EntryProcessor has returned the null.
Code from reproducer:
{noformat}
final EntryProcessor ep = new EntryProcessor() {
@Override
public Object process(MutableEntry entry,
Object... objects) throws EntryProcessorException {
return null;
}
};
EntryProcessorResult result = utilCache.invoke("test", ep);
assertNotNull(result);
assertNull(result.get());
result = utilCache.invokeAsync("test", ep).get();
// Assert here!!!
assertNotNull(result);
assertNull(result.get());
{noformat}
It can be optimization. Nevertheless results of invoke() must be equals with
results of invokeAsync().get(). So there are two options:
1) To do so would be the invokeAsync(key, ep).get() returned the null too for
the optimization.
2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
for a logical consistency.
NOTE: Don't confuse with IgniteCache.invoke.
was:
The IgniteInternalCache.invoke() always return an EntryProcessorResult, but the
IgniteInternalCache.invokeAsync().get() can return the null in case when an
EntryProcessor has returned the null.
Code from reproducer:
```Java
final EntryProcessor ep = new EntryProcessor() {
@Override
public Object process(MutableEntry entry,
Object... objects) throws EntryProcessorException {
return null;
}
};
EntryProcessorResult result = utilCache.invoke("test", ep);
assertNotNull(result);
assertNull(result.get());
result = utilCache.invokeAsync("test", ep).get();
// Assert here!!!
assertNotNull(result);
assertNull(result.get());
```
It can be optimization. Nevertheless results of invoke() must be equals with
results of invokeAsync().get(). So there are two options:
1) To do so would be the invokeAsync(key, ep).get() returned the null too for
the optimization.
2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
for a logical consistency.
NOTE: Don't confuse with IgniteCache.invoke.
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
> Components: cache
>Affects Versions: 2.1
>Reporter: Alexander Menshikov
>Priority: Minor
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> {noformat}
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> {noformat}
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Menshikov updated IGNITE-5994:
Component/s: cache
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
> Components: cache
>Affects Versions: 2.1
>Reporter: Alexander Menshikov
>Priority: Minor
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> ```Java
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> ```
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Menshikov updated IGNITE-5994:
Affects Version/s: 2.1
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
> Components: cache
>Affects Versions: 2.1
>Reporter: Alexander Menshikov
>Priority: Minor
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> ```Java
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> ```
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Menshikov updated IGNITE-5994:
Priority: Minor (was: Major)
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
>Reporter: Alexander Menshikov
>Priority: Minor
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> ```Java
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> ```
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Menshikov updated IGNITE-5994:
Labels: newbie (was: )
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
>Reporter: Alexander Menshikov
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> ```Java
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> ```
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Menshikov updated IGNITE-5994:
Attachment: IgniteCacheSelfTest.java
> IgniteInternalCache.invokeAsync().get() can return null
> ---
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
>Reporter: Alexander Menshikov
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> ```Java
> final EntryProcessor ep = new EntryProcessor Object, Object>() {
> @Override
> public Object process(MutableEntry entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> ```
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Menshikov updated IGNITE-5994:
Docs Text: (was: /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.processors.cache;
import javax.cache.CacheException;
import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.TransactionConfiguration;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.communication.GridIoMessage;
import
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal;
import
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxPrepareRequest;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.spi.IgniteSpiException;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionTimeoutException;
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
import static
org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED;
/**
* Test checks that grid transaction configuration doesn't influence system
caches.
*/
public class IgniteCacheSelfTest extends GridCommonAbstractTest {
/** Ip finder. */
private static final TcpDiscoveryIpFinder IP_FINDER = new
TcpDiscoveryVmIpFinder(true);
/** Test cache name. */
private static final String CACHE_NAME = "cache_name";
/** Timeout of transaction. */
private static final long TX_TIMEOUT = 100;
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String
igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);
ccfg.setAtomicityMode(atomicityMode());
ccfg.setBackups(1);
cfg.setCacheConfiguration(ccfg);
final TransactionConfiguration txCfg = new TransactionConfiguration();
txCfg.setDefaultTxTimeout(TX_TIMEOUT);
cfg.setTransactionConfiguration(txCfg);
return cfg;
}
/**
* @return Cache atomicity mode.
*/
public CacheAtomicityMode atomicityMode() {
return TRANSACTIONAL;
}
/** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception {
startGrids(2);
}
/** {@inheritDoc} */
@Override protected void afterTestsStopped() throws Exception {
stopAllGrids();
}
/**
* @throws Exception If failed.
*/
public void testSystemCacheInvoke() throws Exception {
final Ignite ignite = grid(0);
final IgniteInternalCache utilCache =
getSystemCache(ignite, CU.UTILITY_CACHE_NAME);
utilCache.put("test", "");
final EntryProcessor ep = new
EntryProcessor() {