/** */ private void neighborcastPartitionCountersAndRollback(IgniteInternalTx tx) { TxCounters txCounters = tx.txCounters(false); if (txCounters == null || txCounters.updateCounters() == null) tx.rollbackAsync(); PartitionCountersNeighborcastFuture fut = new PartitionCountersNeighborcastFuture(tx, cctx); fut.listen(fut0 -> tx.rollbackAsync()); fut.init(); }
/** {@inheritDoc} */ @Override public boolean onNodeLeft(UUID nodeId) { logNodeLeft(nodeId); // if a left node is one of remote peers then a mini future for it is completed successfully completeMini(nodeId); return true; }
/** */ private void completeMini(UUID nodeId) { for (IgniteInternalFuture<?> fut : futures()) { assert fut instanceof MiniFuture; MiniFuture mini = (MiniFuture)fut; if (mini.nodeId.equals(nodeId)) { cctx.kernalContext().closure().runLocalSafe(mini::onDone); break; } } }
/** * Starts processing. */ public void init() { if (log.isInfoEnabled()) { log.info("Starting delivery partition countres to remote nodes [txId=" + tx.nearXidVersion() + ", futId=" + futId); } HashSet<UUID> siblings = siblingBackups(); cctx.mvcc().addFuture(this, futId); for (UUID peer : siblings) { List<PartitionUpdateCountersMessage> cntrs = cctx.tm().txHandler() .filterUpdateCountersForBackupNode(tx, cctx.node(peer)); if (F.isEmpty(cntrs)) continue; MiniFuture miniFut = new MiniFuture(peer); try { cctx.io().send(peer, new PartitionCountersNeighborcastRequest(cntrs, futId), SYSTEM_POOL); add(miniFut); } catch (IgniteCheckedException e) { if (!(e instanceof ClusterTopologyCheckedException)) log.warning("Failed to send partition counters to remote node [node=" + peer + ']', e); else logNodeLeft(peer); miniFut.onDone(); } } markInitialized(); }
/** * Processes a response from a remote peer. Completes a mini future for that peer. * * @param nodeId Remote peer node id. */ public void onResult(UUID nodeId) { if (log.isInfoEnabled()) log.info("Remote peer acked partition counters delivery [futId=" + futId + ", node=" + nodeId + ']'); completeMini(nodeId); }
/** * @param nodeId Node id. * @param res Response. */ private void processPartitionCountersResponse(UUID nodeId, PartitionCountersNeighborcastResponse res) { PartitionCountersNeighborcastFuture fut = ((PartitionCountersNeighborcastFuture)ctx.mvcc().future(res.futId())); if (fut == null) { log.warning("Failed to find future for partition counters response [futId=" + res.futId() + ", node=" + nodeId + ']'); return; } fut.onResult(nodeId); }
/** * Starts processing. */ public void init() { if (log.isInfoEnabled()) { log.info("Starting delivery partition countres to remote nodes [txId=" + tx.nearXidVersion() + ", futId=" + futId); } HashSet<UUID> siblings = siblingBackups(); cctx.mvcc().addFuture(this, futId); for (UUID peer : siblings) { List<PartitionUpdateCountersMessage> cntrs = cctx.tm().txHandler() .filterUpdateCountersForBackupNode(tx, cctx.node(peer)); if (F.isEmpty(cntrs)) continue; MiniFuture miniFut = new MiniFuture(peer); try { cctx.io().send(peer, new PartitionCountersNeighborcastRequest(cntrs, futId), SYSTEM_POOL); add(miniFut); } catch (IgniteCheckedException e) { if (!(e instanceof ClusterTopologyCheckedException)) log.warning("Failed to send partition counters to remote node [node=" + peer + ']', e); else logNodeLeft(peer); miniFut.onDone(); } } markInitialized(); }
/** * Processes a response from a remote peer. Completes a mini future for that peer. * * @param nodeId Remote peer node id. */ public void onResult(UUID nodeId) { if (log.isInfoEnabled()) log.info("Remote peer acked partition counters delivery [futId=" + futId + ", node=" + nodeId + ']'); completeMini(nodeId); }
/** * @param nodeId Node id. * @param res Response. */ private void processPartitionCountersResponse(UUID nodeId, PartitionCountersNeighborcastResponse res) { PartitionCountersNeighborcastFuture fut = ((PartitionCountersNeighborcastFuture)ctx.mvcc().future(res.futId())); if (fut == null) { log.warning("Failed to find future for partition counters response [futId=" + res.futId() + ", node=" + nodeId + ']'); return; } fut.onResult(nodeId); }
/** */ private void neighborcastPartitionCountersAndRollback(IgniteInternalTx tx) { TxCounters txCounters = tx.txCounters(false); if (txCounters == null || txCounters.updateCounters() == null) tx.rollbackAsync(); PartitionCountersNeighborcastFuture fut = new PartitionCountersNeighborcastFuture(tx, cctx); fut.listen(fut0 -> tx.rollbackAsync()); fut.init(); }
/** {@inheritDoc} */ @Override public boolean onNodeLeft(UUID nodeId) { logNodeLeft(nodeId); // if a left node is one of remote peers then a mini future for it is completed successfully completeMini(nodeId); return true; }
/** */ private void completeMini(UUID nodeId) { for (IgniteInternalFuture<?> fut : futures()) { assert fut instanceof MiniFuture; MiniFuture mini = (MiniFuture)fut; if (mini.nodeId.equals(nodeId)) { cctx.kernalContext().closure().runLocalSafe(mini::onDone); break; } } }