/** * @return Data storage configuration. */ private DataStorageConfiguration dataStorageConfiguration() { return ctx.config().getDataStorageConfiguration(); }
/** * @return {@code true} if persistence is enabled for at least one data region, {@code false} if not. */ public static boolean isPersistenceEnabled(IgniteConfiguration cfg) { return isPersistenceEnabled(cfg.getDataStorageConfiguration()); }
/** * @return Collection of persistent cache descriptors. */ public Collection<DynamicCacheDescriptor> persistentCaches() { return cachesInfo.registeredCaches().values() .stream() .filter(desc -> isPersistentCache(desc.cacheConfiguration(), ctx.config().getDataStorageConfiguration())) .collect(Collectors.toList()); }
/** * */ private void ackMemoryConfiguration() { DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration(); if (memCfg == null) return; U.log(log, "System cache's DataRegion size is configured to " + (memCfg.getSystemRegionInitialSize() / (1024 * 1024)) + " MB. " + "Use DataStorageConfiguration.systemRegionInitialSize property to change the setting."); }
/** {@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); }
/** * @param cfg Config. */ private void validateConfiguration(IgniteConfiguration cfg) { if (cfg.getDataStorageConfiguration() != null) { validateDataRegion(cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration()); if (cfg.getDataStorageConfiguration().getDataRegionConfigurations() != null) { for (DataRegionConfiguration reg : cfg.getDataStorageConfiguration().getDataRegionConfigurations()) validateDataRegion(reg); } } }
/** * @param ctx Kernal context. */ public FilePageStoreManager(GridKernalContext ctx) { igniteCfg = ctx.config(); DataStorageConfiguration dsCfg = igniteCfg.getDataStorageConfiguration(); assert dsCfg != null; this.dsCfg = dsCfg; pageStoreV1FileIoFactory = pageStoreFileIoFactory = dsCfg.getFileIOFactory(); marshaller = MarshallerUtils.jdkMarshaller(ctx.igniteInstanceName()); }
/** * Constructor. * * @param ctx Context. */ public CheckpointHistory(GridKernalContext ctx) { cctx = ctx.cache().context(); log = ctx.log(getClass()); DataStorageConfiguration dsCfg = ctx.config().getDataStorageConfiguration(); maxCpHistMemSize = Math.min(dsCfg.getWalHistorySize(), IgniteSystemProperties.getInteger(IGNITE_PDS_MAX_CHECKPOINT_MEMORY_HISTORY_SIZE, 100)); isWalHistorySizeParameterEnabled = dsCfg.isWalHistorySizeParameterUsed(); }
/** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { if (cctx.kernalContext().clientNode() && cctx.kernalContext().config().getDataStorageConfiguration() == null) return; DataStorageConfiguration memCfg = cctx.kernalContext().config().getDataStorageConfiguration(); assert memCfg != null; validateConfiguration(memCfg); pageSize = memCfg.getPageSize(); initDataRegions(memCfg); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.getDataStorageConfiguration().setWalCompactionEnabled(true); return cfg; } }
/** */ private byte[] bigArray(IgniteEx grid) { int arrSz = grid.configuration().getDataStorageConfiguration().getPageSize() * 3; byte[] bigArr = new byte[arrSz]; for (int i=0; i<bigArr.length; i++) bigArr[i] = (byte)i; return bigArr; } }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.getDataStorageConfiguration().setWalCompactionEnabled(true); return cfg; } }
/** * 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 protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); DataStorageConfiguration dsCfg = cfg.getDataStorageConfiguration(); dsCfg.setCheckpointThreads(4).setCheckpointWriteOrder(CheckpointWriteOrder.SEQUENTIAL); return cfg; }
/** * 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()); } }
/** * 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); }
/** {@inheritDoc} */ @Override protected IgniteConfiguration commonConfiguration(int idx) throws Exception { IgniteConfiguration cfg = super.commonConfiguration(idx); cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration() .setMaxSize(300*1024L*1024L) .setPersistenceEnabled(true); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String name) throws Exception { IgniteConfiguration cfg = super.getConfiguration(name); DataStorageConfiguration memCfg = cfg.getDataStorageConfiguration(); memCfg.setDataRegionConfigurations(new DataRegionConfiguration() .setMaxSize(10L * 1024 * 1024) .setName(NO_PERSISTENCE_REGION) .setPersistenceEnabled(false)); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration(new DataStorageConfiguration()); cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setMaxSize(100 * 1024 * 1024); cfg.getDataStorageConfiguration().getDefaultDataRegionConfiguration().setPersistenceEnabled(true); cfg.setConnectorConfiguration(new ConnectorConfiguration()); cfg.getConnectorConfiguration().setSslEnabled(true); cfg.setSslContextFactory(createSslFactory()); return cfg; }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); setEvictionMode(DataPageEvictionMode.RANDOM_2_LRU, cfg); DataRegionConfiguration persReg = new DataRegionConfiguration() .setName("persisted") .setPersistenceEnabled(true) .setMaxSize(128L * 1024 * 1024); // limit memory to save space on agents cfg.getDataStorageConfiguration().setDataRegionConfigurations(persReg); return cfg; }