/** * @throws StorageException If node is no longer valid and we missed a WAL operation. */ private void checkNode() throws StorageException { if (cctx.kernalContext().invalid()) throw new StorageException("Failed to perform WAL operation (environment was invalidated by a " + "previous error)"); }
/** * @return Cache context if group contains single cache. */ public GridCacheContext singleCacheContext() { List<GridCacheContext> caches = this.caches; assert !sharedGroup() && caches.size() == 1 : "stopping=" + ctx.kernalContext().isStopping() + ", groupName=" + ccfg.getGroupName() + ", caches=" + caches; return caches.get(0); }
/** * @return Deployment enabled flag. */ public boolean deploymentEnabled() { return kernalContext().deploy().enabled(); }
/** */ private DelayedDeadlockComputation(MvccVersion waiterVer, MvccVersion blockerVer, long timeout) { super(timeout); this.waiterVer = waiterVer; this.blockerVer = blockerVer; cctx.kernalContext().timeout().addTimeoutObject(this); }
/** {@inheritDoc} */ @Override public void onTimeout() { // Should not block timeout thread. cctx.kernalContext().closure().runLocalSafe(new Runnable() { @Override public void run() { onTimeout0(); } }); } }
/** {@inheritDoc} */ @Override protected void stop0(boolean cancel) { if (srv) cctx.kernalContext().io().removeMessageListener(TOPIC_WAL, ioLsnr); }
/** * @param gridName Grid name. * @param name Thread name. * @param log Logger. */ protected Checkpointer(@Nullable String gridName, String name, IgniteLogger log) { super(gridName, name, log, cctx.kernalContext().workersRegistry()); scheduledCp = new CheckpointProgress(U.currentTimeMillis() + checkpointFreq); tmpWriteBuf = ByteBuffer.allocateDirect(pageSize()); tmpWriteBuf.order(ByteOrder.nativeOrder()); }
/** {@inheritDoc} */ @Override public void onTimeout() { timedOut = true; IgniteLogger log = cctx.kernalContext().log(this.getClass()); U.warn(log, "Deadlock detection was timed out [timeout=" + DEADLOCK_TIMEOUT + ", fut=" + this + ']'); onDone(); }
/** * @param reconnectFut Reconnect future. * @return Client disconnected exception. */ private IgniteClientDisconnectedCheckedException disconnectedError(@Nullable IgniteFuture<?> reconnectFut) { if (reconnectFut == null) reconnectFut = cctx.kernalContext().cluster().clientReconnectFuture(); return new IgniteClientDisconnectedCheckedException(reconnectFut, "Operation has been cancelled (client node disconnected)."); }
/** * Gets next version for cache store load and reload operations. * * @return Next version for cache store operations. */ public GridCacheVersion nextForLoad() { return next(cctx.kernalContext().discovery().topologyVersion(), true, true, dataCenterId); }
/** {@inheritDoc} */ @Override public void notifyMetaStorageSubscribersOnReadyForRead() throws IgniteCheckedException { metastorageLifecycleLsnrs = cctx.kernalContext().internalSubscriptionProcessor().getMetastorageSubscribers(); readMetastore(); }
/** * @param log Logger. */ FileDecompressor(IgniteLogger log) { super(cctx.igniteInstanceName(), "wal-file-decompressor%" + cctx.igniteInstanceName(), log, cctx.kernalContext().workersRegistry()); }
/** * Creates cleanup worker. */ CleanupWorker() { super(cctx.igniteInstanceName(), "ttl-cleanup-worker", cctx.logger(GridCacheSharedTtlCleanupManager.class), cctx.kernalContext().workersRegistry()); }
/** * 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); }
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { super.start0(); cctx.kernalContext().event().addLocalEventListener(discoLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED); cachesRegistry = new CachesRegistry(cctx); }
/** {@inheritDoc} */ @Override public void readHeader(int grpId, int partId, ByteBuffer buf) throws IgniteCheckedException { PageStore store = getStore(grpId, partId); try { store.readHeader(buf); } catch (StorageException e) { cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }
/** {@inheritDoc} */ @Override public void sync(int grpId, int partId) throws IgniteCheckedException { try { getStore(grpId, partId).sync(); } catch (StorageException e) { cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }
/** {@inheritDoc} */ @Override public void ensure(int grpId, int partId) throws IgniteCheckedException { try { getStore(grpId, partId).ensure(); } catch (StorageException e) { cctx.kernalContext().failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw e; } }
/** * 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(); }
/** * 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); }