/** * @return Flag indicating whether read-through behaviour is enabled. */ public boolean writeThrough() { return ccfg.isWriteThrough(); }
/** {@inheritDoc} */ @Override public boolean isWriteThrough() { CacheConfiguration ccfg = cctx.config(); return ccfg != null && ccfg.isWriteThrough(); }
/** * @return {@code True} if store write-through is enabled. */ public boolean writeThrough() { return cacheCfg.isWriteThrough() && !skipStore(); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void initialize(@Nullable CacheStore cfgStore, Map sesHolders) throws IgniteCheckedException { GridKernalContext ctx = igniteContext(); CacheConfiguration cfg = cacheConfiguration(); writeThrough = cfg.isWriteThrough(); readThrough = cfg.isReadThrough(); this.cfgStore = cfgStore; store = cacheStoreWrapper(ctx, cfgStore, cfg); singleThreadGate = store == null ? null : new CacheStoreBalancingWrapper<>(store, cfg.getStoreConcurrentLoadAllThreshold()); ThreadLocal<SessionData> sesHolder0 = null; if (cfgStore != null) { sesHolder0 = ((Map<CacheStore, ThreadLocal>)sesHolders).get(cfgStore); if (sesHolder0 == null) { sesHolder0 = new ThreadLocal<>(); locSes = new ThreadLocalSession(sesHolder0); if (ctx.resource().injectStoreSession(cfgStore, locSes)) sesHolders.put(cfgStore, sesHolder0); } else locSes = new ThreadLocalSession(sesHolder0); } sesHolder = sesHolder0; locStore = U.hasAnnotation(cfgStore, CacheLocalStore.class); if (cfgStore instanceof CacheJdbcPojoStore) alwaysKeepBinary = true; }
/** * @param ccfg Cache configuration. */ private void logCacheInfo(CacheConfiguration<?, ?> ccfg) { log.info("Test cache [mode=" + ccfg.getCacheMode() + ", sync=" + ccfg.getWriteSynchronizationMode() + ", backups=" + ccfg.getBackups() + ", near=" + (ccfg.getNearConfiguration() != null) + ", store=" + ccfg.isWriteThrough() + ", evictPlc=" + (ccfg.getEvictionPolicy() != null) + ']'); }
/** * @param ccfg Cache configuration. */ private void logCacheInfo(CacheConfiguration<?, ?> ccfg) { log.info("Test cache [mode=" + ccfg.getCacheMode() + ", sync=" + ccfg.getWriteSynchronizationMode() + ", backups=" + ccfg.getBackups() + ", near=" + (ccfg.getNearConfiguration() != null) + ", store=" + ccfg.isWriteThrough() + ", evictPlc=" + (ccfg.getEvictionPolicy() != null) + ']'); }
if (!cfg.isWriteThrough() && !cfg.isReadThrough()) { U.quietAndWarn(log, "Persistence store is configured, but both read-through and write-through are disabled. This " + if (!cfg.isWriteThrough() && cfg.isWriteBehindEnabled()) { U.quietAndWarn(log, "To enable write-behind mode for the cache store it's also required to set " + if (cctx.group().persistenceEnabled() && (cfg.isWriteThrough() || cfg.isReadThrough())) U.quietAndWarn(log, "Both Ignite native persistence and CacheStore are configured for cache '" + cfg.getName() + "'. " +
/** * @param cfg Configuration to check for possible performance issues. * @param hasStore {@code True} if store is configured. */ private void suggestOptimizations(CacheConfiguration cfg, boolean hasStore) { GridPerformanceSuggestions perf = ctx.performance(); String msg = "Disable eviction policy (remove from configuration)"; if (cfg.getEvictionPolicyFactory() != null || cfg.getEvictionPolicy() != null) perf.add(msg, false); else perf.add(msg, true); if (cfg.getCacheMode() == PARTITIONED) { perf.add("Disable near cache (set 'nearConfiguration' to null)", cfg.getNearConfiguration() == null); if (cfg.getAffinity() != null) perf.add("Decrease number of backups (set 'backups' to 0)", cfg.getBackups() == 0); } // Suppress warning if at least one ATOMIC cache found. perf.add("Enable ATOMIC mode if not using transactions (set 'atomicityMode' to ATOMIC)", cfg.getAtomicityMode() == ATOMIC); // Suppress warning if at least one non-FULL_SYNC mode found. perf.add("Disable fully synchronous writes (set 'writeSynchronizationMode' to PRIMARY_SYNC or FULL_ASYNC)", cfg.getWriteSynchronizationMode() != FULL_SYNC); if (hasStore && cfg.isWriteThrough()) perf.add("Enable write-behind to persistent store (set 'writeBehindEnabled' to true)", cfg.isWriteBehindEnabled()); }
/** * Create data transfer object for cache store configuration properties. * * @param ignite Ignite instance. * @param ccfg Cache configuration. */ public VisorCacheStoreConfiguration(IgniteEx ignite, CacheConfiguration ccfg) { IgniteCacheProxy<Object, Object> c = ignite.context().cache().jcache(ccfg.getName()); CacheStore cstore = c != null && c.context().started() ? c.context().store().configuredStore() : null; jdbcStore = cstore instanceof CacheAbstractJdbcStore; store = compactClass(cstore); storeFactory = compactClass(ccfg.getCacheStoreFactory()); readThrough = ccfg.isReadThrough(); writeThrough = ccfg.isWriteThrough(); writeBehindEnabled = ccfg.isWriteBehindEnabled(); batchSz = ccfg.getWriteBehindBatchSize(); flushFreq = ccfg.getWriteBehindFlushFrequency(); flushSz = ccfg.getWriteBehindFlushSize(); flushThreadCnt = ccfg.getWriteBehindFlushThreadCount(); storeKeepBinary = ccfg.isStoreKeepBinary(); writeBehindCoalescing = ccfg.getWriteBehindCoalescing(); }
|| grpCtx.config().isWriteThrough() || grpCtx.config().getCacheStoreFactory() != null || grpCtx.config().getRebalanceDelay() == -1
"readThrough cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); assertParameter(!cc.isWriteThrough(), "writeThrough cannot be used with TRANSACTIONAL_SNAPSHOT atomicity mode"); "for cache: " + U.maskName(cc.getName())); if (cc.isWriteThrough() && cfgStore == null) throw new IgniteCheckedException("Cannot enable write-through (writer or store is not provided) " + "for cache: " + U.maskName(cc.getName()));
invalidate = cc.isInvalidate(); isReadThrough = cc.isReadThrough(); isWriteThrough = cc.isWriteThrough(); keyCfg = cc.getKeyConfiguration(); listenerConfigurations = cc.listenerConfigurations;
cache.cacheConfiguration().isStoreKeepBinary(), cache.cacheConfiguration().isReadThrough(), cache.cacheConfiguration().isWriteThrough(), cache.cacheConfiguration().isWriteBehindEnabled(), cache.cacheConfiguration().getWriteBehindCoalescing(),
Factory<CacheWriter> writerFactory = cfg.isWriteThrough() ? cfg.getCacheWriterFactory() : null;
/** * @return Flag indicating whether read-through behaviour is enabled. */ public boolean writeThrough() { return ccfg.isWriteThrough(); }
writeEnumInt(writer, ccfg.getWriteSynchronizationMode()); writer.writeBoolean(ccfg.isReadThrough()); writer.writeBoolean(ccfg.isWriteThrough()); writer.writeBoolean(ccfg.isStatisticsEnabled());
/** {@inheritDoc} */ @Override public boolean isWriteThrough() { CacheConfiguration ccfg = cctx.config(); return ccfg != null && ccfg.isWriteThrough(); }
/** * @return {@code True} if store write-through is enabled. */ public boolean writeThrough() { return cacheCfg.isWriteThrough() && !skipStore(); }
/** * @param cfg Configuration to check for possible performance issues. * @param hasStore {@code True} if store is configured. */ private void suggestOptimizations(CacheConfiguration cfg, boolean hasStore) { GridPerformanceSuggestions perf = ctx.performance(); String msg = "Disable eviction policy (remove from configuration)"; if (cfg.getEvictionPolicyFactory() != null || cfg.getEvictionPolicy() != null) perf.add(msg, false); else perf.add(msg, true); if (cfg.getCacheMode() == PARTITIONED) { perf.add("Disable near cache (set 'nearConfiguration' to null)", cfg.getNearConfiguration() == null); if (cfg.getAffinity() != null) perf.add("Decrease number of backups (set 'backups' to 0)", cfg.getBackups() == 0); } // Suppress warning if at least one ATOMIC cache found. perf.add("Enable ATOMIC mode if not using transactions (set 'atomicityMode' to ATOMIC)", cfg.getAtomicityMode() == ATOMIC); // Suppress warning if at least one non-FULL_SYNC mode found. perf.add("Disable fully synchronous writes (set 'writeSynchronizationMode' to PRIMARY_SYNC or FULL_ASYNC)", cfg.getWriteSynchronizationMode() != FULL_SYNC); if (hasStore && cfg.isWriteThrough()) perf.add("Enable write-behind to persistent store (set 'writeBehindEnabled' to true)", cfg.isWriteBehindEnabled()); }
/** * Create data transfer object for cache store configuration properties. * * @param ignite Ignite instance. * @param ccfg Cache configuration. */ public VisorCacheStoreConfiguration(IgniteEx ignite, CacheConfiguration ccfg) { IgniteCacheProxy<Object, Object> c = ignite.context().cache().jcache(ccfg.getName()); CacheStore cstore = c != null && c.context().started() ? c.context().store().configuredStore() : null; jdbcStore = cstore instanceof CacheAbstractJdbcStore; store = compactClass(cstore); storeFactory = compactClass(ccfg.getCacheStoreFactory()); readThrough = ccfg.isReadThrough(); writeThrough = ccfg.isWriteThrough(); writeBehindEnabled = ccfg.isWriteBehindEnabled(); batchSz = ccfg.getWriteBehindBatchSize(); flushFreq = ccfg.getWriteBehindFlushFrequency(); flushSz = ccfg.getWriteBehindFlushSize(); flushThreadCnt = ccfg.getWriteBehindFlushThreadCount(); storeKeepBinary = ccfg.isStoreKeepBinary(); writeBehindCoalescing = ccfg.getWriteBehindCoalescing(); }