/** * @return Node ID. */ public UUID localNodeId() { return kernalCtx.localNodeId(); }
/** * @return Local node ID. */ public UUID nodeId() { return ctx.localNodeId(); }
/** {@inheritDoc} */ @Override public String toString() { return S.toString(ServiceDeploymentTask.class, this, "locNodeId", (ctx != null ? ctx.localNodeId() : "unknown"), "crdId", crdId); } }
@Override public void apply(IgniteInternalFuture fut) { if (forRead) lsnr.onResponse(activeQueries.assignQueryCounter(ctx.localNodeId(), 0L)); else lsnr.onResponse(assignTxSnapshot(0L, ctx.localNodeId(), false)); } });
/** * @param ctx Context. * @param cacheName Cache name. * @return Request to reset lost partitions. */ static DynamicCacheChangeRequest resetLostPartitions(GridKernalContext ctx, String cacheName) { DynamicCacheChangeRequest req = new DynamicCacheChangeRequest(UUID.randomUUID(), cacheName, ctx.localNodeId()); req.markResetLostPartitions(); return req; }
/** * * @param sb String builder. * @param ctx Context. */ static void dumpNodeBasicInfo(StringBuilder sb, GridKernalContext ctx) { sb.append("General node info [id=").append(ctx.localNodeId()) .append(", client=").append(ctx.clientNode()) .append(", discoTopVer=").append(ctx.discovery().topologyVersionEx()) .append(", time=").append(formatTime(U.currentTimeMillis())).append(']'); }
/** * @param req Request to complete future for. * @param success Future result. * @param err Error if any. */ void completeCacheStartFuture(DynamicCacheChangeRequest req, boolean success, @Nullable Throwable err) { if (ctx.localNodeId().equals(req.initiatingNodeId())) { DynamicCacheStartFuture fut = (DynamicCacheStartFuture)pendingFuts.get(req.requestId()); if (fut != null) fut.onDone(success, err); } }
/** {@inheritDoc} */ @Override public void dynamicDropColumn(String schemaName, String tblName, List<String> cols, boolean ifTblExists, boolean ifColExists) throws IgniteCheckedException { awaitIndexing(ctx.localNodeId()); super.dynamicDropColumn(schemaName, tblName, cols, ifTblExists, ifColExists); } }
/** {@inheritDoc} */ @Override public void dynamicIndexDrop(@NotNull String schemaName, String idxName, boolean ifExists) throws IgniteCheckedException{ awaitIndexing(ctx.localNodeId()); super.dynamicIndexDrop(schemaName, idxName, ifExists); } }
/** {@inheritDoc} */ @Override public MvccSnapshot requestReadSnapshotLocal() { if (!currentCoordinator().local() || !initFut.isDone()) return null; return activeQueries.assignQueryCounter(ctx.localNodeId(), 0L); }
/** * Constructor. * * @param ctx Context. */ public RunningQueryManager(GridKernalContext ctx) { localNodeId = ctx.localNodeId(); histSz = ctx.config().getSqlQueryHistorySize(); qryHistTracker = new QueryHistoryTracker(histSz); }
/** {@inheritDoc} */ @Override public void dynamicAddColumn(String schemaName, String tblName, List<QueryField> cols, boolean ifTblExists, boolean ifColNotExists) throws IgniteCheckedException { awaitIndexing(ctx.localNodeId()); super.dynamicAddColumn(schemaName, tblName, cols, ifTblExists, ifColNotExists); }
/** */ private static IgniteTxMvccVersionCheckedException unexpectedStateException(GridKernalContext ctx, byte state, long crd, long cntr, int opCntr, MvccSnapshot snapshot) { String msg = "Unexpected state: [state=" + state + ", rowVer=" + crd + ":" + cntr + ":" + opCntr; if (snapshot != null) msg += ", txVer=" + snapshot.coordinatorVersion() + ":" + snapshot.counter() + ":" + snapshot.operationCounter(); msg += ", localNodeId=" + ctx.localNodeId() + "]"; return new IgniteTxMvccVersionCheckedException(msg); }
/** * Handles case when all server nodes have left the grid. */ private void onAllServersLeft() { assert ctx.clientNode(); completeError(new ClusterTopologyServerNotFoundException("Failed to resolve coordinator to continue services " + "deployment process: [locId=" + ctx.localNodeId() + "client=" + ctx.clientNode() + "evt=" + evt + ']')); }
/** {@inheritDoc} */ @Override public MvccSnapshot requestWriteSnapshotLocal() { if (!currentCoordinator().local() || !initFut.isDone()) return null; return assignTxSnapshot(0L, ctx.localNodeId(), false); }
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext ctx) { if (log.isDebugEnabled()) log.debug("Activating data structure processor [nodeId=" + ctx.localNodeId() + " topVer=" + ctx.discovery().topologyVersionEx() + " ]"); initFailed = false; qryIdMap.clear(); ctx.event().addLocalEventListener(lsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); restoreStructuresState(ctx); onKernalStart0(); }
@Override public void apply(IgniteInternalFuture<Void> future) { try { if (node.isLocal()) h2.reduceQueryExecutor().onMessage(ctx.localNodeId(), msg); else ctx.io().sendToGridTopic(node, GridTopic.TOPIC_QUERY, msg, QUERY_POOL); } catch (Exception e) { U.error(log, e); } } });
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Activate service processor [nodeId=" + ctx.localNodeId() + " topVer=" + ctx.discovery().topologyVersionEx() + " ]"); busyLock = new GridSpinBusyLock(); depExe = Executors.newSingleThreadExecutor(new IgniteThreadFactory(ctx.igniteInstanceName(), "srvc-deploy", oomeHnd)); start(); onKernalStart0(); }
/** {@inheritDoc} */ @Override public void undeployTask(String taskName) { A.notNull(taskName, "taskName"); guard(); try { ctx.deploy().undeployTask(taskName, prj.node(ctx.localNodeId()) != null, prj.forRemotes().nodes()); } finally { unguard(); } }
/** {@inheritDoc} */ @Override public void onDeActivate(GridKernalContext kctx) { if (log.isDebugEnabled()) log.debug("DeActivate service processor [nodeId=" + ctx.localNodeId() + " topVer=" + ctx.discovery().topologyVersionEx() + " ]"); cancelFutures(depFuts, new IgniteCheckedException("Failed to deploy service, cluster in active.")); cancelFutures(undepFuts, new IgniteCheckedException("Failed to undeploy service, cluster in active.")); onKernalStop(true); }