/** * @return {@code True} if need locally start all existing caches on client node start. */ private boolean startAllCachesOnClientStart() { return startClientCaches && ctx.clientNode(); }
/** * Callback for cache group start event. * @param grpId Group id. * @param encKey Encryption key */ public void beforeCacheGroupStart(int grpId, @Nullable byte[] encKey) { if (encKey == null || ctx.clientNode()) return; groupKey(grpId, encKey); }
/** * @return {@code True} if rest processor should not start on client node. */ private boolean notStartOnClient() { return ctx.clientNode() && !IgniteSystemProperties.getBoolean(IGNITE_REST_START_ON_CLIENT); }
/** {@inheritDoc} */ @Override public void onReadyForRead(ReadOnlyMetastorage metastorage) throws IgniteCheckedException { if (!ctx.clientNode()) { users = new ConcurrentHashMap<>(); metastorage.iterate(STORE_USER_PREFIX, (key, val) -> { User u = (User)val; users.put(u.name(), u); }, true); } else users = null; }
/** * 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 + ']')); }
/** * * @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(']'); }
/** {@inheritDoc} */ @Override public void resumeLogging() { if (!mmap) walWriter.restart(); if (cctx.kernalContext().clientNode()) return; if (walSegmentSyncWorker != null) walSegmentSyncWorker.restart(); }
/** * @param crd Coordinator flag. * @return Exchange type. */ private ExchangeType onCustomMessageNoAffinityChange(boolean crd) { if (!forceAffReassignment) cctx.affinity().onCustomMessageNoAffinityChange(this, crd, exchActions); return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL; }
/** * Finishes MVCC transaction. * @param tx Transaction. */ public void mvccFinish(IgniteTxAdapter tx) { if (cctx.kernalContext().clientNode() || tx.mvccSnapshot == null || !tx.local()) return; cctx.coordinators().releaseWaiters(tx.mvccSnapshot); }
/** * @param ctx Context. * @throws IgniteCheckedException If failed. */ public void onContinuousProcessorStarted(GridKernalContext ctx) throws IgniteCheckedException { if (ctx.clientNode()) { assert !ctx.isDaemon(); ctx.continuous().registerStaticRoutine( CU.UTILITY_CACHE_NAME, new ServiceEntriesListener(), null, null ); } }
/** {@inheritDoc} */ @Override public void onCustomEvent(AffinityTopologyVersion topVer, ClusterNode snd, final UserProposedMessage msg) { if (!isEnabled || ctx.isStopping() || ctx.clientNode()) return; if (log.isDebugEnabled()) log.debug(msg.toString()); submitOperation(msg.operation()); } }
/** {@inheritDoc} */ @Override public boolean initCacheContext(GridCacheContext ctx) throws IgniteCheckedException { if (FAILED_CACHES.contains(ctx.name()) && ctx.kernalContext().clientNode()) throw new IgniteCheckedException("Test query exception " + ctx.name() + " " + new Random().nextInt()); return true; } }
/** * Checks whether given cache configuration should be persisted. * * @param cacheCfg Cache config. * @return {@code True} if cache configuration should be persisted, {@code false} in other case. */ private boolean shouldPersist(CacheConfiguration<?, ?> cacheCfg) { return cctx.pageStore() != null && CU.isPersistentCache(cacheCfg, cctx.gridConfig().getDataStorageConfiguration()) && !cctx.kernalContext().clientNode(); }
/** {@inheritDoc} */ @Override public void registerCache(String cacheName, String schemaName, GridCacheContextInfo<?, ?> cacheInfo) throws IgniteCheckedException { if (FAILED_CACHES.contains(cacheInfo.name()) && cacheInfo.cacheContext().kernalContext().clientNode()) throw new IgniteCheckedException("Test query exception " + cacheInfo.name() + " " + new Random().nextInt()); }
/** {@inheritDoc} */ @Override protected IgniteEx queryNode() { IgniteEx node = grid(2); assertTrue(node.context().clientNode()); return node; }
/** {@inheritDoc} */ @Override public void ensureStarted() throws IgniteCheckedException { if (!ctx.clientNode()) { assert mvccEnabled && mvccSupported; if (txLog == null) txLog = new TxLog(ctx, ctx.cache().context().database()); startVacuumWorkers(); if (log.isInfoEnabled()) log.info("Mvcc processor started."); } }
/** {@inheritDoc} */ @Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException { if (kctx.clientNode() && kctx.config().getDataStorageConfiguration() == null) return; initAndStartRegions(kctx.config().getDataStorageConfiguration()); for (DatabaseLifecycleListener lsnr : getDatabaseListeners(kctx)) lsnr.afterInitialise(this); }
/** * Remove all persistent files for all registered caches. */ public void cleanupCachesDirectories() throws IgniteCheckedException { if (sharedCtx.pageStore() == null || sharedCtx.kernalContext().clientNode()) return; for (DynamicCacheDescriptor desc : cacheDescriptors().values()) { if (isPersistentCache(desc.cacheConfiguration(), sharedCtx.gridConfig().getDataStorageConfiguration())) sharedCtx.pageStore().cleanupPersistentSpace(desc.cacheConfiguration()); } }
/** * @return Ignite instance for quering. */ protected IgniteEx queryNode() { IgniteEx node = grid(0); assertFalse(node.context().clientNode()); return node; }
/** * Save cache configuration to persistent store if necessary. * * @param desc Cache descriptor. */ public void saveCacheConfiguration(DynamicCacheDescriptor desc) throws IgniteCheckedException { assert desc != null; if (sharedCtx.pageStore() != null && !sharedCtx.kernalContext().clientNode() && isPersistentCache(desc.cacheConfiguration(), sharedCtx.gridConfig().getDataStorageConfiguration())) sharedCtx.pageStore().storeCacheData(desc.toStoredData(), true); }