@SuppressWarnings("deprecation") @Override public void accept(ConfigurationBuilder builder) { ClusteringConfigurationBuilder clustering = builder.clustering(); CacheMode mode = clustering.cacheMode(); clustering.cacheMode(mode.needsStateTransfer() ? CacheMode.REPL_SYNC : CacheMode.LOCAL); // don't use DefaultConsistentHashFactory for REPL caches (WFLY-9276) clustering.hash().consistentHashFactory(null); clustering.l1().disable(); // Workaround for ISPN-8722 AttributeSet attributes = TemplateConfigurationServiceConfigurator.getAttributes(clustering); attributes.attribute(ClusteringConfiguration.BIAS_ACQUISITION).reset(); attributes.attribute(ClusteringConfiguration.BIAS_LIFESPAN).reset(); attributes.attribute(ClusteringConfiguration.INVALIDATION_BATCH_SIZE).reset(); // Ensure we use the default data container builder.dataContainer().dataContainer(null); // Disable expiration builder.expiration().lifespan(-1).maxIdle(-1); // Disable eviction builder.memory().size(-1).evictionStrategy(EvictionStrategy.MANUAL); builder.persistence().clearStores(); StateTransferConfigurationBuilder stateTransfer = clustering.stateTransfer().fetchInMemoryState(mode.needsStateTransfer()); attributes = TemplateConfigurationServiceConfigurator.getAttributes(stateTransfer); attributes.attribute(StateTransferConfiguration.AWAIT_INITIAL_TRANSFER).reset(); attributes.attribute(StateTransferConfiguration.TIMEOUT).reset(); } }
@Override public StateTransferConfiguration get() { boolean timeoutEnabled = this.timeout > 0; return new ConfigurationBuilder().clustering().stateTransfer() .chunkSize(this.chunkSize) .fetchInMemoryState(true) .awaitInitialTransfer(timeoutEnabled) .timeout(timeoutEnabled ? this.timeout : Long.MAX_VALUE) .create(); }
@Override protected void createCacheManagers() throws Throwable { cacheConfigBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true, true); cacheConfigBuilder.transaction().transactionMode(TransactionMode.TRANSACTIONAL) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .lockingMode(LockingMode.PESSIMISTIC) .clustering().hash().numOwners(10) // a number bigger than actual number of nodes will make this distributed cluster behave as if fully replicated .stateTransfer().fetchInMemoryState(true) .awaitInitialTransfer(true); // setting this to false will lead to test failure createCluster(cacheConfigBuilder, 2); waitForClusterToForm(); }
protected ConfigurationBuilder createTopologyCacheConfig(long distSyncTimeout) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.clustering().cacheMode(CacheMode.REPL_SYNC).remoteTimeout(configuration.topologyReplTimeout()) .locking().lockAcquisitionTimeout(configuration.topologyLockTimeout()) .clustering().partitionHandling().mergePolicy(null) .expiration().lifespan(-1).maxIdle(-1); if (configuration.topologyStateTransfer()) { builder .clustering() .stateTransfer() .awaitInitialTransfer(configuration.topologyAwaitInitialTransfer()) .fetchInMemoryState(true) .timeout(distSyncTimeout + configuration.topologyReplTimeout()); } else { builder.persistence().addClusterLoader().remoteCallTimeout(configuration.topologyReplTimeout()); } return builder; }
.asyncMarshalling() .stateTransfer() .fetchInMemoryState(false) .timeout(config.getClusterTimeout()) .eviction() .strategy(EvictionStrategy.LIRS) .maxEntries(100000)
@Override protected void createCacheManagers() { tmpDir = new File(TestingUtil.tmpDirectory(this.getClass())); Util.recursiveFileRemove(tmpDir); // reproduce the MODE-1754 config as closely as possible builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true, true); builder.transaction().transactionMode(TransactionMode.TRANSACTIONAL).lockingMode(LockingMode.PESSIMISTIC) .transactionManagerLookup(new EmbeddedTransactionManagerLookup()) .memory().size(1000) .locking().lockAcquisitionTimeout(20000) .concurrencyLevel(5000) // lowering this to 50 makes the test pass also on 5.2 but it's just a temporary workaround .useLockStriping(false).isolationLevel(IsolationLevel.READ_COMMITTED) .dataContainer().storeAsBinary() .clustering().remoteTimeout(20000) .stateTransfer().timeout(240000).fetchInMemoryState(false).chunkSize(10000) .persistence().passivation(false).addSingleFileStore().location(new File(tmpDir, "store0").getAbsolutePath()).shared(false).preload(false) .fetchPersistentState(true) .ignoreModifications(false) .purgeOnStartup(false); createCluster(builder, 1); waitForClusterToForm(); }
@Override protected void createCacheManagers() throws Throwable { cfgBuilder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); cfgBuilder.transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()); cfgBuilder.clustering().hash().numOwners(2); cfgBuilder.clustering().stateTransfer().fetchInMemoryState(true); cfgBuilder.clustering().stateTransfer().timeout(20000); gcfgBuilder = new GlobalConfigurationBuilder(); gcfgBuilder.transport().transport(mockTransport); }
@Override protected void createCacheManagers() throws Throwable { caches = TestQueryHelperFactory.createTopologyAwareCacheNodes(NUM_NODES, CacheMode.DIST_SYNC, false, true, false, "default", holder -> { Configuration cacheCfg1 = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false) .clustering().stateTransfer().fetchInMemoryState(true).build(); holder.newConfigurationBuilder(InfinispanIntegration.DEFAULT_INDEXESDATA_CACHENAME).read(cacheCfg1); holder.newConfigurationBuilder(InfinispanIntegration.DEFAULT_LOCKING_CACHENAME).read(cacheCfg1); }, Car.class); for(Object cache : caches) { Cache cacheObj = (Cache) cache; cacheManagers.add(cacheObj.getCacheManager()); } waitForClusterToForm(neededCacheNames); } }
public MetadataManager(DefaultCacheManager cacheManager){ Configuration cacheConfiguration = cacheManager.getCacheConfiguration(Support.AVRO_METADATA_CACHE_NAME); if (cacheConfiguration == null) { ConfigurationBuilder cfg = new ConfigurationBuilder(); CacheMode cacheMode = cacheManager.getDefaultCacheConfiguration().clustering().cacheMode().equals(CacheMode.LOCAL) ? CacheMode.LOCAL : CacheMode.REPL_SYNC; cfg .transaction().lockingMode(LockingMode.PESSIMISTIC).syncCommitPhase(true).syncRollbackPhase(true) .persistence().addSingleFileStore().location(System.getProperty("java.io.tmpdir") + "/" + cacheManager.getNodeAddress()) // mandatory .locking().isolationLevel(IsolationLevel.READ_COMMITTED).useLockStriping(false) .clustering().cacheMode(cacheMode) .stateTransfer().fetchInMemoryState(true) .dataContainer().keyEquivalence(new ByteArrayEquivalence()); // for HotRod compatibility if (cacheMode.equals(CacheMode.REPL_SYNC)) cfg.clustering().stateTransfer().awaitInitialTransfer(true); cacheManager.defineConfiguration(Support.AVRO_METADATA_CACHE_NAME, cfg.build()); this.cacheManager = cacheManager; this.marshaller= Externalizer.getInstance(); this.knownSchemas = new ConcurrentHashMap<>(); knownSchemas.put(Request.getClassSchema().getFullName(), Request.getClassSchema()); knownSchemas.put(Response.getClassSchema().getFullName(), Response.getClassSchema()); } }
private ConfigurationBuilder getCB(){ ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering() .cacheMode(CacheMode.DIST_SYNC) .remoteTimeout(60000) .stateTransfer().timeout(180000).fetchInMemoryState(true) .hash().numOwners(1); // transactions cb.transaction() .transactionMode(TransactionMode.TRANSACTIONAL) .lockingMode(LockingMode.PESSIMISTIC); // cb.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); cb.persistence().passivation(false); // Make it really shared by adding the test's name as store name cb.persistence() .addStore(DummyInMemoryStoreConfigurationBuilder.class).preload(true).shared(true) .storeName(getClass().getSimpleName()).async() .disable(); return cb; }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true); builder.clustering().cacheMode(CacheMode.DIST_SYNC) .l1().disable() .clustering().stateTransfer().fetchInMemoryState(true) .locking().useLockStriping(false) .clustering().hash().numOwners(3).numSegments(60) .stateTransfer().chunkSize(50); createCluster(builder, 4); c0 = cache(0); c1 = cache(1); c2 = cache(2); c3 = cache(3); waitForClusterToForm(); log.debug("Rehash is complete!"); expected = new HashMap<Integer, BigObject>(); }
@Override protected ConfigurationBuilder getConfiguration() { ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(true, false); builder.compatibility().enable() .clustering() .cacheMode(CacheMode.DIST_SYNC) .stateTransfer().fetchInMemoryState(false) .transaction().cacheStopTimeout(0L); return builder; }
@Override protected void configureCache(ConfigurationBuilder builder) { // To force a shared cache store, make sure storeName property // for dummy store is the same for all nodes builder.clustering().stateTransfer().fetchInMemoryState(false) .persistence().addStore(DummyInMemoryStoreConfigurationBuilder.class).shared(true).preload(true). storeName(getClass().getName()); }
@Override protected void createCacheManagers() throws Throwable { ConfigurationBuilder c = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); c.clustering().stateTransfer().fetchInMemoryState(true) .locking().lockAcquisitionTimeout(1500); createClusteredCaches(2, c); }
@Override protected void createCacheManagers() throws Throwable { defaultConfig = getDefaultClusteredCacheConfig(CacheMode.SCATTERED_SYNC, false); defaultConfig.clustering().hash().numSegments(16); defaultConfig.clustering().biasAcquisition(biasAcquisition); defaultConfig.clustering().stateTransfer().fetchInMemoryState(true).chunkSize(3); createClusteredCaches(3, defaultConfig, TRANSPORT_FLAGS, CACHE_NAME); c1 = cache(0, CACHE_NAME); c2 = cache(1, CACHE_NAME); c3 = cache(2, CACHE_NAME); } }
private ConfigurationBuilder configuration() { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); builder.clustering() .stateTransfer().fetchInMemoryState(true) .hash().numSegments(1).numOwners(3).consistentHashFactory(new ConsistentHashFactoryImpl()); builder.locking().isolationLevel(IsolationLevel.REPEATABLE_READ); return builder; }
private ConfigurationBuilder config() { ConfigurationBuilder configuration = new ConfigurationBuilder(); configuration.clustering().stateTransfer().fetchInMemoryState(false).jmxStatistics().enable(); return configuration; } }
.stateTransfer().awaitInitialTransfer(true).timeout(480000) .locking().useLockStriping(false).lockAcquisitionTimeout(10000).concurrencyLevel(500) .stateTransfer().awaitInitialTransfer(true).timeout(480000) .locking().useLockStriping(false).lockAcquisitionTimeout(10000).concurrencyLevel(500) .stateTransfer().awaitInitialTransfer(true).timeout(480000) .locking().useLockStriping(false).lockAcquisitionTimeout(10000).concurrencyLevel(500)
protected void createCacheManagers() throws Throwable { ConfigurationBuilder build = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, true); build.clustering().stateTransfer().timeout(10000); createClusteredCaches(2, "replication", build); }
private ConfigurationBuilder getConfigurationBuilder(boolean awaitInitialTransfer) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.clustering().cacheMode(cacheMode) .stateTransfer().awaitInitialTransfer(awaitInitialTransfer); return cb; }