We have a 4-node(server) setup. The configuration for each node includes a cache configuration that it is both partitioned and transactional as well as 2 backups:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> <property name="cacheConfiguration"> <list> <bean class="org.apache.ignite.configuration.CacheConfiguration"> <property name="name" value="customers"/> <property name="cacheMode" value="PARTITIONED"/> <property name="atomicityMode" value="TRANSACTIONAL"/> <property name="backups" value="2"/> </bean> </list> </property> <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <property name="localPort" value="48500"/> <property name="localPortRange" value="100"/> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> <property name="addresses"> <list> <value>hc1.dev.xxx.com:48500..48600</value> <value>hc2.dev.xxx.com:48500..48600</value> <value>hc3.dev.xxx.com:48500..48600</value> <value>hc4.dev.xxx.com:48500..48600</value> </list> </property> </bean> </property> </bean> </property> </bean> </beans> We also have a test client that uses the same configuration and executes 10 transactions with each transaction inserting 1K keys. Before committing the transaction, there is a pause(sleep) of 60 seconds. In another client, using the same configuration, every 2 seconds we read the size of the cache. What we are seeing is that between all the 1K entries being put but before being committed, the other client sees (in size at least) them. If we force a rollback of that transaction(by way of killing the client), the size-reading client stops seeing those and reverts back to the actual committed size. What are we missing/not understanding? Client that does the inserts int maxTransactions = 10; int maxEntriesPerTx = 1000; int startKey = 0; Logger logger = Logger.getLogger(TestIgnite.class.getName()); logger.info("Starting " + maxTransactions + " transactions"); for (int i = 0; i < maxTransactions; i++) { logger.info("Working on transaction " + (i+1) + ". Inserting keys=" + (startKey + maxEntriesPerTx * i) + ".." + (startKey - 1 + maxEntriesPerTx * (i+1))); Transaction tx = ignite.transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED); try { for (int j = 0; j < maxEntriesPerTx; j++) { int entryKey = startKey + maxEntriesPerTx * i + j; cache.put(new Integer(entryKey), new MyClass(entryKey+"")); } logger.info("Finished putting. Sleeping for 60s"); try { Thread.sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } logger.info("Finished sleeping"); tx.commit(); logger.info("Commit complete. Put " + (maxEntriesPerTx * (i+1)) + " entries so far"); logger.info("Retrieving size for customers map. Size=" + cache.size()); } catch (RuntimeException e) { if ( e.getCause() != null && e.getCause() instanceof ClusterTopologyException) { logger.log(Level.WARNING, " occurred. Rolling back and retrying transaction " + i--, e); tx.rollback(); } else throw e; } finally { tx.close(); } } Client that does the reading of the size Logger logger = Logger.getLogger(TestIgnite.class.getName()); try (Ignite ignite = Ignition.start(cfg)) { IgniteCache<Integer, MyClass> cache = ignite.getOrCreateCache("customers"); while (true) { logger.info("Size=" + cache.size()); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } } Jul 21, 2016 3:35:02 PM org.apache.ignite.logger.java.JavaLogger info INFO: Topology snapshot [ver=9, servers=4, clients=1, CPUs=24, heap=7.6GB] Jul 21, 2016 3:35:02 PM org.apache.ignite.logger.java.JavaLogger info INFO: Started cache [name=customers, mode=PARTITIONED] Jul 21, 2016 3:35:02 PM com.juan.ignite.ClientIgnite main INFO: Size=0 Jul 21, 2016 3:35:04 PM org.apache.ignite.logger.java.JavaLogger info INFO: Added new node to topology: TcpDiscoveryNode [id=69547ec4-f2b9-4365-85cf-bc7f64b35d34, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1, 172.19.131.36], sockAddrs=[/172.19.131.36:0, /0:0:0:0:0:0:0:1:0, /127.0.0.1:0, /172.19.131.36:0], discPort=0, order=10, intOrder=8, lastExchangeTime=1469140504226, loc=false, ver=1.6.0#20160518-sha1:0b22c45b, isClient=true] Jul 21, 2016 3:35:04 PM org.apache.ignite.logger.java.JavaLogger info INFO: Topology snapshot [ver=10, servers=4, clients=2, CPUs=24, heap=11.0GB] Jul 21, 2016 3:35:04 PM com.juan.ignite.ClientIgnite main INFO: Size=0 Jul 21, 2016 3:35:06 PM com.juan.ignite.ClientIgnite main INFO: Size=309 Jul 21, 2016 3:35:08 PM com.juan.ignite.ClientIgnite main INFO: Size=679 Jul 21, 2016 3:35:10 PM com.juan.ignite.ClientIgnite main INFO: Size=1000 Jul 21, 2016 3:35:12 PM org.apache.ignite.logger.java.JavaLogger info INFO: Your version is up to date. Jul 21, 2016 3:35:12 PM com.juan.ignite.ClientIgnite main INFO: Size=1000 Jul 21, 2016 3:35:14 PM com.juan.ignite.ClientIgnite main INFO: Size=1000 Jul 21, 2016 3:35:16 PM com.juan.ignite.ClientIgnite main INFO: Size=1000 Jul 21, 2016 3:35:18 PM com.juan.ignite.ClientIgnite main INFO: Size=1000 Jul 21, 2016 3:35:21 PM com.juan.ignite.ClientIgnite main INFO: Size=1000 Jul 21, 2016 3:35:21 PM org.apache.ignite.logger.java.JavaLogger info INFO: Node left topology: TcpDiscoveryNode [id=69547ec4-f2b9-4365-85cf-bc7f64b35d34, addrs=[0:0:0:0:0:0:0:1, 127.0.0.1, 172.19.131.36], sockAddrs=[/172.19.131.36:0, /0:0:0:0:0:0:0:1:0, /127.0.0.1:0, /172.19.131.36:0], discPort=0, order=10, intOrder=8, lastExchangeTime=1469140504226, loc=false, ver=1.6.0#20160518-sha1:0b22c45b, isClient=true] Jul 21, 2016 3:35:21 PM org.apache.ignite.logger.java.JavaLogger info INFO: Topology snapshot [ver=11, servers=4, clients=1, CPUs=24, heap=7.6GB] Jul 21, 2016 3:35:23 PM com.juan.ignite.ClientIgnite main INFO: Size=0 Jul 21, 2016 3:35:25 PM com.juan.ignite.ClientIgnite main INFO: Size=0 -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-Transactions-and-non-committed-entries-tp6451.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.
