You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexey Goncharuk (JIRA)" <ji...@apache.org> on 2017/10/02 12:00:04 UTC

[jira] [Comment Edited] (IGNITE-6537) Transactions bug

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

Alexey Goncharuk edited comment on IGNITE-6537 at 10/2/17 11:59 AM:
--------------------------------------------------------------------

[~jarvis657], this is not a bug because size() cache operation is not transactional.


was (Author: agoncharuk):
[~tommyjarvis], this is not a bug because size() cache operation is not transactional.

> Transactions bug 
> -----------------
>
>                 Key: IGNITE-6537
>                 URL: https://issues.apache.org/jira/browse/IGNITE-6537
>             Project: Ignite
>          Issue Type: Bug
>          Components: examples
>    Affects Versions: 2.2
>         Environment: general
>            Reporter: tommyjarvis
>
> Code:
> get ignite:
> ==============================
>    org.apache.ignite.configuration.IgniteConfiguration cfg = new org.apache.ignite.configuration.IgniteConfiguration();
>         TcpDiscoverySpi spi = new TcpDiscoverySpi();
>         spi.setLocalPort(48501);
>         spi.setLocalPortRange(20);
>         TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
>         ipFinder.setAddresses(serverList);
>         spi.setIpFinder(ipFinder);
>         TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
>         commSpi.setSlowClientQueueLimit(1000);
>         commSpi.setLocalPort(48101);
>         cfg.setClientMode(true);
>         cfg.setDiscoverySpi(spi);
>         cfg.setCommunicationSpi(commSpi);
>         cfg.setPeerClassLoadingEnabled(true);
>         PersistentStoreConfiguration persistentStoreConfiguration = new PersistentStoreConfiguration();
>         cfg.setPersistentStoreConfiguration(persistentStoreConfiguration); 
>         ignite = Ignition.start(cfg);
> ===========================================
> config cache:
>  CacheConfiguration<Integer, String> cacheCfg = new CacheConfiguration<>(CACHE_NAME);
>         cacheCfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.MINUTES, 2)));
>         cacheCfg.setCacheMode(CacheMode.REPLICATED);
>         cacheCfg.setBackups(1);
>         cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
>  
>        IgniteCache cache = ignite.getOrCreateCache(cacheCfg);
> ==========================================
> transaction like this:
>    Thread t = new Thread(() -> {
>                 try (Transaction tx = ignite.transactions().txStart()) {
>                     for (int i = 0; i < 1000; i++) {
>                         cache.put(i, i);
>                     }
>                     tx.commit();
>                 }
>             });
>             t.start();
>             //
>             int lastSize = 0;
>             while (true) {
>                 int size = cache.size();
>                 //            int size = cache2.localSize();
>                 size = cache.query(new ScanQuery<>()).getAll().size();
>                 if (size != lastSize) {
>                     System.out.println(size);
>                     lastSize = size;
>                 }
>                 System.out.println("##################################" + size);
>             }
> i thought  only print ###0  and ###1000
> but after i run print like this:
> 163
> ##################################163
> 515
> ##################################515
> 1000
> ##################################1000
> ##################################1000



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)