/** */ private boolean isInMemoryMode() { return !CU.isPersistenceEnabled(cfg); }
/** * Restores metadata on startup of {@link CacheObjectBinaryProcessorImpl} but before starting discovery. */ void restoreMetadata() { if (!CU.isPersistenceEnabled(ctx.config())) return; for (File file : workDir.listFiles()) { try (FileInputStream in = new FileInputStream(file)) { BinaryMetadata meta = U.unmarshal(ctx.config().getMarshaller(), in, U.resolveClassLoader(ctx.config())); metadataLocCache.put(meta.typeId(), new BinaryMetadataHolder(meta, 0, 0)); } catch (Exception e) { U.warn(log, "Failed to restore metadata from file: " + file.getName() + "; exception was thrown: " + e.getMessage()); } } }
/** {@inheritDoc} */ @Override public void onInitDataRegions(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException { // We have to always init txLog data region. DataStorageConfiguration dscfg = dataStorageConfiguration(); mgr.addDataRegion( dscfg, createTxLogRegion(dscfg), CU.isPersistenceEnabled(ctx.config())); }
/** * Is plugin enabled. */ private boolean isEnabled() { return (cfg != null && cfg.isEnabled() && CU.isPersistenceEnabled(ctx.igniteConfiguration())); }
/** {@inheritDoc} */ @Override public void start() throws IgniteCheckedException { inMemoryMode = !CU.isPersistenceEnabled(ctx.config()); // Start first node as inactive if persistence is enabled. boolean activeOnStart = inMemoryMode && ctx.config().isActiveOnStart(); globalState = DiscoveryDataClusterState.createState(activeOnStart, null); ctx.event().addLocalEventListener(lsr, EVT_NODE_LEFT, EVT_NODE_FAILED); }
/** * @param mgr Database shared manager. * @throws IgniteCheckedException If failed. */ private void txLogPageStoreInit(IgniteCacheDatabaseSharedManager mgr) throws IgniteCheckedException { assert CU.isPersistenceEnabled(ctx.config()); //noinspection ConstantConditions ctx.cache().context().pageStore().initialize(TX_LOG_CACHE_ID, 1, TX_LOG_CACHE_NAME, mgr.dataRegion(TX_LOG_CACHE_NAME).memoryMetrics()); }
/** * TODO IGNITE-7966 * * @return Data region configuration. */ private DataRegionConfiguration createTxLogRegion(DataStorageConfiguration dscfg) { DataRegionConfiguration cfg = new DataRegionConfiguration(); cfg.setName(TX_LOG_CACHE_NAME); cfg.setInitialSize(dscfg.getSystemRegionInitialSize()); cfg.setMaxSize(dscfg.getSystemRegionMaxSize()); cfg.setPersistenceEnabled(CU.isPersistenceEnabled(dscfg)); return cfg; }
/** * Checks whether local node participating in Baseline Topology and warn if not. */ private void checkLocalNodeInBaseline(BaselineTopology blt) { if (blt == null || blt.consistentIds() == null || ctx.clientNode() || ctx.isDaemon()) return; if (!CU.isPersistenceEnabled(ctx.config())) return; if (!blt.consistentIds().contains(ctx.discovery().localNode().consistentId())) { U.quietAndInfo(log, "Local node is not included in Baseline Topology and will not be used " + "for persistent data storage. Use control.(sh|bat) script or IgniteCluster interface to include " + "the node to Baseline Topology."); } }
/** * @param binMeta Binary metadata to be written to disk. */ void writeMetadata(BinaryMetadata binMeta) { if (!CU.isPersistenceEnabled(ctx.config())) return; try { File file = new File(workDir, binMeta.typeId() + ".bin"); byte[] marshalled = U.marshal(ctx, binMeta); try (final FileIO out = fileIOFactory.create(file)) { int left = marshalled.length; while ((left -= out.writeFully(marshalled, 0, Math.min(marshalled.length, left))) > 0) ; out.force(); } } catch (Exception e) { final String msg = "Failed to save metadata for typeId: " + binMeta.typeId() + "; exception was thrown: " + e.getMessage(); U.error(log, msg); ctx.failure().process(new FailureContext(FailureType.CRITICAL_ERROR, e)); throw new IgniteException(msg, e); } }
this.log = log; if (!CU.isPersistenceEnabled(ctx.config())) return;
/** * @param memCfg Database config. * @throws IgniteCheckedException If failed to initialize swap path. */ protected void initDataRegions0(DataStorageConfiguration memCfg) throws IgniteCheckedException { DataRegionConfiguration[] dataRegionCfgs = memCfg.getDataRegionConfigurations(); if (dataRegionCfgs != null) { for (DataRegionConfiguration dataRegionCfg : dataRegionCfgs) addDataRegion(memCfg, dataRegionCfg, dataRegionCfg.isPersistenceEnabled()); } addDataRegion( memCfg, memCfg.getDefaultDataRegionConfiguration(), memCfg.getDefaultDataRegionConfiguration().isPersistenceEnabled() ); addDataRegion( memCfg, createSystemDataRegion( memCfg.getSystemRegionInitialSize(), memCfg.getSystemRegionMaxSize(), CU.isPersistenceEnabled(memCfg) ), CU.isPersistenceEnabled(memCfg) ); for (DatabaseLifecycleListener lsnr : getDatabaseListeners(cctx.kernalContext())) lsnr.onInitDataRegions(this); }
if (!CU.isPersistenceEnabled(cfg)) return compatibleResolve(pstStoreBasePath, consistentId);
/** * @param ctx Context. * @param transport Transport. */ public void onMarshallerProcessorStarted( GridKernalContext ctx, MarshallerMappingTransport transport ) throws IgniteCheckedException { assert ctx != null; IgniteConfiguration cfg = ctx.config(); String workDir = U.workDirectory(cfg.getWorkDirectory(), cfg.getIgniteHome()); final IgniteLogger fileStoreLog = ctx.log(MarshallerMappingFileStore.class); fileStore = marshallerMappingFileStoreDir == null ? new MarshallerMappingFileStore(workDir, fileStoreLog) : new MarshallerMappingFileStore(fileStoreLog, marshallerMappingFileStoreDir); this.transport = transport; closProc = ctx.closure(); clientNode = ctx.clientNode(); if (CU.isPersistenceEnabled(ctx.config())) fileStore.restoreMappings(this); }
/** {@inheritDoc} */ @Override public void initExtensions(PluginContext ctx, ExtensionRegistry registry) { IgniteConfiguration igniteCfg = ctx.igniteConfiguration(); log = ctx.log(getClass()); if (igniteCfg.getPluginConfigurations() != null) { for (PluginConfiguration pluginCfg : igniteCfg.getPluginConfigurations()) { if (pluginCfg instanceof PageMemoryTrackerConfiguration) { PageMemoryTrackerConfiguration cfg = (PageMemoryTrackerConfiguration)pluginCfg; plugin = new PageMemoryTracker(ctx, cfg); if (cfg.isEnabled() && !CU.isPersistenceEnabled(igniteCfg)) { log.warning("Page memory tracker plugin enabled, " + "but there are no persistable data regions in configuration. Tracker will be disabled."); } return; } } } if (Boolean.getBoolean(IGNITE_ENABLE_PAGE_MEMORY_TRACKER) && CU.isPersistenceEnabled(igniteCfg)) { plugin = new PageMemoryTracker(ctx, new PageMemoryTrackerConfiguration() .setEnabled(true) .setCheckPagesOnCheckpoint(true) ); log.info("PageMemory tracking enabled by system property."); } else plugin = new PageMemoryTracker(ctx, null); }
if (CU.isPersistenceEnabled(ctx.config()) && ctx.cache().context().pageStore() != null) { Map<String, StoredCacheData> storedCaches = ctx.cache().context().pageStore().readCacheConfigurations();
if (activate && CU.isPersistenceEnabled(ctx.config())) { try { Map<String, StoredCacheData> cfgs = ctx.cache().context().pageStore().readCacheConfigurations();
IgniteWriteAheadLogManager walMgr = null; if (CU.isPersistenceEnabled(ctx.config()) && !ctx.clientNode()) { dbMgr = new GridCacheDatabaseSharedManager(ctx); if (CU.isPersistenceEnabled(ctx.config()) && ctx.clientNode()) { U.warn(log, "Persistent Store is not supported on client nodes (Persistent Store's" + " configuration will be ignored).");
/** {@inheritDoc} */ @SuppressWarnings({"unchecked"}) @Override public void start() throws IgniteCheckedException { ctx.internalSubscriptionProcessor().registerMetastorageListener(recovery); ctx.internalSubscriptionProcessor().registerDatabaseListener(recovery); cachesInfo = new ClusterCachesInfo(ctx); DeploymentMode depMode = ctx.config().getDeploymentMode(); if (!F.isEmpty(ctx.config().getCacheConfiguration())) { if (depMode != CONTINUOUS && depMode != SHARED) U.warn(log, "Deployment mode for cache is not CONTINUOUS or SHARED " + "(it is recommended that you change deployment mode and restart): " + depMode); } initializeInternalCacheNames(); Collection<CacheStoreSessionListener> sessionListeners = CU.startStoreSessionListeners(ctx, ctx.config().getCacheStoreSessionListenerFactories()); sharedCtx = createSharedContext(ctx, sessionListeners); transactions = new IgniteTransactionsImpl(sharedCtx, null); // Start shared managers. for (GridCacheSharedManager mgr : sharedCtx.managers()) mgr.start(sharedCtx); if (!ctx.isDaemon() && (!CU.isPersistenceEnabled(ctx.config())) || ctx.config().isClientMode()) restoreCacheConfigurations(); if (log.isDebugEnabled()) log.debug("Started cache processor."); ctx.state().cacheProcessorStarted(); ctx.authentication().cacheProcessorStarted(); }
if (CU.isPersistenceEnabled(ctx.config())) { mgr.checkpointReadLock();
if (CU.isPersistenceEnabled(kctx.config()) && !kctx.clientNode()) kctx.state().onBaselineTopologyChanged(req.baselineTopology(), req.prevBaselineTopologyHistoryItem());