Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 6A830200D5B for ; Wed, 13 Dec 2017 14:48:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 69103160C23; Wed, 13 Dec 2017 13:48:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C3388160C16 for ; Wed, 13 Dec 2017 14:48:27 +0100 (CET) Received: (qmail 89836 invoked by uid 500); 13 Dec 2017 13:48:26 -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 89827 invoked by uid 99); 13 Dec 2017 13:48:26 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Dec 2017 13:48:26 +0000 Received: from mail-qt0-f173.google.com (mail-qt0-f173.google.com [209.85.216.173]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 4A22B1A0048 for ; Wed, 13 Dec 2017 13:48:24 +0000 (UTC) Received: by mail-qt0-f173.google.com with SMTP id u10so3726036qtg.2 for ; Wed, 13 Dec 2017 05:48:23 -0800 (PST) X-Gm-Message-State: AKGB3mIKgbnYjPJNevvvPE1jGQ7kpY0dJzTC0TqGhOGCIIi0T2jcf+28 QaOuFpjrYt3INJaZg6dB1uSswmaQ5ze5bY8GbRYU9w== X-Google-Smtp-Source: ACJfBos9XyqrWqGdOFCbuN3LsrANTt2VUsgyPQFRIyqxpNb1jCX+GIffMxDaEZN5xe1dHmQ4zTYjwjEPVHJDJCFvfqc= X-Received: by 10.237.59.74 with SMTP id q10mr10759034qte.254.1513172902465; Wed, 13 Dec 2017 05:48:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.59.184 with HTTP; Wed, 13 Dec 2017 05:48:21 -0800 (PST) In-Reply-To: References: From: Nikolai Tikhonov Date: Wed, 13 Dec 2017 16:48:21 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Ignite Cache Data Not Available in Other Server Nodes To: user@ignite.apache.org Content-Type: multipart/alternative; boundary="94eb2c1921e655e6dc0560390561" archived-at: Wed, 13 Dec 2017 13:48:30 -0000 --94eb2c1921e655e6dc0560390561 Content-Type: text/plain; charset="UTF-8" Cache API doesn't have method with this signature. Also I don't see sense to insert into cache the same entry many times. :) I think that you try to get entries that are not presented in the cache. Execute Scan Query [1] over the cache and look at what really the cache contains. 1. https://apacheignite.readme.io/docs/cache-queries#scan-queries On Tue, Dec 12, 2017 at 7:56 PM, Harshil garg wrote: > Here is the code Snippet which shows how we put data to the cache. > > public void method(argType arg){ > while (true){ > try(Transaction tx=ignite.transactions().txStart(TransactionConcurrency.OPTIMISTIC,TransactionIsolation.SERIALIZABLE)){ > workflowRunStateIgniteCache.put(arg); > tx.commit(); > }catch(TransactionOptimisticException e){ > System.out.println("Transaction failed. Retrying..."); > } > } > } > > > > On Tue, Dec 12, 2017 at 8:19 PM, Nikolai Tikhonov > wrote: > >> Can you share code snippet which shows how you put data to the cache? >> >> On Tue, Dec 12, 2017 at 12:26 PM, Harshil garg >> wrote: >> >>> Sorry , forgot to attach the xml used for configuring cache. >>> >>> >>> >>> >>> >>> >>> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>> xmlns:context="http://www.springframework.org/schema/context" >>> xsi:schemaLocation=" >>> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd >>> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> 127.0.0.1:47500..47509 >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> On Tue, Dec 12, 2017 at 2:55 PM, Harshil garg >>> wrote: >>> >>>> Hi Nikolai >>>> >>>> I haven't removed any data from other nodes. How data can be removed >>>> manually from cache manually ?? >>>> I have three cache deployed in Data Node which is configured using this >>>> below xml. >>>> >>>> I have data getting saved in workflowRunStateCache which I verified in >>>> web console. But when I am trying to access this cache from different >>>> server node , cache is coming completely empty . >>>> >>>> What could be the possible reasons ?? >>>> Need some solid inputs regarding the same. >>>> >>>> Any help will be highly appreciated. >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>> xmlns:context="http://www.springframework.org/schema/context" >>>> xsi:schemaLocation=" >>>> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd >>>> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> 127.0.0.1:47500..47509 >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> On Mon, Dec 11, 2017 at 8:29 PM, Nikolai Tikhonov >>> > wrote: >>>> >>>>> Hello! >>>>> >>>>> It looks weird for me. You should see the same data set from all nodes >>>>> of cluster. I think you or remove data from other nodes or performe an >>>>> operations under another cache. Can you share simple maven project which >>>>> reproduces the problem? >>>>> >>>>> On Mon, Dec 11, 2017 at 5:22 PM, Harshil garg >>>>> wrote: >>>>> >>>>>> I am trying to access ignite cache data from other nodes , I am able >>>>>> to access the ignite cache but cache is completely empty and hence throwing >>>>>> nullpointerException when I am trying to do cache.get(key). >>>>>> >>>>>> I have tried using both REPLICATED and PARTITONED MODE for >>>>>> workflowRunState Cache. >>>>>> >>>>>> Here is the xml configuration >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>>> xmlns:context="http://www.springframework.org/schema/context" >>>>>> xsi:schemaLocation=" >>>>>> http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd >>>>>> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> 127.0.0.1:47500..47509 >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> All these caches are deployed in Data Node. >>>>>> >>>>>> Now after doing some operations I had populated data in >>>>>> workflowRunstateCache which I verified in web console as well. >>>>>> >>>>>> But when I try to access the same cache from different server node , >>>>>> no data is available in that. In the following code I am trying to access >>>>>> workflowrunStateCache from different server node , it shows me that >>>>>> containsKey as false and thows NullpointerException in debug mode when I do >>>>>> workflowRunStateCache.get(); >>>>>> >>>>>> while (true) { >>>>>> try (Transaction tx = ignite.transactions().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE)) { >>>>>> System.out.println("Conatins Key" + workflowRunStateIgniteCache.containsKey(updatedKeys.get(0))); >>>>>> System.out.println("Conatins Key" + workflowRunStateIgniteCache); >>>>>> Boolean flowProcessable = updatedKeys.stream() >>>>>> // check if there is at least one event in each cache entry to be processed >>>>>> .map(updatedKey -> workflowRunStateIgniteCache.get(updatedKey).getFlowRunEvents().size() > 0) >>>>>> .reduce(true, (a, b) -> a && b).booleanValue(); >>>>>> >>>>>> List inputEvents = null; >>>>>> >>>>>> if (flowProcessable) { >>>>>> inputEvents = updatedKeys >>>>>> .stream() >>>>>> .map(updatedKey -> { >>>>>> try { >>>>>> return workflowRunStateIgniteCache.get(updatedKey).getFlowRunEvents().take(); >>>>>> } catch (InterruptedException e) { >>>>>> e.printStackTrace(); >>>>>> } >>>>>> return null; >>>>>> }).collect(Collectors.toList()); >>>>>> } >>>>>> >>>>>> tx.commit(); >>>>>> >>>>>> break; >>>>>> } catch (TransactionOptimisticException e) { >>>>>> // todo: emit a monitoring metric TRANSACTIONS_FAILED here >>>>>> System.out.println("Transaction failed. Retrying..."); >>>>>> } >>>>>> } >>>>>> >>>>>> System.out logs: >>>>>> >>>>>> Conatins Keyfalse >>>>>> >>>>>> >>>>> >>>> >>> >> > --94eb2c1921e655e6dc0560390561 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Cache API doesn't have method with this signature. Als= o I don't see sense to insert into cache the same entry many times. :)= =C2=A0
I think that you try to get entries that are not presented in th= e cache. Execute Scan Query [1] over the cache and look at what really the = cache contains.


On Tue, Dec 12, 2017 at 7:56 PM, Har= shil garg <harshilbits5@gmail.com> wrote:
Here is the code Snippet which shows = how we put data to the cache.

public void=
 method(argType arg){
w= hile (true){
= try(Transaction tx=3Dignite.tr= ansactions().txStart(TransactionConcurrency.OPTIMISTIC,TransactionIsolation.SERIALIZA= BLE)){
workflowRunStateIgniteCache.put(arg);
= tx.commit();
}catch(TransactionOptimisticException e){
System.out.println(&= quot;Transaction failed. Retrying...");
= }
}
}


On Tue, Dec 12, 2017 at 8:19 PM, Nikolai Tikhonov <ntikhonov@= apache.org> wrote:
Can you share code snippet which shows how you put data to the cac= he?

On Tue, Dec 12, 2017 at 12:26 PM, Harshil garg <harshilbits5@gmail.c= om> wrote:
Sorry , forgot to attach the xml used for configuring cache.

<?xml version=3D"= 1.0" encoding=3D<= span style=3D"color:rgb(106,135,89)">"UTF-8"?>

<!--
Licensed to the Apache Software Foun= dation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed wit= h
this work for addition= al information regarding copyright ownership.
The ASF licenses this file to You under the Apache Li= cense, Version 2.0
(the = "License"); you may not use this file except in compliance with the License. You may obt= ain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ag= reed to in writing, software
distributed under the License is distributed on an "AS IS" B= ASIS,
WITHOUT WARRANTIES= OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language go= verning permissions and
= limitations under the License.
-->

<!--
Ignite configuration with all defaults and enabled p2= p deployment and enabled events.
-->
<beans xmlns=3D"http://www.springframework.org/schema/beans= "
xmlns:
xsi=3D"http://www.w3.org/2001/XMLSchem= a-instance"
= xmlns:context=3D"http://www.springframework.org/schema/context"
x= si:schemaLocation=3D"
http://www.springframework.org/schema/beans= http://www.springframework.org/schema/beans/sprin= g-beans-3.2.xsd
= http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-conte= xt-3.2.xsd">=

<context:property-placehol= der location=3D"classpath:app.properties"
/>
<bean abstract=3D"true&q= uot; id=3D"ignite-data.cfg" class=3D"org.apache.ignite.configuration.IgniteConfiguration"<= /span>>
<!-- Set to true to enable distributed class loading for examples, de= fault is false. -->
= <property name=3D
"peerClassLoadingEnabled" value=3D&qu= ot;true"/>
=
<!--= Ignite predicate filter to separate data nodes from service nodes --> <property name=3D"userA= ttributes">
<map key-type=3D"java.lang.String" value-type=3D"= ;java.lang.Boolean"= >
<e= ntry key=3D"data.node" value=3D&q= uot;true"/>
</map>
= </property>
= <property name=3D"cacheConfiguration">
= <list>
= <bean class=3D"org.apache.ignite.configurat= ion.CacheConfiguration"&= gt;
<!-- Set a cache name. -->= ;
<property name=3D"name" value= =3D"${cache.workflow.name}"/>

= <!-- S= et cache mode. -->
= <property = name=3D"cacheMode" value=3D"= PARTITIONED"/>

<property name=3D&= quot;backups" value=3D"2"/>

= <property name=3D"statisticsEnabled" value=3D"true"/>

<property
= name=3D"nodeFilter">
= <bean class=3D= "com.mediaiq.caps.platfo<= wbr>rm.choreography.commons.filter.DataNodeFilter"/>
</property>
</bean>
<bean class=3D"org.apache.ignite.configuration.CacheConfiguration">
<!-- Set a cache name. -->
<property name=3D<= /span>"name" value=3D"${cache.workflow-run.name}"/>

<= /span> <!-- Set cache mode. -->
<property name=3D"c= acheMode" value=3D"REPLICATED"/>

= <!-- This is a tran= sactional cache as many keys need to be updated together -->
<= span style=3D"color:rgb(128,128,128)">
<property name=3D"atom= icityMode" value=3D"TRANSACTIONAL"/>

= <property name= =3D"backups" = value=3D"1"/>

<property name=3D
"statisticsEnabled" value=3D"tru= e"/>

<property name=3D"nodeF= ilter">
<bean class=3D"com.mediaiq.caps.platform.choreography.commons= .filter.DataNodeFilter"/>
= </property>
= </bean>
= <bean clas= s=3D"org.apache.ignite.co= nfiguration.CacheConfiguration">
= <!-- Set a cach= e name. -->
= <property = name=3D"name" value=3D"${cache.workflow-pause.= name}"/>
=

<!-- Set cache mode. -->
<property name=3D<= /span>"cacheMode" value=3D"PARTITIONED"/>

= <property name=3D"backups" value=3D"1&quo= t;/>

<property name=3D"statistics= Enabled" value=3D= "true"/>

= <property name=3D"nodeFilter"
>
<bean class=3D"com.= mediaiq.caps.platform.choreography.commons.filter.DataNodeFilter&= quot;/>
</property>
</bean> </list> </property> <!-- Explicitly configure TCP discovery SPI = to provide list of initial nodes. -->
<pr= operty name=3D"discoverySpi">
<bean clas= s=3D"org.apache.ignite.sp= i.discovery.tcp.TcpDiscoverySpi">
= <property name=3D<= /span>"ipFinder">
<!--
= Ignite provides several options for automatic discovery that can= be used
= instead os static IP based discovery. For information on all options= refer
= to our documentation: http://apacheignite.readme.io/docs/clu= ster-config
= -->
= <!-- Uncomment static IP finder to enable static-based discov= ery of initial nodes. -->
<!--<bean class=3D"org.apache.ignite.spi.= discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">--><= br> <bean class=3D&q= uot;org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDis= coveryMulticastIpFinder">
= <property name=3D<= /span>"addresses">
<list>
<!-- In distributed environment, replac= e with actual host IP address. -->
<value>127.0.0.1:47500..47509</value>
</list>
</property> </bea= n>

</property>
<= span style=3D"color:rgb(232,191,106)"> </bean>
<= span style=3D"color:rgb(232,191,106)"> </property>
<= span style=3D"color:rgb(232,191,106)"> </bean>
<bean parent=3D"i= gnite-data.cfg"/>
=
</beans>

On Tue, Dec 12, 201= 7 at 2:55 PM, Harshil garg <harshilbits5@gmail.com> wro= te:
Hi Nikolai

<= /div>
I haven't removed any data from other nodes. How data can be = removed manually from cache manually ??
I have three cache deploy= ed in Data Node which is configured using this below xml.

I have data getting saved in workflowRunStateCache which I verified= in web console. But when I am trying to access this cache from different s= erver node , cache is coming completely empty .

Wh= at could be the possible reasons ??
Need some solid inputs regard= ing the same.

Any help will be highly appreciated.=

<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreem= ents. See the NOTICE file distributed with
this work for additional information regarding copyrigh= t ownership.
The ASF lic= enses this file to You under the Apache License, Version 2.0
(the "License"); you may not= use this file except in compliance with
the License. You may obtain a copy of the License at
<= /span> http://www.apache.org/lic= enses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
<= /span> distributed under the Licens= e is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, eithe= r express or implied.
Se= e the License for the specific language governing permissions and
limitations under the License.-->

<!--
Ignite conf= iguration with all defaults and enabled p2p deployment and enabled events.<= br>-->
<beans xmlns=3D"http:/= /www.springframework.org/schema/beans"
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
<= span style=3D"color:rgb(106,135,89)">
xmlns:context<= /span>=3D"http://www.springframework.org/schema/context= "
xsi:schemaLocation=3D"
http://w= ww.springframework.org/schema/beans http://www= .springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframewo= rk.org/schema/context http://www.springfra= mework.org/schema/context/spring-context-3.2.xsd"= >

<= ;context:property-placeholder location=3D&= quot;classpath:app.properties"/>
<b= ean abstract=3D"true" id=3D"= ignite-data.cfg" class= =3D"org.apache.ignite.con= figuration.IgniteConfiguration">
<= /span><!-- Set to true to enable = distributed class loading for examples, default is false. -->
= <property name=3D"peerClassLoadin= gEnabled" value=3D"true"/>

<!-- Ignite predicate filter to sep= arate data nodes from service nodes -->
<= property name=3D"userAttributes">
<map k= ey-type=3D"java.lang.Stri= ng" value-type=3D= "java.lang.Boolean"<= span style=3D"color:rgb(232,191,106)">>
<entry key=3D"= ;data.node" value=3D"true"/>
</map>
</property>
<property n= ame=3D"cacheConfiguration= ">
<list>
<bean class=3D"org.apache.ignite.configuration.CacheConfiguration">
<!-- Set a cache name. -->
<property name= =3D"name" value=3D
"${cache.workflow.name}"/>

<!-- Set cache mode. -->
<property name=3D"cache= Mode" value=3D"PARTITIONED"
/>

= <property name=3D"backups" value=3D"2"/>
<property name=3D"statisticsEnabled" value=3D"true"= />

<property name=3D"nodeFilter= ">
<bean class=3D
"com.mediaiq.caps.platform.choreography.commons.filt= er.DataNodeFilter"/= >
&= lt;/property>
= </bean>
= <bean class=3D<= /span>"org.apache.ignite.configuration.CacheConfiguration">
= <!-- Set a cache nam= e. -->
= <property name=3D
"name" v= alue=3D"${cache.workflow-run.name= }"/>

<!-- Set cache mode. -->
&= lt;property name=3D"cacheMode" value=3D"REPLICATED"/= >

<!-- This is a transactional cache as many keys need= to be updated together -->
<= property name=3D"atomicityMode" value=3D"TRANSACTIONAL"/>

<property name=3D"backups" value=3D"1"
/>

= <property name=3D"statisticsEnable= d" value=3D"true"/>
<= br> <pr= operty name=3D"nodeFilter">
<bean class=3D"com.mediai= q.caps.platform.choreography.commons.filter.DataNodeFilter"<= /span>/>
</property>
</bean>
<bean class=3D
"org.apache.ignite.configuration.CacheConfiguratio= n">
<!-- Set a cache name. -->
<property name=3D"name" <= /span>value=3D"${cache.workflow-pause.name}"/>

= <!-- Set cache mode= . -->
= <property name=3D"cacheMode" value=3D"PARTITIONED&q= uot;/>

<property name=3D"backups&= quot; value=3D"1"/>

<propert= y name=3D"statisticsEnabled" value=3D"true"/>
<property name=3D"nodeFilter"&g= t;
= <bean class=3D"com.mediaiq.caps.platform.chor= eography.commons.filter.DataNodeFilter"
/>
= </property>
</bean>
</list>
</property>
<!= -- Explicitly configure TCP discovery SPI to provide list of initial nodes.= -->
<property
name=3D&qu= ot;discoverySpi">
=
<bean <= span style=3D"color:rgb(186,186,186)">class=3D"org.apache.ignite.spi.discovery.tcp.TcpDiscovery= Spi">
<property name=3D"ipFinder">
= <!--
Ignite provides severa= l options for automatic discovery that can be used
instead os static IP based= discovery. For information on all options refer
to our documentation: h= ttp://apacheignite.readme.io/docs/cluster-config
-->
<!-- Uncomment stat= ic IP finder to enable static-based discovery of initial nodes. -->
<= /span> <!--<= ;bean class=3D"org.apache.ignite.spi.discovery.tcp.ipfinder.vm.Tc= pDiscoveryVmIpFinder">-->
<bean class=3D"org.apache.ignite.spi.di= scovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"= ;>
<property name=3D
"addresses">
= <list>
= <!-- In distributed environment, replace with actual host IP address. = -->
= <value>
127.0.0.1:47500..47509</= value>
= </list>
= </property>
</bean>

= </property>
</bean>
</property>
</bean>
= <bean parent=3D<= span style=3D"color:rgb(106,135,89)">"ignite-data.cfg"/>
</beans>



On Mon, Dec 11, 2017 at 8:29 PM, Nikolai Tikhonov <= span dir=3D"ltr"><ntikhonov@apache.org> wrote:
Hello!

It looks weird for me. You= should see the same data set from all nodes of cluster. I think you or rem= ove data from other nodes or performe an operations under another cache. Ca= n you share simple maven project which reproduces the problem?
<= div class=3D"m_-1063793608634829335m_5449933023343702187m_-6360656628349678= 169m_1003620978704120346HOEnZb">

On Mon, Dec 11, 2017 at 5:22 PM= , Harshil garg <harshilbits5@gmail.com> wrote:
I am trying to access ignite cac= he data from other nodes , I am able to access the ignite cache but cache i= s completely empty and hence throwing nullpointerException when I am trying= to do cache.get(key).

I have tried using both REPLICATE= D and PARTITONED MODE for workflowRunState Cache.

= Here is the xml configuration

<=
?xml version=3D"1.0" encoding=3D&=
quot;UTF-8"?>

<!--
= Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.= See the NOTICE file distributed with
this work for additional information regarding copyright own= ership.
The ASF licenses= this file to You under the Apache License, Version 2.0
(the "License"); you may not use = this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses= /LICENSE-2.0
Un= less required by applicable law or agreed to in writing, software
distributed under the License is = distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either exp= ress or implied.
See the= License for the specific language governing permissions and
limitations under the License.
-->

&l= t;!--
Ignite configura= tion with all defaults and enabled p2p deployment and enabled events.
-->
<beans xmlns=3D"http://www.= springframework.org/schema/beans"
x= mlns:xsi=3D&q= uot;http://www.w3.org/2001/XMLSchema-instance"
xmlns:context= =3D"http://www.springframework.org/schema/context"
xsi
:schemaLocation=3D&q= uot;
http://www.spri= ngframework.org/schema/beans http://www.spring= framework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org<= wbr>/schema/context http://www.springframework.= org/schema/context/spring-context-3.2.xsd"
>

<context:property-placeholder location=3D"cl= asspath:app.properties"/>
<bean abstract=3D"true" id=3D"ignite-= data.cfg" class=3D"org.apache.ignite.configu= ration.IgniteConfiguration">
<!-- Set to true to enable distribut= ed class loading for examples, default is false. -->
<property name=3D= "peerClassLoadingEnabled&= quot; value=3D"true"/>
<!-- Ignite predicate filter to separate dat= a nodes from service nodes -->
<property = name=3D"userAttributes">
= <map key-type= =3D"java.lang.String"= ; value-type=3D"java.lang.Boolean">
<entry key=3D"data.n= ode" value=3D"true"
/>
</map>
= </property>
= <property name=3D<= /span>"cacheConfiguration"<= /span>>
<list>
<bean class=3D&qu= ot;org.apache.ignite.configuration.CacheConfiguration">
<!-- Set a cache name. -->
<property name=3D"name" value=3D"${cach= e.workflow.name}"/>

<!-- Set cache mode. -->
<property name=3D"cacheMode"= ; value=3D"PARTITIONED"/>

<= property name=3D"backups" value=3D"2"/>

<property name=3D&quo= t;statisticsEnabled" val= ue=3D"true"/>

= <property name= =3D"nodeFilter">
<bean class=3D"com.mediaiq.caps.platform.choreography.commons.filter.Dat= aNodeFilter"/>
</propert= y>
<= /bean>
= <bean class=3D"org.apache.ignite.configuration= .CacheConfiguration"
>=
<!-- Set a cache name. --> = <property name=3D= "name" value=3D"${cache.workflow-run.name}"<= /span>/>

= <!-- S= et cache mode. -->
= <property = name=3D"cacheMode" value=3D"= REPLICATED"/>

<!-- This is a transactional cache as many keys need to be updat= ed together -->
= <property name=3D"atomicityMode" value=3D"= ;TRANSACTIONAL"/>
=

<property name=3D"backups" value= =3D"1"/>

= <property name=3D"statisticsEnabled" value=3D"true"/>

= <property name=3D"nodeFilter">
= <bean clas= s=3D"com.mediaiq.caps.pla= tform.choreography.commons.filter.DataNodeFilter"/>
</property>
</bean>
<bean class=3D"org.apache.ignite.configuration.CacheConfiguration">
<!-- Set a cache name. -->
<property name= =3D"name" value=3D
"${cache.workflow-pause.name}"/>

<= /span><!-- Set cache mode. -->=
<property name=3D"cacheMode" value= =3D"PARTITIONED"/>

= <property name=3D"backups" value=3D"1"/>

<property name=3D"statisticsEnabled" value=3D&quo= t;true"/>
<= span style=3D"color:rgb(232,191,106)">
<property name=3D"= nodeFilter">
<bean <= /span>class=3D"com.mediaiq.caps.platform.choreography.co= mmons.filter.DataNodeFilter"/>
= </property>
</bean>
</list>
</property>
<!-- Explicit= ly configure TCP discovery SPI to provide list of initial nodes. -->
=
<property name=3D"discover= ySpi">
<bean
class=3D"org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"<= /span>>
<property name=3D"ipFinder">
=
<!--
Ignite provides several options = for automatic discovery that can be used
instead os static IP based discovery= . For information on all options refer
to our documentation: http://apac= heignite.readme.io/docs/cluster-config
-->
<!-- Uncomment static IP find= er to enable static-based discovery of initial nodes. -->
<!--<bean clas= s=3D"org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDisc= overyVmIpFinder">-->
<= ;bean class=3D"org.apache.ignite.spi.discovery.tc= p.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
<property name=3D"addresses"> = <list>
= <!-- In= distributed environment, replace with actual host IP address. -->
= <value>127.0.0.= 1:47500..47509</value> = </list>
= </property>
</bean>

= </property>
= </bean>
= </property>
&= lt;/bean>
<bean = parent=3D"ignite-data.cfg"/>
</beans>
All these caches are deployed in Data = Node.

Now after doing some operations I had popula= ted data in workflowRunstateCache which I verified in web console as well.<= /div>

But when I try to access the same cache from diffe= rent server node , no data is available in that. In the following code I am= trying to access workflowrunStateCache from different server node , it sho= ws me that containsKey as false and thows NullpointerException in debug mod= e when I do workflowRunStateCache.get();
while (true) {
try (Transaction tx =3D ignite.transacti= ons().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE)) {
System.out.println("Conatins Key" + workflowR= unStateIgniteCache.containsKey(updatedKeys.get(0)));
=
System.out.println("Conatins Key" + workflowRu= nStateIgniteCache);
Boolean flowProcessable =3D u= pdatedKeys.stream()
// check if there is at least one event in each cache entry to be proces= sed
.map(updatedKey -> workflowRunSt= ateIgniteCache.get(updatedKey).getFlowRunEvents().size() &= gt; 0)
.re= duce(true, (a, b) -> a && b).booleanValue();

List= <Event> inputEvents =3D null;
if (flowProcessable) {
i= nputEvents =3D updatedKeys
.stream()
= .map(updatedKey -> {
try {
return workflowRunStateIgniteCache.get(updatedKey).getFlowRunEv= ents().take();
} catch (InterruptedException e) {
= e.printStackTrace();
= }
return null;
= }).collect(Collectors.toL= ist());
}

tx.commit()<= span style=3D"color:rgb(204,120,50)">;

break;=
} catch (TransactionOptimisticExceptio= n e) {
// todo: emit a monitoring met= ric TRANSACTIONS_FAILED here
System.out.println("Transaction failed. Retrying...");
}
}
System.out logs:
Conatins Keyfalse






--94eb2c1921e655e6dc0560390561--