Search in sources :

Example 16 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class ExternalMemberConfigurationOverrideEnvTest method shouldHandleMapEventJournalConfig.

@Test
public void shouldHandleMapEventJournalConfig() throws Exception {
    Config config = new Config();
    EventJournalConfig eventJournalConfig = new EventJournalConfig().setEnabled(false).setCapacity(10);
    config.getMapConfig("foo1").setBackupCount(4).setEventJournalConfig(eventJournalConfig);
    Map<String, String> envVariables = new HashMap<>();
    envVariables.put("HZ_MAP_FOO1_BACKUPCOUNT", "2");
    envVariables.put("HZ_MAP_FOO1_EVENTJOURNAL_ENABLED", "true");
    new ExternalConfigurationOverride(envVariables, System::getProperties).overwriteMemberConfig(config);
    assertEquals(2, config.getMapConfig("foo1").getBackupCount());
    assertTrue(config.getMapConfig("foo1").getEventJournalConfig().isEnabled());
    assertEquals(10, config.getMapConfig("foo1").getEventJournalConfig().getCapacity());
}
Also used : HashMap(java.util.HashMap) EventJournalConfig(com.hazelcast.config.EventJournalConfig) UserCodeDeploymentConfig(com.hazelcast.config.UserCodeDeploymentConfig) Config(com.hazelcast.config.Config) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) NearCacheConfig(com.hazelcast.config.NearCacheConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 17 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class DynamicConfigTest method getCacheConfig.

private CacheSimpleConfig getCacheConfig() {
    CacheSimpleEntryListenerConfig entryListenerConfig = new CacheSimpleEntryListenerConfig();
    entryListenerConfig.setCacheEntryListenerFactory("CacheEntryListenerFactory");
    entryListenerConfig.setSynchronous(true);
    entryListenerConfig.setOldValueRequired(true);
    entryListenerConfig.setCacheEntryEventFilterFactory("CacheEntryEventFilterFactory");
    CacheSimpleConfig config = new CacheSimpleConfig().setName(name).setSplitBrainProtectionName("split-brain-protection").setInMemoryFormat(InMemoryFormat.OBJECT).setBackupCount(3).setAsyncBackupCount(2).addEntryListenerConfig(entryListenerConfig).setStatisticsEnabled(true).setManagementEnabled(true).setKeyType("keyType").setValueType("valueType").setReadThrough(true).setWriteThrough(true).setHotRestartConfig(new HotRestartConfig().setEnabled(true).setFsync(true)).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(42).setTimeToLiveSeconds(52));
    config.setWanReplicationRef(new WanReplicationRef(randomName(), "com.hazelcast.MergePolicy", Collections.singletonList("filter"), true));
    config.getMergePolicyConfig().setPolicy("mergePolicy");
    config.setDisablePerEntryInvalidationEvents(true);
    return config;
}
Also used : CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) HotRestartConfig(com.hazelcast.config.HotRestartConfig) WanReplicationRef(com.hazelcast.config.WanReplicationRef) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheSimpleEntryListenerConfig(com.hazelcast.config.CacheSimpleEntryListenerConfig)

Example 18 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class DynamicConfigTest method getMapConfig.

private MapConfig getMapConfig() {
    MapConfig mapConfig = new MapConfig(name);
    mapConfig.setAsyncBackupCount(3).setBackupCount(2).setCacheDeserializedValues(CacheDeserializedValues.ALWAYS).setMerkleTreeConfig(new MerkleTreeConfig().setEnabled(true).setDepth(15)).setEventJournalConfig(new EventJournalConfig().setEnabled(true).setCapacity(42).setTimeToLiveSeconds(52)).setHotRestartConfig(new HotRestartConfig().setEnabled(true).setFsync(true)).setInMemoryFormat(InMemoryFormat.OBJECT).setMergePolicyConfig(new MergePolicyConfig(NON_DEFAULT_MERGE_POLICY, NON_DEFAULT_MERGE_BATCH_SIZE)).setTimeToLiveSeconds(220).setMaxIdleSeconds(110).setSplitBrainProtectionName(randomString()).addAttributeConfig(new AttributeConfig("attributeName", "com.attribute.extractor")).addIndexConfig(new IndexConfig(IndexType.SORTED, "attr")).setMetadataPolicy(MetadataPolicy.OFF).setReadBackupData(true).setStatisticsEnabled(false).setPerEntryStatsEnabled(true);
    mapConfig.getEvictionConfig().setEvictionPolicy(EvictionPolicy.RANDOM).setSize(4096).setMaxSizePolicy(MaxSizePolicy.PER_NODE);
    return mapConfig;
}
Also used : MergePolicyConfig(com.hazelcast.config.MergePolicyConfig) HotRestartConfig(com.hazelcast.config.HotRestartConfig) IndexConfig(com.hazelcast.config.IndexConfig) MapConfig(com.hazelcast.config.MapConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) MerkleTreeConfig(com.hazelcast.config.MerkleTreeConfig) AttributeConfig(com.hazelcast.config.AttributeConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Example 19 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class RingbufferCacheEventJournalImpl method getEventJournalConfig.

/**
 * {@inheritDoc}
 *
 * @throws CacheNotExistsException if the cache configuration was not found
 */
@Override
public EventJournalConfig getEventJournalConfig(ObjectNamespace namespace) {
    String name = namespace.getObjectName();
    CacheConfig cacheConfig = getCacheService().getCacheConfig(name);
    if (cacheConfig == null) {
        throw new CacheNotExistsException("Cache " + name + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember());
    }
    EventJournalConfig config = cacheConfig.getEventJournalConfig();
    if (config == null || !config.isEnabled()) {
        return null;
    }
    return config;
}
Also used : CacheConfig(com.hazelcast.config.CacheConfig) EventJournalConfig(com.hazelcast.config.EventJournalConfig) CacheNotExistsException(com.hazelcast.cache.CacheNotExistsException)

Example 20 with EventJournalConfig

use of com.hazelcast.config.EventJournalConfig in project hazelcast by hazelcast.

the class RingbufferMapEventJournalImpl method getRingbufferOrNull.

private RingbufferContainer<InternalEventJournalMapEvent, Object> getRingbufferOrNull(ObjectNamespace namespace, int partitionId) {
    RingbufferService service = getRingbufferService();
    RingbufferConfig ringbufferConfig;
    RingbufferContainer<InternalEventJournalMapEvent, Object> container = service.getContainerOrNull(partitionId, namespace);
    if (container != null) {
        return container;
    }
    EventJournalConfig config = getEventJournalConfig(namespace);
    if (config == null || !config.isEnabled()) {
        return null;
    }
    ringbufferConfig = toRingbufferConfig(config, namespace);
    return service.getOrCreateContainer(partitionId, namespace, ringbufferConfig);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) EventJournalConfig(com.hazelcast.config.EventJournalConfig)

Aggregations

EventJournalConfig (com.hazelcast.config.EventJournalConfig)32 Config (com.hazelcast.config.Config)13 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)10 JetConfig (com.hazelcast.jet.config.JetConfig)9 Before (org.junit.Before)9 MapConfig (com.hazelcast.config.MapConfig)6 MergePolicyConfig (com.hazelcast.config.MergePolicyConfig)6 AttributeConfig (com.hazelcast.config.AttributeConfig)5 IndexConfig (com.hazelcast.config.IndexConfig)5 MapStoreConfig (com.hazelcast.config.MapStoreConfig)5 MultiMapConfig (com.hazelcast.config.MultiMapConfig)5 NearCacheConfig (com.hazelcast.config.NearCacheConfig)5 AwsConfig (com.hazelcast.config.AwsConfig)4 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)4 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)4 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)4 DiskTierConfig (com.hazelcast.config.DiskTierConfig)4 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)4 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)4 EvictionConfig (com.hazelcast.config.EvictionConfig)4