From user-return-17918-archive-asf-public=cust-asf.ponee.io@ignite.apache.org Wed Feb 21 14:59:34 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BECAE18061A for ; Wed, 21 Feb 2018 14:59:32 +0100 (CET) Received: (qmail 88269 invoked by uid 500); 21 Feb 2018 13:59:31 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 88259 invoked by uid 99); 21 Feb 2018 13:59:31 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Feb 2018 13:59:31 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 15207180547 for ; Wed, 21 Feb 2018 13:59:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.879 X-Spam-Level: ** X-Spam-Status: No, score=2.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id GCXzUeHmwycf for ; Wed, 21 Feb 2018 13:59:28 +0000 (UTC) Received: from mail-lf0-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id BF0B95F397 for ; Wed, 21 Feb 2018 13:59:27 +0000 (UTC) Received: by mail-lf0-f48.google.com with SMTP id g72so2483907lfg.5 for ; Wed, 21 Feb 2018 05:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:mime-version:to:from:subject:date:importance:in-reply-to :references; bh=raie8ivgnpQZ4cCFmqLS3M0RZGTq4FGwjRifdudtGr8=; b=LYR3ADdFiiW5zp6oDdgQZM5vEU4St9CUFwf3d++8WLN1P2XBJ5tMAvU2Fe37vOWeK0 o8gaOmJiDdLy5m6YeZbaaOYpAFrPT/i6tXggv7f/1t06b05/Wa6nXPJxGDjwPsdEVSgy j+CNIJZdXwHtdjzUahPKycG1Y3J9TNzvAhzBm7ebKtizvU4RAc41xT4oMc6weP9S5Ux7 IeufX04Nszlhs+59HsnyJdJcxXilMFgKwmsB9UL8HeelzRR4oq3Alz8V1EvsfLKfhtu6 hWiIgDmVOJrp8guGcXTjU+RO00dSQtXse2F45g5OXYiQzRj52Sgfm55UIIBwpDOYvMk4 45vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:mime-version:to:from:subject:date :importance:in-reply-to:references; bh=raie8ivgnpQZ4cCFmqLS3M0RZGTq4FGwjRifdudtGr8=; b=o+MkenRqeq5V9up9zeVhMmxXPB/7+ws4/4oL8pgiQnvyTLy1Mv/aeFMQam4JbzIp0P y/yDoJe1tLZEaFykoLHHAzS9lTBgiZ6EqBvNLMe/1ZdaadQFjmAyAeIo5DaTNgq544wr WDa1dBwkpXfHeWmuYKq2VMnRY7o36ZH8PS8xxvHZePwDwpk02TZW/4V34YyO4WGFU4ZH 7U2lI0bIt9rPjEL5ret2MRSXDwsuzvJemb1XMLvvpUI+ep7B/zfyYOMPwGRKGh64YIu2 aJuiBeXIgKsU5OG5jcGkwXIM/EgHrp2K/f8SUQhC37qqN5AyzSTKYsuD2UhxsdrpiVMw Bczw== X-Gm-Message-State: APf1xPB7pCaE6xaUMye+feFpOMEzznkAKrEuUTBFCffl6NzxwoDDnG1/ gPYnBs9yIaK8Qi/5EkF6l0RbySfc X-Google-Smtp-Source: AH8x226EkHjGC1TgxQ1cTj4mJT+2dnMl/+eKgZG62ezzznz5ZDew9zz5qceZEhbZnKJrAoI/uq4/JQ== X-Received: by 10.46.20.30 with SMTP id u30mr2571201ljd.12.1519221560433; Wed, 21 Feb 2018 05:59:20 -0800 (PST) Received: from ?IPv6:::ffff:172.25.4.96? ([195.239.208.174]) by smtp.gmail.com with ESMTPSA id 19sm1245223lfz.1.2018.02.21.05.59.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 05:59:19 -0800 (PST) Message-ID: <5a8d7b37.1319190a.f9e67.7b8b@mx.google.com> MIME-Version: 1.0 To: "user@ignite.apache.org" From: Stanislav Lukyanov Subject: RE: Using 3rd party DB together with native persistence (WAS: GettingInvalid state exception when Persistance is enabled.) Date: Wed, 21 Feb 2018 16:59:20 +0300 Importance: normal X-Priority: 3 In-Reply-To: References: <5a8d27e4.0e162e0a.884f3.f7b7@mx.google.com> Content-Type: multipart/alternative; boundary="_289D2D8A-26BB-4634-B633-603A8511B14F_" --_289D2D8A-26BB-4634-B633-603A8511B14F_ Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Sorry, I wasn=E2=80=99t completely correct. Persistence and CacheStore can = work together, but if cache configured with write-through or read-through m= odes enabled then data consistency between Ignite persistence and CacheStor= e is not guaranteed at all times, so such configurations are usually avoide= d. However, from what you=E2=80=99re saying it seems that you don=E2=80=99t= need write-through or read-through, so it should work fine. Your solution seems OK. If you only need a one-time setup I guess you could= also do it without a CacheStore and just get the data from Oracle and put = it into Ignite via putAll or DataStreamer. Thanks, Stan From: Prasad Bhalerao Sent: 21 =D1=84=D0=B5=D0=B2=D1=80=D0=B0=D0=BB=D1=8F 2018 =D0=B3. 14:33 To: user@ignite.apache.org Subject: Re: Using 3rd party DB together with native persistence (WAS: Gett= ingInvalid state exception when Persistance is enabled.) Hi Stan, Thank you for the reply. I will send different questions separately now onw= ards. I do not understand what are you trying to say ( "Ignite doesn=E2=80=99t su= pport 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.=C2=A0 I have enable the persistence using IgniteConfiguration. I believe that thi= s 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 creat= ed 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 wi= ll be persisted in ignite native persistence file system. The point is I wa= nt to load the cache from oracle tables only first time or when the cache i= s empty. To load the cache from 3rd party DB I am using cache.loadCache met= hod.=C2=A0 I am checking cache size, if the size is zero I call loadCache method. If t= he cache is not empty it means that data is already loaded in previous atte= mpt 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 wrote: Hi Prasad, =C2=A0 // Please send different questions separately =E2=80=93 this way it=E2=80= =99s easier to answer and to search for existing answers =C2=A0 > 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 ca= n be achieved? =C2=A0 =C2=A0 Ignite doesn=E2=80=99t support using 3rd party DBs and native persistence w= ith the same cache. If you need to use both, I=E2=80=99d suggest to create two caches, one back= ed by Oracle and one with enabled Ignite persistence, and alternate between= them in your application code. =C2=A0 Thanks, Stan =C2=A0 From: Prasad Bhalerao Sent: 20 =D1=84=D0=B5=D0=B2=D1=80=D0=B0=D0=BB=D1=8F 2018 =D0=B3. 15:24 To: user@ignite.apache.org Subject: Getting Invalid state exception when Persistance is enabled. =C2=A0 Hi, =C2=A0 I am starting ignite node in server mode in intellij. I am starting only on= e instance of it. I am using IgniteSpringBean to set configuration and star= t the node as shown below. But when I enable persistence, I get following e= xception. =C2=A0 Caused by: java.lang.IllegalStateException: Ignite is in invalid state to p= erform this operation. It either not started yet or has already being or ha= ve stopped [ignite=3Dnull, cfg=3Dnull] =C2=A0 As per the doc, IgniteSpringBean is responsible for starting the ignite. So= how to set node to active state in case this case? =C2=A0 Also, I am loading the cache from oracle table using loadCache method. If t= he persistence is enabled and if the data is already persisted, I want to m= ake 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? =C2=A0 Code to config ignite and cache: =C2=A0 @Bean public IgniteSpringBean igniteInstance() { =C2=A0=C2=A0=C2=A0 IgniteSpringBean ignite =3D new IgniteSpringBean(); =C2=A0=C2=A0=C2=A0 ignite.active(true); =C2=A0=C2=A0=C2=A0 ignite.setConfiguration(getIgniteConfiguration()); =C2=A0=C2=A0=C2=A0 return ignite; } private IgniteConfiguration getIgniteConfiguration() { =C2=A0=C2=A0=C2=A0 String HOST =3D "127.0.0.1:47500..47509"; =C2=A0=C2=A0=C2=A0 TcpDiscoveryVmIpFinder ipFinder =3D new TcpDiscoveryVmIp= Finder(); =C2=A0=C2=A0=C2=A0 ipFinder.setAddresses(Collections.singletonList(HOST)); =C2=A0=C2=A0=C2=A0 TcpDiscoverySpi discoSpi =3D new TcpDiscoverySpi(); =C2=A0=C2=A0=C2=A0 discoSpi.setIpFinder(ipFinder); =C2=A0=C2=A0=C2=A0 IgniteConfiguration cfg =3D new IgniteConfiguration(); =C2=A0=C2=A0=C2=A0 cfg.setDiscoverySpi(discoSpi); =C2=A0=C2=A0=C2=A0 cfg.setIgniteInstanceName("springDataNode"); =C2=A0=C2=A0=C2=A0 cfg.setPeerClassLoadingEnabled(false); =C2=A0=C2=A0=C2=A0 cfg.setRebalanceThreadPoolSize(4); =C2=A0=C2=A0=C2=A0DataStorageConfiguration storageCfg =3D new DataStorageC= onfiguration(); =C2=A0 =C2=A0=C2=A0storageCfg.getDefaultDataRegionConfiguration().setPersis= tenceEnabled(true); =C2=A0=C2=A0=C2=A0 cfg.setDataStorageConfiguration(storageCfg); =C2=A0=C2=A0=C2=A0 CacheConfiguration ipv4Ra= ngeCacheCfg =3D new CacheConfiguration<>("IPV4RangeCache"); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setAtomicityMode(CacheAtomicityMode.TR= ANSACTIONAL); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setWriteThrough(false); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setReadThrough(false); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setRebalanceMode(CacheRebalanceMode.AS= YNC); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setWriteSynchronizationMode(CacheWrite= SynchronizationMode.FULL_SYNC); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setBackups(1); =C2=A0=C2=A0=C2=A0 Factory storeFactory =3D Facto= ryBuilder.factoryOf(IPV4RangeCacheDataLoader.class); =C2=A0=C2=A0=C2=A0 ipv4RangeCacheCfg.setCacheStoreFactory(storeFactory); =C2=A0=C2=A0=C2=A0 cfg.setCacheConfiguration(ipv4RangeCacheCfg); =C2=A0=C2=A0=C2=A0 return cfg; } =C2=A0 Thanks, Prasad =C2=A0 =C2=A0 =C2=A0 --_289D2D8A-26BB-4634-B633-603A8511B14F_ Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8"

Sorry, I wasn=E2=80= =99t completely correct. Persistence and CacheStore can work together, but = if cache configured with write-through or read-through modes enabled then d= ata consistency between Ignite persistence and CacheStore is not guaranteed= at all times, so such configurations are usually avoided. However, from wh= at you=E2=80=99re saying it seems that you don=E2=80=99t need write-through= or read-through, so it should work fine.

Your solution seems OK. If you only need a one-= time setup I guess you could also do it without a CacheStore and just get t= he data from Oracle and put it into Ignite via putAll or DataStreamer.=

 <= /span>

Thanks,=

Stan

 

<= p class=3DMsoNormal style=3D'border:none;padding:0cm'>From: Prasad Bhalerao
Sent: 21 =D1=84=D0=B5=D0=B2=D1=80=D0=B0=D0=BB=D1=8F 2018 =D0=B3. 14:33
To= : user@ignite.apache.org<= br>Subject: Re: Using 3rd party DB together with native persistence = (WAS: GettingInvalid state exception when Persistance is enabled.)

 

H= i Stan,

 

=

Thank you for the reply. I will send different questio= ns separately now onwards.

 

I do not understand what are you tr= ying to say ( "Ignite doesn=E2=80=99t support us= ing 3rd party DBs and native persistence with the same cache&quo= t; ) .

 

<= p class=3DMsoNormal>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/bac= ked in ignite native persistence store. 

 

I have enable th= e 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 store= d/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 metho= d. 

 

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 l= oaded in previous attempt so no need to call loadCache method.

I just wanted to know if there is any better solutio= n to achieve this.

 

=

 

Thanks,

Prasad

<= p class=3DMsoNormal> 

On Wed, = Feb 21, 2018 at 1:33 PM, Stanislav Lukyanov <stanlukyanov@gmail.com> wrote:

<= blockquote style=3D'border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm= 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-b= ottom:5.0pt'>

Hi Prasa= d,

 

<= p class=3DMsoNormal style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:= auto;margin-left:4.8pt'>// Please send different questio= ns separately =E2=80=93 this way it=E2=80=99s easier to answer and to searc= h for existing answers

 

> = Also, I am loading the cache from oracle table using loadCache method. If t= he persistence is enabled and if the data is already persisted, I want to m= ake 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=E2=80=99t support using 3rd pa= rty DBs and native persistence with the same cache.

If you need to use both, I=E2=80=99d suggest= to create two caches, one backed by Oracle and one with enabled Ignite per= sistence, and alternate between them in your application code.

 

Thanks,

Stan

 

From: = Prasa= d Bhalerao
Sent: 20 =D1=84=D0=B5=D0=B2=D1=80=D0=B0=D0=BB=D1= =8F 2018 =D0=B3. 15:24
To: user@ignite.apache.org
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 ex= ception.

 

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=3Dnull, cfg=3Dnull]

 

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 t= he cache from oracle table using loadCache method. If the persistence is en= abled and if the data is already persisted, I want to make sure that the ca= che is loaded from persisted data instead of loading it from oracle table u= sing loadCache. Can someone please advise how this can be achieved?

 

Code to config ignite and cache:

=  

@Bean
public Igni= teSpringBean igniteInstance() {
    IgniteSpringBean igni= te =3D
new = IgniteSpringBean();
 &n= bsp;  ignite.active(
true);<= /span>
   = ; ignite.setConfiguration(getIgniteConfiguration());

  &nb= sp;
return = ignite;
}

<= span style=3D'font-size:8.0pt;color:navy'>private IgniteConfiguration getIgniteConfiguration() = {

    String HOST =3D
"127.0.0.1:47500..47509";
    TcpDiscoveryVm= IpFinder ipFinder =3D
= new TcpDiscoveryVmIp= Finder();
    ipFinder.setAddresses(Collections.single= tonList(HOST));

    TcpDiscoverySpi discoSpi =3D =
new TcpDiscoverySpi();
  &nbs= p; discoSpi.setIpFinder(ipFinder);

    IgniteConfigur= ation cfg =3D
new IgniteConfiguration();    cfg.setDiscoverySpi(discoSpi);
    c= fg.setIgniteInstanceName(
"springDataNode");
    cfg.setPeerClassLoadingEnabled(
false
);
    cfg.setRebalanceThrea= dPoolSize(
4);

   DataSt= orageConfiguration storageCfg =3D
new DataStorageConfiguration();
    storageCfg.getDefaultD= ataRegionConfiguration().setPersistenceEnabled(
true);
    cfg.setDataStorageConfiguration(st= orageCfg);


&n= bsp;   CacheConfiguration<IPRangeDataKey, IPV4RangeData> ip= v4RangeCacheCfg =3D
ne= w CacheConfiguration= <>("IPV4Ra= ngeCache");
=     ipv4RangeCacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
  &nb= sp; ipv4RangeCacheCfg.setWriteThrough(
false);
    ipv4RangeCacheCfg.setReadThrough(
false);
    ipv4RangeCacheCfg.setRebalan= ceMode(CacheRebalanceMode.
ASYNC)= ;
    ipv4RangeCacheCfg.setWriteSynchronizationMode(Cache= WriteSynchronizationMode.
FULL_SYNC);
    ipv4RangeCacheCfg.setBackups(
1);
    Factory<IPV4RangeCacheDataLoader> s= toreFactory =3D FactoryBuilder.factoryOf(IPV4RangeCacheDataLoader.class);
    ipv4RangeCache= Cfg.setCacheStoreFactory(storeFactory);

    cfg.setCa= cheConfiguration(ipv4RangeCacheCfg);
   
return cfg;
}

 

Thanks,

=

Prasad

&nbs= p;

 

 

 

 

= --_289D2D8A-26BB-4634-B633-603A8511B14F_--