use of org.apache.ignite.internal.managers.systemview.walker.TransactionViewWalker in project ignite by apache.
the class IgniteTxManager method start0.
/**
* {@inheritDoc}
*/
@Override
protected void start0() throws IgniteCheckedException {
txHnd = new IgniteTxHandler(cctx);
deferredAckMsgSnd = new GridDeferredAckMessageSender<GridCacheVersion>(cctx.time(), cctx.kernalContext().closure()) {
@Override
public int getTimeout() {
return DEFERRED_ONE_PHASE_COMMIT_ACK_REQUEST_TIMEOUT;
}
@Override
public int getBufferSize() {
return DEFERRED_ONE_PHASE_COMMIT_ACK_REQUEST_BUFFER_SIZE;
}
@Override
public void finish(UUID nodeId, Collection<GridCacheVersion> vers) {
GridDhtTxOnePhaseCommitAckRequest ackReq = new GridDhtTxOnePhaseCommitAckRequest(vers);
cctx.kernalContext().gateway().readLock();
try {
cctx.io().send(nodeId, ackReq, GridIoPolicy.SYSTEM_POOL);
} catch (ClusterTopologyCheckedException ignored) {
if (log.isDebugEnabled())
log.debug("Failed to send one phase commit ack to backup node because it left grid: " + nodeId);
} catch (IgniteCheckedException e) {
log.error("Failed to send one phase commit ack to backup node [backup=" + nodeId + ']', e);
} finally {
cctx.kernalContext().gateway().readUnlock();
}
}
};
cctx.gridEvents().addDiscoveryEventListener(new TransactionRecoveryListener(), EVT_NODE_FAILED, EVT_NODE_LEFT);
cctx.gridEvents().addDiscoveryEventListener(new DiscoveryEventListener() {
@Override
public void onEvent(DiscoveryEvent evt, DiscoCache discoCache) {
if (evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT) {
UUID nodeId = evt.eventNode().id();
for (TxDeadlockFuture fut : deadlockDetectFuts.values()) fut.onNodeLeft(nodeId);
for (Map.Entry<GridCacheVersion, Object> entry : completedVersHashMap.entrySet()) {
Object obj = entry.getValue();
if (obj instanceof GridCacheReturnCompletableWrapper && nodeId.equals(((GridCacheReturnCompletableWrapper) obj).nodeId()))
removeTxReturn(entry.getKey());
}
}
suspendResumeForPessimisticSupported = IgniteFeatures.allNodesSupports(cctx.discovery().remoteNodes(), IgniteFeatures.SUSPEND_RESUME_PESSIMISTIC_TX);
}
}, EVT_NODE_FAILED, EVT_NODE_LEFT, EVT_NODE_JOINED);
this.txDeadlockDetection = new TxDeadlockDetection(cctx);
cctx.gridIO().addMessageListener(TOPIC_TX, new DeadlockDetectionListener());
cctx.txMetrics().onTxManagerStarted();
keyCollisionsInfo = new KeyCollisionsHolder();
distributedTransactionConfiguration = new DistributedTransactionConfiguration(cctx.kernalContext(), log, (String name, Long oldVal, Long newVal) -> {
if (!Objects.equals(oldVal, newVal)) {
scheduleDumpTask(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, () -> cctx.kernalContext().closure().runLocalSafe(() -> cctx.kernalContext().cache().context().exchange().dumpLongRunningOperations(newVal)), newVal);
}
}, (String name, Integer oldVal, Integer newVal) -> {
if (!Objects.equals(oldVal, newVal)) {
scheduleDumpTask(IGNITE_DUMP_TX_COLLISIONS_INTERVAL, this::collectTxCollisionsInfo, newVal);
}
});
cctx.kernalContext().systemView().registerView(TXS_MON_LIST, TXS_MON_LIST_DESC, new TransactionViewWalker(), new ReadOnlyCollectionView2X<>(idMap.values(), nearIdMap.values()), TransactionView::new);
}
Aggregations