You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/07/13 04:05:00 UTC
[jira] [Commented] (IGNITE-8995) FailureHandler executed on error
in ScanQuery's IgniteBiPredicate
[ https://issues.apache.org/jira/browse/IGNITE-8995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16542480#comment-16542480 ]
ASF GitHub Bot commented on IGNITE-8995:
----------------------------------------
GitHub user dgladkikh opened a pull request:
https://github.com/apache/ignite/pull/4354
IGNITE-8995 FailureHandler executed on error in ScanQuery's IgniteBiP…
…redicate.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/gridgain/apache-ignite ignite-8995
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/ignite/pull/4354.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #4354
----
commit 7d608e2c6e21b51d44f6f2c23dd3e9abd831d868
Author: dgladkikh <dg...@...>
Date: 2018-07-13T03:59:49Z
IGNITE-8995 FailureHandler executed on error in ScanQuery's IgniteBiPredicate.
----
> FailureHandler executed on error in ScanQuery's IgniteBiPredicate
> -----------------------------------------------------------------
>
> Key: IGNITE-8995
> URL: https://issues.apache.org/jira/browse/IGNITE-8995
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.5
> Reporter: Dmitriy Gladkikh
> Assignee: Dmitriy Gladkikh
> Priority: Major
>
> This code demonstrates this behavior:
> {code:java}
> import java.util.Collections;
> import javax.cache.Cache;
> import org.apache.ignite.Ignite;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.Ignition;
> import org.apache.ignite.binary.BinaryObject;
> import org.apache.ignite.cache.CacheAtomicityMode;
> import org.apache.ignite.cache.CacheMode;
> import org.apache.ignite.cache.query.QueryCursor;
> import org.apache.ignite.cache.query.ScanQuery;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.configuration.DataRegionConfiguration;
> import org.apache.ignite.configuration.DataStorageConfiguration;
> import org.apache.ignite.configuration.IgniteConfiguration;
> import org.apache.ignite.lang.IgniteBiPredicate;
> import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
> import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
> /**
> * -ea -DIGNITE_QUIET=false
> */
> public class ScanQueryIgniteBiPredicateWithError {
> private static final String CACHE_NAME = "test_cache_name";
> public static void main(String[] args) {
> try (Ignite igniteServer = Ignition.start(getCfg("node_server", false));
> Ignite igniteClient = Ignition.start(getCfg("node_client", true)))
> {
> IgniteCache<Integer, BinaryObject> cache = igniteClient.cache(CACHE_NAME);
> cache.put(1, igniteClient.binary().builder("test_type").setField("field_0", "field_0_val").build());
> try (QueryCursor<Cache.Entry<Integer, BinaryObject>> cursor = cache.withKeepBinary().query(new ScanQuery<>(
> new IgniteBiPredicate<Integer, BinaryObject>() {
> @Override public boolean apply(Integer key, BinaryObject value) {
> throw new AssertionError(); // Error.
> //return value.field(null) != null; // Error.
> //return true; // Ok.
> }
> })))
> {
> for (Cache.Entry<Integer, BinaryObject> entry : cursor)
> // Without error in IgniteBiPredicate:
> // Key = 1, Val = test_type [idHash=2024711353, hash=394028655, field_0=val_0]
> System.out.printf("Key = %s, Val = %s%n", entry.getKey(), entry.getValue());
> }
> }
> }
> /**
> * @param instanceName Ignite instance name.
> * @param clientMode Client mode.
> * @return Ignite configuration.
> */
> private static IgniteConfiguration getCfg(String instanceName, boolean clientMode) {
> TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
> ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
> TcpDiscoverySpi tcpDiscoverySpi = new TcpDiscoverySpi();
> tcpDiscoverySpi.setIpFinder(ipFinder);
> DataRegionConfiguration dataRegionCfg = new DataRegionConfiguration();
> dataRegionCfg.setPersistenceEnabled(true);
> DataStorageConfiguration dataStorageCfg = new DataStorageConfiguration();
> dataStorageCfg.setDefaultDataRegionConfiguration(dataRegionCfg);
> CacheConfiguration<Integer, BinaryObject> ccfg = new CacheConfiguration<Integer, BinaryObject>(CACHE_NAME)
> .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
> .setCacheMode(CacheMode.PARTITIONED);
> IgniteConfiguration cfg = new IgniteConfiguration();
> cfg.setIgniteInstanceName(instanceName);
> cfg.setDiscoverySpi(tcpDiscoverySpi);
> cfg.setDataStorageConfiguration(dataStorageCfg);
> cfg.setCacheConfiguration(ccfg);
> if (!clientMode)
> cfg.setAutoActivationEnabled(true);
> else
> cfg.setClientMode(true);
> return cfg;
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)