/** * @param plcCfg Policy config. * * @return {@code True} if policy supports memory reuse. */ public boolean supportsMemoryReuse(DataRegionConfiguration plcCfg) { return reuseMemory && plcCfg.getSwapPath() == null; }
/** {@inheritDoc} */ @Override public String getSwapPath() { return dataRegCfg.getSwapPath(); }
/** * @param regCfg DataRegionConfiguration to validate. * @throws IgniteCheckedException If config is invalid. */ private void checkRegionMemoryStorageType(DataRegionConfiguration regCfg) throws IgniteCheckedException { if (regCfg.isPersistenceEnabled() && regCfg.getSwapPath() != null) throw new IgniteCheckedException("DataRegionConfiguration must not have both persistence " + "storage and swap space enabled at the same time (Use DataRegionConfiguration.setSwapPath(null) " + "to disable the swap space usage or DataRegionConfiguration.setPersistenceEnabled(false) " + "to disable the persistence) [name=" + regCfg.getName() + ", swapPath=" + regCfg.getSwapPath() + ", persistenceEnabled=" + regCfg.isPersistenceEnabled() + "]" ); }
/** * Builds allocation path for memory mapped file to be used with PageMemory. * * @param plc DataRegionConfiguration. * * @throws IgniteCheckedException If resolving swap directory fails. */ @Nullable protected File buildAllocPath(DataRegionConfiguration plc) throws IgniteCheckedException { String path = plc.getSwapPath(); if (path == null) return null; final PdsFolderSettings folderSettings = cctx.kernalContext().pdsFolderResolver().resolveFolders(); final String folderName = folderSettings.isCompatible() ? String.valueOf(folderSettings.consistentId()).replaceAll("[:,\\.]", "_") : folderSettings.folderName(); return buildPath(path, folderName); }
/** * Constructor. * * @param plc Memory policy configuration. */ public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); maxSize = plc.getMaxSize(); initSize = plc.getInitialSize(); swapFilePath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); }
/** * Constructor. * * @param plc Data region configuration. */ public VisorDataRegionConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); initSize = plc.getInitialSize(); maxSize = plc.getMaxSize(); swapPath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); metricsEnabled = plc.isMetricsEnabled(); metricsSubIntervalCount = plc.getMetricsSubIntervalCount(); metricsRateTimeInterval = plc.getMetricsRateTimeInterval(); persistenceEnabled = plc.isPersistenceEnabled(); checkpointPageBufSize = plc.getCheckpointPageBufferSize(); }
/** * Writes the data region configuration. * * @param w Writer. */ private static void writeDataRegionConfiguration(BinaryRawWriter w, DataRegionConfiguration cfg) { assert w != null; assert cfg != null; w.writeString(cfg.getName()); w.writeBoolean(cfg.isPersistenceEnabled()); w.writeLong(cfg.getInitialSize()); w.writeLong(cfg.getMaxSize()); w.writeString(cfg.getSwapPath()); w.writeInt(cfg.getPageEvictionMode().ordinal()); w.writeDouble(cfg.getEvictionThreshold()); w.writeInt(cfg.getEmptyPagesPoolSize()); w.writeBoolean(cfg.isMetricsEnabled()); w.writeInt(cfg.getMetricsSubIntervalCount()); w.writeLong(cfg.getMetricsRateTimeInterval()); w.writeLong(cfg.getCheckpointPageBufferSize()); }
/** {@inheritDoc} */ @Override public String getSwapPath() { return dataRegCfg.getSwapPath(); }
/** * @param plcCfg Policy config. * * @return {@code True} if policy supports memory reuse. */ private boolean supportsMemoryReuse(DataRegionConfiguration plcCfg) { return reuseMemory && plcCfg.getSwapPath() == null; }
/** * @param regCfg DataRegionConfiguration to validate. * @throws IgniteCheckedException If config is invalid. */ private void checkRegionMemoryStorageType(DataRegionConfiguration regCfg) throws IgniteCheckedException { if (regCfg.isPersistenceEnabled() && regCfg.getSwapPath() != null) throw new IgniteCheckedException("DataRegionConfiguration must not have both persistence " + "storage and swap space enabled at the same time (Use DataRegionConfiguration.setSwapPath(null) " + "to disable the swap space usage or DataRegionConfiguration.setPersistenceEnabled(false) " + "to disable the persistence) [name=" + regCfg.getName() + ", swapPath=" + regCfg.getSwapPath() + ", persistenceEnabled=" + regCfg.isPersistenceEnabled() + "]" ); }
/** * Builds allocation path for memory mapped file to be used with PageMemory. * * @param plc DataRegionConfiguration. * * @throws IgniteCheckedException If resolving swap directory fails. */ @Nullable protected File buildAllocPath(DataRegionConfiguration plc) throws IgniteCheckedException { String path = plc.getSwapPath(); if (path == null) return null; final PdsFolderSettings folderSettings = cctx.kernalContext().pdsFolderResolver().resolveFolders(); final String folderName = folderSettings.isCompatible() ? String.valueOf(folderSettings.consistentId()).replaceAll("[:,\\.]", "_") : folderSettings.folderName(); return buildPath(path, folderName); }
/** * Constructor. * * @param plc Memory policy configuration. */ public VisorMemoryPolicyConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); maxSize = plc.getMaxSize(); initSize = plc.getInitialSize(); swapFilePath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); }
/** * Constructor. * * @param plc Data region configuration. */ public VisorDataRegionConfiguration(DataRegionConfiguration plc) { assert plc != null; name = plc.getName(); initSize = plc.getInitialSize(); maxSize = plc.getMaxSize(); swapPath = plc.getSwapPath(); pageEvictionMode = plc.getPageEvictionMode(); evictionThreshold = plc.getEvictionThreshold(); emptyPagesPoolSize = plc.getEmptyPagesPoolSize(); metricsEnabled = plc.isMetricsEnabled(); metricsSubIntervalCount = plc.getMetricsSubIntervalCount(); metricsRateTimeInterval = plc.getMetricsRateTimeInterval(); persistenceEnabled = plc.isPersistenceEnabled(); checkpointPageBufSize = plc.getCheckpointPageBufferSize(); }
/** * Writes the data region configuration. * * @param w Writer. */ private static void writeDataRegionConfiguration(BinaryRawWriter w, DataRegionConfiguration cfg) { assert w != null; assert cfg != null; w.writeString(cfg.getName()); w.writeBoolean(cfg.isPersistenceEnabled()); w.writeLong(cfg.getInitialSize()); w.writeLong(cfg.getMaxSize()); w.writeString(cfg.getSwapPath()); w.writeInt(cfg.getPageEvictionMode().ordinal()); w.writeDouble(cfg.getEvictionThreshold()); w.writeInt(cfg.getEmptyPagesPoolSize()); w.writeBoolean(cfg.isMetricsEnabled()); w.writeInt(cfg.getMetricsSubIntervalCount()); w.writeLong(cfg.getMetricsRateTimeInterval()); w.writeLong(cfg.getCheckpointPageBufferSize()); }