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 Fri, 27 Sep 2019 13:37:13 GMT
dgarus commented on a change in pull request #6896: IGNITE-12209: Transactions system view.
URL: https://github.com/apache/ignite/pull/6896#discussion_r329040350
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/metric/JmxExporterSpiTest.java
 ##########
 @@ -427,6 +438,80 @@ public void testHistogramExport() throws Exception {
         assertEquals(3L, bean.getAttribute("histogram_500_inf"));
     }
 
+    /** */
+    @Test
+    public void testTransactions() throws Exception {
+        IgniteCache<Integer, Integer> cache = ignite.createCache(new CacheConfiguration<Integer,
Integer>("c")
+            .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
+
+        assertEquals(0, systemView(TXS_MON_LIST).size());
+
+        CountDownLatch latch = new CountDownLatch(1);
+
+        try {
+            AtomicInteger cntr = new AtomicInteger();
+
+            GridTestUtils.runMultiThreadedAsync(() -> {
+                try (Transaction tx = ignite.transactions().withLabel("test").txStart(PESSIMISTIC,
REPEATABLE_READ)) {
+                    cache.put(cntr.incrementAndGet(), cntr.incrementAndGet());
+                    cache.put(cntr.incrementAndGet(), cntr.incrementAndGet());
+
+                    latch.await();
+                }
+                catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }, 5, "xxx");
+
+            boolean res = waitForCondition(() -> systemView(TXS_MON_LIST).size() == 5,
5_000L);
+
+            assertTrue(res);
+
+            CompositeData txv = systemView(TXS_MON_LIST).get(new Object[] {0});
+
+            assertEquals(ignite.localNode().id().toString(), txv.get("nodeId"));
+            assertEquals(REPEATABLE_READ.name(), txv.get("isolation"));
+            assertEquals(PESSIMISTIC.name(), txv.get("concurrency"));
+            assertEquals(ACTIVE.name(), txv.get("state"));
+            assertNotNull(txv.get("xid"));
+            assertFalse((boolean)txv.get("system"));
+            assertFalse((boolean)txv.get("implicit"));
+            assertFalse((boolean)txv.get("implicitSingle"));
+            assertTrue((boolean)txv.get("near"));
+            assertFalse((boolean)txv.get("dht"));
+            assertTrue((boolean)txv.get("colocated"));
+            assertTrue((boolean)txv.get("local"));
+            assertEquals("test", txv.get("label"));
+            assertFalse((boolean)txv.get("onePhaseCommit"));
+            assertFalse((boolean)txv.get("internal"));
+            assertEquals(0L, txv.get("timeout"));
+            assertTrue(((long)txv.get("startTime")) <= System.currentTimeMillis());
+
+            GridTestUtils.runMultiThreadedAsync(() -> {
+                try (Transaction tx = ignite.transactions().txStart(OPTIMISTIC, SERIALIZABLE))
{
+                    cache.put(cntr.incrementAndGet(), cntr.incrementAndGet());
+                    cache.put(cntr.incrementAndGet(), cntr.incrementAndGet());
+
+                    latch.await();
+                }
+                catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+            }, 5, "xxx");
+
 
 Review comment:
   no checks that additional CompositeData contains correct values

----------------------------------------------------------------
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