ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasad Bhalerao <prasadbhalerao1...@gmail.com>
Subject Getting Invalid state exception when Persistance is enabled.
Date Tue, 20 Feb 2018 12:24:09 GMT
Hi,

I am starting ignite node in server mode in intellij. I am starting only
one instance of it. I am using IgniteSpringBean to set configuration and
start the node as shown below. But when I enable persistence, I get
following exception.

Caused by: java.lang.IllegalStateException: Ignite is in invalid state to
perform this operation. It either not started yet or has already being or
have stopped [ignite=null, cfg=null]

As per the doc, IgniteSpringBean is responsible for starting the ignite. So
how to set node to active state in case this case?

Also, I am loading the cache from oracle table using loadCache method. If
the persistence is enabled and if the data is already persisted, I want to
make sure that the cache is loaded from persisted data instead of loading
it from oracle table using loadCache. Can someone please advise how this
can be achieved?

Code to config ignite and cache:

@Bean
public IgniteSpringBean igniteInstance() {
    IgniteSpringBean ignite = new IgniteSpringBean();
    *ignite.active(true);*
    ignite.setConfiguration(getIgniteConfiguration());

    return ignite;
}

private IgniteConfiguration getIgniteConfiguration() {

    String HOST = "127.0.0.1:47500..47509";
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(Collections.singletonList(HOST));

    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(ipFinder);

    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setDiscoverySpi(discoSpi);
    cfg.setIgniteInstanceName("springDataNode");
    cfg.setPeerClassLoadingEnabled(false);
    cfg.setRebalanceThreadPoolSize(4);



*   DataStorageConfiguration storageCfg = new
DataStorageConfiguration();
storageCfg.getDefaultDataRegionConfiguration().setPersistenceEnabled(true);
   cfg.setDataStorageConfiguration(storageCfg);*

    CacheConfiguration<IPRangeDataKey, IPV4RangeData>
ipv4RangeCacheCfg = new CacheConfiguration<>("IPV4RangeCache");
    ipv4RangeCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
    ipv4RangeCacheCfg.setWriteThrough(false);
    ipv4RangeCacheCfg.setReadThrough(false);
    ipv4RangeCacheCfg.setRebalanceMode(CacheRebalanceMode.ASYNC);
    ipv4RangeCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    ipv4RangeCacheCfg.setBackups(1);
    Factory<IPV4RangeCacheDataLoader> storeFactory =
FactoryBuilder.factoryOf(IPV4RangeCacheDataLoader.class);
    ipv4RangeCacheCfg.setCacheStoreFactory(storeFactory);

    cfg.setCacheConfiguration(ipv4RangeCacheCfg);
    return cfg;
}


Thanks,
Prasad

Mime
View raw message