From 7fc0358242f5386f7ca0941a26500222844f19f9 Mon Sep 17 00:00:00 2001 From: zstan Date: Wed, 20 May 2026 16:23:45 +0300 Subject: [PATCH 1/2] IGNITE-28706 Fix TxWithExceptionalInterceptorTest.testTxWithExceptionInterceptor fails --- .../tx/TxWithExceptionalInterceptorTest.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java index 2c824f64fa928..0823cce3c0589 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java @@ -34,6 +34,7 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.cluster.ClusterState; +import org.apache.ignite.cluster.ClusterTopologyException; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; @@ -43,7 +44,9 @@ import org.apache.ignite.internal.processors.cache.CacheLazyEntry; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.MapCacheStoreStrategy; +import org.apache.ignite.internal.processors.query.IgniteSQLException; import org.apache.ignite.internal.util.typedef.G; +import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.GridTestUtils; @@ -363,8 +366,19 @@ public void testTxWithExceptionInterceptor() throws Exception { continue; } + Object sqlVal; + // obtain sql results first, kv api can eventually recover results, thus for more clear test - let`s check sql first - Object sqlVal = getSqlResultByKey(node, PROC_CACHE_NAME, primaryKey, false); + try { + sqlVal = getSqlResultByKey(node, PROC_CACHE_NAME, primaryKey, false); + } + catch (IgniteSQLException ex) { + assertTrue(X.hasCause(ex, ClusterTopologyException.class)); + // Topology can change but affinity change is still in progress, thus sql operations can be mapped erroneously + awaitPartitionMapExchange(); + + sqlVal = getSqlResultByKey(node, PROC_CACHE_NAME, primaryKey, false); + } if (kvVal == null) kvVal = getKVResultByKey(grid(1), PROC_CACHE_NAME, primaryKey, false); From f12965d4f4a0008a5344d54f8fc2c8f652fa9fd3 Mon Sep 17 00:00:00 2001 From: zstan Date: Thu, 21 May 2026 12:17:36 +0300 Subject: [PATCH 2/2] fix aftre review --- .../tx/TxWithExceptionalInterceptorTest.java | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java index 0823cce3c0589..c26425ec90661 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java @@ -34,7 +34,6 @@ import org.apache.ignite.calcite.CalciteQueryEngineConfiguration; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.cluster.ClusterState; -import org.apache.ignite.cluster.ClusterTopologyException; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.DataRegionConfiguration; import org.apache.ignite.configuration.DataStorageConfiguration; @@ -44,9 +43,7 @@ import org.apache.ignite.internal.processors.cache.CacheLazyEntry; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.MapCacheStoreStrategy; -import org.apache.ignite.internal.processors.query.IgniteSQLException; import org.apache.ignite.internal.util.typedef.G; -import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgnitePredicate; import org.apache.ignite.testframework.GridTestUtils; @@ -308,7 +305,7 @@ public void testTxWithExceptionInterceptor() throws Exception { IgniteCache commonCache = txNode.cache(COMMON_CACHE_NAME); Integer primaryKey = primaryKeyCoordAware(PROC_CACHE_NAME); - Integer primaryKeyCommon = primaryKeyCoordAware(PROC_CACHE_NAME); + Integer primaryKeyCommon = primaryKeyCoordAware(COMMON_CACHE_NAME); try (Transaction tx = txNode.transactions().txStart()) { processedCache.put(primaryKey, 1); @@ -328,18 +325,22 @@ public void testTxWithExceptionInterceptor() throws Exception { // 2 server nodes + 1 thick client if ((txCoord == TxCoordNodeRole.BACKUP || txCoord == TxCoordNodeRole.PRIMARY) || - !writeThrough && txCoord == TxCoordNodeRole.THICK_CLIENT) + !writeThrough && txCoord == TxCoordNodeRole.THICK_CLIENT) { waitForTopology(3); + // Topology can change but affinity change is still in progress, thus sql operations can be mapped erroneously. + awaitPartitionMapExchange(); + } + checkExceptionRaised(); - // external storage stored result + // External storage stored result. Object storeVal = null; if (writeThrough) storeVal = strategy.getFromStore(primaryKey); - // Processed cache kv result + // Processed cache kv result. Object kvVal = null; List grids = new ArrayList<>(G.allGrids()); @@ -350,7 +351,7 @@ public void testTxWithExceptionInterceptor() throws Exception { } }); - // client first + // Client first. assertTrue(grids.get(0).name().contains(CLIENT_NAME)); for (Ignite node : grids) { @@ -366,19 +367,8 @@ public void testTxWithExceptionInterceptor() throws Exception { continue; } - Object sqlVal; - - // obtain sql results first, kv api can eventually recover results, thus for more clear test - let`s check sql first - try { - sqlVal = getSqlResultByKey(node, PROC_CACHE_NAME, primaryKey, false); - } - catch (IgniteSQLException ex) { - assertTrue(X.hasCause(ex, ClusterTopologyException.class)); - // Topology can change but affinity change is still in progress, thus sql operations can be mapped erroneously - awaitPartitionMapExchange(); - - sqlVal = getSqlResultByKey(node, PROC_CACHE_NAME, primaryKey, false); - } + // Obtain sql results first, kv api can eventually recover results, thus for more clear test - let`s check sql first. + Object sqlVal = getSqlResultByKey(node, PROC_CACHE_NAME, primaryKey, false); if (kvVal == null) kvVal = getKVResultByKey(grid(1), PROC_CACHE_NAME, primaryKey, false);