ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] dgarus commented on a change in pull request #6896: IGNITE-12209: Transactions system view.
Date Sun, 29 Sep 2019 10:18:12 GMT
dgarus commented on a change in pull request #6896: IGNITE-12209: Transactions system view.
URL: https://github.com/apache/ignite/pull/6896#discussion_r329347510
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##########
 @@ -450,6 +464,121 @@ public void testClientsConnections() throws Exception {
         return F.iterator(conns.iterator(), identity(), true, v -> "JDBC".equals(v.type()));
     }
 
+    /** */
+    @Test
+    public void testTransactions() throws Exception {
+        try(IgniteEx g = startGrid(0)) {
+            IgniteCache<Integer, Integer> cache1 = g.createCache(new CacheConfiguration<Integer,
Integer>("c1")
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
+
+            IgniteCache<Integer, Integer> cache2 = g.createCache(new CacheConfiguration<Integer,
Integer>("c2")
+                .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
+
+            SystemView<TransactionView> txs = g.context().systemView().view(TXS_MON_LIST);
+
+            assertEquals(0, F.size(txs.iterator(), alwaysTrue()));
+
+            CountDownLatch latch = new CountDownLatch(1);
+
+            try {
+                AtomicInteger cntr = new AtomicInteger();
+
+                GridTestUtils.runMultiThreadedAsync(() -> {
+                    try(Transaction tx = g.transactions().withLabel("test").txStart(PESSIMISTIC,
REPEATABLE_READ)) {
+                        cache1.put(cntr.incrementAndGet(), cntr.incrementAndGet());
+                        cache1.put(cntr.incrementAndGet(), cntr.incrementAndGet());
+
+                        latch.await();
+                    }
+                    catch (InterruptedException e) {
+                        throw new RuntimeException(e);
+                    }
+                }, 5, "xxx");
+
+                boolean res = waitForCondition(() -> txs.size() == 5, 5_000L);
+
+                assertTrue(res);
+
+                {
 
 Review comment:
   Why do we need that as a separate block of code?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message