/** */ private HashSet<UUID> siblingBackups() { Map<UUID, Collection<UUID>> txNodes = tx.transactionNodes(); assert txNodes != null; UUID locNodeId = cctx.localNodeId(); HashSet<UUID> siblings = new HashSet<>(); txNodes.values().stream() .filter(backups -> backups.contains(locNodeId)) .forEach(siblings::addAll); siblings.remove(locNodeId); return siblings; }
for (Map.Entry<UUID, Collection<UUID>> e : tx.transactionNodes().entrySet()) { if (!locNodeId.equals(e.getKey()) && !failedNodeIds.contains(e.getKey()) && !nodes.containsKey(e.getKey())) { ClusterNode node = cctx.discovery().node(e.getKey());
/** * Commits transaction in case when node started transaction failed, but all related * transactions were prepared (invalidates transaction if it is not fully prepared). * * @param tx Transaction. * @param failedNodeIds Failed nodes IDs. */ public void commitIfPrepared(IgniteInternalTx tx, Set<UUID> failedNodeIds) { assert tx instanceof GridDhtTxLocal || tx instanceof GridDhtTxRemote : tx; assert !F.isEmpty(tx.transactionNodes()) : tx; assert tx.nearXidVersion() != null : tx; GridCacheTxRecoveryFuture fut = new GridCacheTxRecoveryFuture( cctx, tx, failedNodeIds, tx.transactionNodes()); cctx.mvcc().addFuture(fut, fut.futureId()); if (log.isInfoEnabled()) log.info("Checking optimistic transaction state on remote nodes [tx=" + tx + ", fut=" + fut + ']'); fut.prepare(); }
/** */ private void checkScenario(IgniteEx ign, int srvCnt, ImmutableMap<UUID, Set<UUID>> txNodes, Runnable r) throws Exception { try (Transaction userTx = ign.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { r.run(); GridNearTxLocal nearTx = ((TransactionProxyImpl)userTx).tx(); nearTx.prepareNearTxLocal().get(); List<IgniteInternalTx> txs = IntStream.range(0, srvCnt) .mapToObj(i -> txsOnNode(grid(i), nearTx.nearXidVersion())) .flatMap(Collection::stream) .collect(Collectors.toList()); assertFalse(txs.isEmpty()); txs.forEach(tx -> assertEquals(txNodes, repack(tx.transactionNodes()))); } }
/** */ private HashSet<UUID> siblingBackups() { Map<UUID, Collection<UUID>> txNodes = tx.transactionNodes(); assert txNodes != null; UUID locNodeId = cctx.localNodeId(); HashSet<UUID> siblings = new HashSet<>(); txNodes.values().stream() .filter(backups -> backups.contains(locNodeId)) .forEach(siblings::addAll); siblings.remove(locNodeId); return siblings; }
for (Map.Entry<UUID, Collection<UUID>> e : tx.transactionNodes().entrySet()) { if (!locNodeId.equals(e.getKey()) && !failedNodeIds.contains(e.getKey()) && !nodes.containsKey(e.getKey())) { ClusterNode node = cctx.discovery().node(e.getKey());
/** * Commits transaction in case when node started transaction failed, but all related * transactions were prepared (invalidates transaction if it is not fully prepared). * * @param tx Transaction. * @param failedNodeIds Failed nodes IDs. */ public void commitIfPrepared(IgniteInternalTx tx, Set<UUID> failedNodeIds) { assert tx instanceof GridDhtTxLocal || tx instanceof GridDhtTxRemote : tx; assert !F.isEmpty(tx.transactionNodes()) : tx; assert tx.nearXidVersion() != null : tx; GridCacheTxRecoveryFuture fut = new GridCacheTxRecoveryFuture( cctx, tx, failedNodeIds, tx.transactionNodes()); cctx.mvcc().addFuture(fut, fut.futureId()); if (log.isInfoEnabled()) log.info("Checking optimistic transaction state on remote nodes [tx=" + tx + ", fut=" + fut + ']'); fut.prepare(); }