Skip to content

Commit d1074ed

Browse files
committed
fix after review
1 parent b2394d2 commit d1074ed

File tree

6 files changed

+31
-24
lines changed

6 files changed

+31
-24
lines changed

modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import org.junit.runners.Parameterized;
5656

5757
import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
58-
import static org.apache.ignite.cache.CacheMode.PARTITIONED;
5958
import static org.apache.ignite.cache.CacheMode.REPLICATED;
6059

6160
/** Check per node data consistency after exceptionally interceptor method call. */
@@ -343,14 +342,12 @@ public void testTxWithExceptionInterceptor() throws Exception {
343342
assertTrue(grids.get(0).name().contains(CLIENT_NAME));
344343

345344
for (Ignite node : grids) {
346-
if (!writeThrough && txCoord == TxCoordNodeRole.PRIMARY) {
347-
getSqlResultByKey(node, processedCacheName, primaryKey, true);
348-
getKVResultByKey(node, processedCacheName, primaryKey, true);
349-
350-
continue;
351-
}
352-
353345
if (txCoord == TxCoordNodeRole.PRIMARY) {
346+
if (!writeThrough) {
347+
getSqlResultByKey(node, processedCacheName, primaryKey, true);
348+
getKVResultByKey(node, processedCacheName, primaryKey, true);
349+
}
350+
354351
getSqlResultByKey(node, commonCacheName, primaryKey, true);
355352
getKVResultByKey(node, commonCacheName, primaryKey, true);
356353

@@ -440,8 +437,8 @@ private Integer getSqlResultByKey(Ignite node, String cacheName, Integer key, bo
440437
cacheName + " WHERE id = ?").setArgs(key)).getAll();
441438

442439
if (checkResIsEmpty) {
443-
assertTrue(resCalcite.isEmpty());
444-
assertTrue(resIdx.isEmpty());
440+
assertTrue("Expect empty result", resCalcite.isEmpty());
441+
assertTrue("Expect empty result", resIdx.isEmpty());
445442

446443
return null;
447444
}

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,7 @@ protected void sessionEnd(final Collection<CacheStoreManager> stores, boolean co
13871387
* @param writeEntries Transaction write set.
13881388
* @throws IgniteCheckedException If batch update failed.
13891389
*/
1390-
protected final void batchStoreCommit(Iterable<IgniteTxEntry> writeEntries)
1391-
throws IgniteCheckedException
1392-
{
1390+
protected final void batchStoreCommit(Iterable<IgniteTxEntry> writeEntries) throws IgniteCheckedException {
13931391
if (!storeEnabled() || internal() ||
13941392
(!local() && near())) // No need to work with local store at GridNearTxRemote.
13951393
return;

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,8 +1351,6 @@ private void processDhtTxFinishRequest(final UUID nodeId, final GridDhtTxFinishR
13511351
assert nodeId != null;
13521352
assert req != null;
13531353

1354-
System.err.println("!!! processDhtTxFinishRequest " + req.checkCommitted());
1355-
13561354
if (req.checkCommitted()) {
13571355
boolean committed = req.waitRemoteTransactions() || !ctx.tm().addRolledbackTx(null, req.version());
13581356

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,6 @@ private void salvageTx(IgniteInternalTx tx, IgniteInternalTx.FinalizationStatus
607607
return;
608608
}
609609

610-
System.err.println("!!!salvage");
611-
612610
tx.salvageTx();
613611

614612
if (log.isInfoEnabled())

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public class IgniteTxStateImpl extends IgniteTxLocalStateAdapter {
7474
@GridToStringInclude
7575
private Boolean recovery;
7676

77-
/** */
77+
/** Cached flag, {@code True} if {@link CacheStoreManager#isWriteThrough()} enabled for all caches involved. */
7878
@GridToStringInclude
7979
private Boolean storeWriteThrough;
8080

modules/core/src/test/java/org/apache/ignite/cache/store/CacheStoreWithIgniteTxFailureTest.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,21 +186,37 @@ public void testSystemExceptionAfterCacheStoreCommit() throws Exception {
186186
if (faultyNodeRole != FaultyNodeRole.TX_COORDINATOR) {
187187
waitForTopology(3);
188188

189-
assertTrue("Client node should survive test scenario",
190-
G.allGrids()
191-
.stream()
192-
.filter(ignite -> ((IgniteEx)ignite).context().clientNode())
193-
.count() == 1);
189+
checkClientIsAvailable();
194190
}
195-
else
191+
else {
196192
waitForTopology(2);
193+
194+
checkFultyNode(FAULTY_NODE_IDX);
195+
}
197196
}
198197
else
199198
checkKeysOnFaultyNode(keysOnFaultyNode);
200199

201200
checkKeysOnHealthyNodes(keysOnFaultyNode);
202201
}
203202

203+
/** Check client node availability. */
204+
private void checkClientIsAvailable() {
205+
assertTrue("Client node should survive test scenario",
206+
G.allGrids()
207+
.stream()
208+
.filter(ignite -> ((IgniteEx)ignite).context().clientNode())
209+
.count() == 1);
210+
}
211+
212+
/** Check that faulty node is absent in current topology. */
213+
private void checkFultyNode(int faultyNodeIdx) {
214+
assertTrue("Faulty node should survive test scenario, idx=" + faultyNodeIdx,
215+
G.allGrids()
216+
.stream()
217+
.noneMatch(ignite -> ignite.name().equals(getTestIgniteInstanceName(faultyNodeIdx))));
218+
}
219+
204220
/** */
205221
private void fillCache(IgniteCache<Integer, Integer> cache, int numOfKeys) {
206222
for (int i = 0; i < numOfKeys; i++)

0 commit comments

Comments
 (0)