/** * @return {@code True} if synchronous rollback is enabled. */ public boolean syncRollback() { return cacheCfg.getWriteSynchronizationMode() == FULL_SYNC; }
/** * @return Synchronization mode. */ public CacheWriteSynchronizationMode writeSynchronization() { return ccfg.getWriteSynchronizationMode(); }
/** * @return {@code True} if synchronous commit is enabled. */ public boolean syncCommit() { return cacheCfg.getWriteSynchronizationMode() == FULL_SYNC; }
/** * @return {@code True} if only primary node should be updated synchronously. */ public boolean syncPrimary() { return cacheCfg.getWriteSynchronizationMode() == PRIMARY_SYNC; }
/** {@inheritDoc} */ @Override public CacheWriteSynchronizationMode syncMode(GridCacheSharedContext cctx) { return cacheCtx != null ? cacheCtx.config().getWriteSynchronizationMode() : FULL_ASYNC; }
/** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception { CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName); assertEquals(CacheWriteSynchronizationMode.FULL_SYNC, ccfg.getWriteSynchronizationMode()); return ccfg; }
/** {@inheritDoc} */ @Override public CacheWriteSynchronizationMode syncMode(GridCacheSharedContext cctx) { CacheWriteSynchronizationMode syncMode = CacheWriteSynchronizationMode.FULL_ASYNC; for (int i = 0; i < activeCacheIds.size(); i++) { int cacheId = activeCacheIds.get(i); CacheWriteSynchronizationMode cacheSyncMode = cctx.cacheContext(cacheId).config().getWriteSynchronizationMode(); switch (cacheSyncMode) { case FULL_SYNC: return FULL_SYNC; case PRIMARY_SYNC: { if (syncMode == FULL_ASYNC) syncMode = PRIMARY_SYNC; break; } case FULL_ASYNC: break; } } return syncMode; }
/** * @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) + ']'); }
/** * @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) + ']'); }
ctx, this, ctx.config().getWriteSynchronizationMode(), DELETE, keys != null ? keys : conflictMap.keySet(),
ctx, this, ctx.config().getWriteSynchronizationMode(), req.operation(), req.keys(),
assertEquals(writeSyncMode, cacheDesc.cacheConfiguration().getWriteSynchronizationMode());
/** * Init cache. */ @SuppressWarnings("unchecked") void initCache() { cache = webSesIgnite.cache(cacheName); binaryCache = webSesIgnite.cache(cacheName); if (cache == null) throw new IgniteException("Cache for web sessions is not started (is it configured?): " + cacheName); CacheConfiguration cacheCfg = cache.getConfiguration(CacheConfiguration.class); if (cacheCfg.getWriteSynchronizationMode() == FULL_ASYNC) throw new IgniteException("Cache for web sessions cannot be in FULL_ASYNC mode: " + cacheName); if (!cacheCfg.isEagerTtl()) throw new IgniteException("Cache for web sessions cannot operate with lazy TTL. " + "Consider setting eagerTtl to true for cache: " + cacheName); if (cacheCfg.getCacheMode() == LOCAL) U.quietAndWarn(webSesIgnite.log(), "Using LOCAL cache for web sessions caching " + "(this is only OK in test mode): " + cacheName); if (cacheCfg.getCacheMode() == PARTITIONED && cacheCfg.getAtomicityMode() != ATOMIC) U.quietAndWarn(webSesIgnite.log(), "Using " + cacheCfg.getAtomicityMode() + " atomicity for web sessions " + "caching (switch to ATOMIC mode for better performance)"); txEnabled = cacheCfg.getAtomicityMode() == TRANSACTIONAL; }
/** * @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()); }
cfg.setAtomicityMode(CacheConfiguration.DFLT_CACHE_ATOMICITY_MODE); if (cfg.getWriteSynchronizationMode() == null) cfg.setWriteSynchronizationMode(PRIMARY_SYNC); assert cfg.getWriteSynchronizationMode() != null;
assertEquals(wrtSync, ccfg.getWriteSynchronizationMode());
writer.writeInt(cfg.getSqlIndexMaxInlineSize()); writer.writeString(cfg.getSqlSchema()); writeEnumInt(writer, cfg.getWriteSynchronizationMode());
atomicityMode = ccfg.getAtomicityMode(); eagerTtl = ccfg.isEagerTtl(); writeSynchronizationMode = ccfg.getWriteSynchronizationMode(); invalidate = ccfg.isInvalidate(); maxConcurrentAsyncOps = ccfg.getMaxConcurrentAsyncOperations();
cache.cacheConfiguration().getTopologyValidator(), cache.cacheConfiguration().isEagerTtl(), cache.cacheConfiguration().getWriteSynchronizationMode(), cache.cacheConfiguration().isInvalidate(), cache.cacheConfiguration().isEventsDisabled(),