/** {@inheritDoc} */ @Override public UUID originatingNodeId() { return cctx.localNodeId(); }
/** {@inheritDoc} */ @Override public UUID eventNodeId() { return cctx.localNodeId(); }
/** {@inheritDoc} */ @Override protected UUID nearNodeId() { return cctx.localNodeId(); }
/** */ 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; }
/** * @param node Failed node. * @param mvccCrd Mvcc coordinator at time of node failure. */ private NodeFailureTimeoutObject(ClusterNode node, MvccCoordinator mvccCrd) { super(IgniteUuid.fromUuid(cctx.localNodeId()), TX_SALVAGE_TIMEOUT); this.node = node; this.mvccCrd = mvccCrd; }
/** {@inheritDoc} */ @Override public GridDhtPartitionMap localPartitionMap() { lock.readLock().lock(); try { return new GridDhtPartitionMap(cctx.localNodeId(), updateSeq.get(), topVer, GridPartitionStateMap.EMPTY, true); } finally { lock.readLock().unlock(); } }
/** * @return {@code true} if entered to busy state. */ private boolean enterBusy() { if (busyLock.readLock().tryLock()) return true; if (log.isDebugEnabled()) log.debug("Failed to enter to busy state (exchange manager is stopping): " + cctx.localNodeId()); return false; }
/** {@inheritDoc} */ @Override public boolean localResult() { assert originatingNodeId() != null; return cctx.localNodeId().equals(originatingNodeId()); }
/** * Gets subject ID by transaction. * * @param tx Transaction. * @return Subject ID. */ public static <K, V> UUID subjectId(IgniteInternalTx tx, GridCacheSharedContext<K, V> ctx) { if (tx == null) return ctx.localNodeId(); UUID subjId = tx.subjectId(); return subjId != null ? subjId : tx.originatingNodeId(); }
/** {@inheritDoc} */ @Override protected boolean updateNearCache(GridCacheContext cacheCtx, KeyCacheObject key, AffinityTopologyVersion topVer) { return cacheCtx.isDht() && isNearEnabled(cacheCtx) && !cctx.localNodeId().equals(nearNodeId()); }
/** {@inheritDoc} */ @Override protected boolean updateNearCache(GridCacheContext cacheCtx, KeyCacheObject key, AffinityTopologyVersion topVer) { if (!cacheCtx.isDht() || !isNearEnabled(cacheCtx) || cctx.localNodeId().equals(nearNodeId)) return false; if (cacheCtx.config().getBackups() == 0) return true; // Check if we are on the backup node. return !cacheCtx.affinity().backupsByKey(key, topVer).contains(cctx.localNode()); }
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Activated file write ahead log manager [nodeId=" + cctx.localNodeId() + " topVer=" + cctx.discovery().topologyVersionEx() + " ]"); //NOOP implementation, we need to override it. }
/** {@inheritDoc} */ @Override public boolean onDone(@Nullable IgniteInternalTx res, @Nullable Throwable err) { if (err != null) ERR_UPD.compareAndSet(GridNearPessimisticTxPrepareFuture.this, null, err); err = this.err; if ((!tx.onePhaseCommit() || tx.mappings().get(cctx.localNodeId()) == null) && (err == null || tx.needCheckBackup())) tx.state(PREPARED); if (super.onDone(tx, err)) { cctx.mvcc().removeVersionedFuture(this); return true; } return false; }
/** {@inheritDoc} */ @Override public void onDeActivate(GridKernalContext kctx) { if (log.isDebugEnabled()) log.debug("DeActivate file write ahead log [nodeId=" + cctx.localNodeId() + " topVer=" + cctx.discovery().topologyVersionEx() + " ]"); stop0(true); currHnd = null; }
/** * */ private void releaseFileLock() { if (cctx.kernalContext().clientNode() || fileLockHolder == null) return; if (log.isDebugEnabled()) log.debug("Release file lock [nodeId=" + cctx.localNodeId() + " path=" + fileLockHolder.lockPath() + "]"); fileLockHolder.close(); }
/** {@inheritDoc} */ @Override public void onDeActivate(GridKernalContext kctx) { if (log.isDebugEnabled()) log.debug("DeActivate page store manager [id=" + cctx.localNodeId() + " topVer=" + cctx.discovery().topologyVersionEx() + " ]"); stop0(true); }
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Activate page store manager [id=" + cctx.localNodeId() + " topVer=" + cctx.discovery().topologyVersionEx() + " ]"); start0(); }
/** {@inheritDoc} */ @Override public void onDeActivate(GridKernalContext kctx) { if (log.isDebugEnabled()) log.debug("DeActivate database manager [id=" + cctx.localNodeId() + " topVer=" + cctx.discovery().topologyVersionEx() + " ]"); onKernalStop0(false); super.onDeActivate(kctx); /* Must be here, because after deactivate we can invoke activate and file lock must be already configured */ stopping = false; }
@Override public void onEvent(Event evt) { assert evt.type() == EVT_NODE_METRICS_UPDATED; DiscoveryEvent discoEvt = (DiscoveryEvent)evt; ClusterNode node = cctx.discovery().node(discoEvt.node().id()); if (node != null && !node.id().equals(cctx.localNodeId())) onReceived(discoEvt.eventNode().id(), node.metrics().getLastDataVersion()); } };
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext ctx) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Activate database manager [id=" + cctx.localNodeId() + " topVer=" + cctx.discovery().topologyVersionEx() + " ]"); snapshotMgr = cctx.snapshot(); if (!cctx.kernalContext().clientNode() && checkpointer == null) checkpointer = new Checkpointer(cctx.igniteInstanceName(), "db-checkpoint-thread", log); super.onActivate(ctx); if (!cctx.kernalContext().clientNode()) { initializeCheckpointPool(); finishRecovery(); } }