Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-6537

Transactions bug

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: examples
    • Labels:
      None
    • Environment:

      general

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jarvis657 tommyjarvis
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: