Hi Stan, Thank you for the reply. I will send different questions separately now onwards.
I do not understand what are you trying to say ( "*Ignite doesn’t support using 3rd party DBs and native persistence with the same cache*" ) . If the persistence is enabled and if you create or load the cache from 3rd party DB or any other source, data is always stored/backed in ignite native persistence store. I have enable the persistence using IgniteConfiguration. I believe that this configuration is global and so it is applicable to all the caches I have created. As per my understanding, if persistence is enabled any cache created will be stored/backed in ignite persistence store. So now if I load the data in cache from oracle or any other DB table, it will be persisted in ignite native persistence file system. The point is I want to load the cache from oracle tables only first time or when the cache is empty. To load the cache from 3rd party DB I am using cache.loadCache method. I am checking cache size, if the size is zero I call loadCache method. If the cache is not empty it means that data is already loaded in previous attempt so no need to call loadCache method. I just wanted to know if there is any better solution to achieve this. Thanks, Prasad On Wed, Feb 21, 2018 at 1:33 PM, Stanislav Lukyanov <[email protected]> wrote: > Hi Prasad, > > > > // Please send different questions separately – this way it’s easier to > answer and to search for existing answers > > > > > 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? > > > > > > Ignite doesn’t support using 3rd party DBs and native persistence with the > same cache. > > If you need to use both, I’d suggest to create two caches, one backed by > Oracle and one with enabled Ignite persistence, and alternate between them > in your application code. > > > > Thanks, > > Stan > > > > *From: *Prasad Bhalerao <[email protected]> > *Sent: *20 февраля 2018 г. 15:24 > *To: *[email protected] > *Subject: *Getting Invalid state exception when Persistance is enabled. > > > > 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 > > > > > > >
