Return-Path: X-Original-To: apmail-ignite-user-archive@minotaur.apache.org Delivered-To: apmail-ignite-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 057E218D92 for ; Tue, 12 Jan 2016 06:53:31 +0000 (UTC) Received: (qmail 53148 invoked by uid 500); 12 Jan 2016 06:53:30 -0000 Delivered-To: apmail-ignite-user-archive@ignite.apache.org Received: (qmail 53083 invoked by uid 500); 12 Jan 2016 06:53:30 -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 53071 invoked by uid 99); 12 Jan 2016 06:53:30 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jan 2016 06:53:30 +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 D096C180425 for ; Tue, 12 Jan 2016 06:53:29 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.1 X-Spam-Level: **** X-Spam-Status: No, score=4.1 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, KAM_LINEPADDING=1.2, SPF_PASS=-0.001, URIBL_BLOCKED=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-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id MLH9tmmpIF45 for ; Tue, 12 Jan 2016 06:53:20 +0000 (UTC) Received: from mail-qg0-f44.google.com (mail-qg0-f44.google.com [209.85.192.44]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 0475243BFE for ; Tue, 12 Jan 2016 06:53:20 +0000 (UTC) Received: by mail-qg0-f44.google.com with SMTP id o11so421944219qge.2 for ; Mon, 11 Jan 2016 22:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=XgPaKfdtZbbGP0jMjGjsxqwJbWXIBwk12KSAa8zX2aM=; b=pHCvAIjF6u/n1uQyKoEUEWMVTZZB7/ywy2IJO8iATb8u76NcXME6HLlKQNczTQeAVZ DcjY0knwpJCVN69mbC6F3pnojadYTyDLJ9ynqQxl56pBuOuWmrht++xXvjVz/3uzUHWk 1CfdZW257pYeWSG7nJK9+IEWbp1DjvpYh2pSuNSVBGjgmI7RPBQjZjTEl3ZXHCrA0nAW N2ovJNW0arZiu51PYXnzWG2t3IDItI6vrg2Usu8npUfPVS+3EwLIHKH+aHxHZM4ZiKbU GVay4MdfBuisIwh3wx0VHiVNwuQifejm65APuPdcVjq8NlQXLyR+rB2JD2+M6z7nv0n/ NtJg== MIME-Version: 1.0 X-Received: by 10.140.18.115 with SMTP id 106mr171012101qge.34.1452581599775; Mon, 11 Jan 2016 22:53:19 -0800 (PST) Received: by 10.140.25.195 with HTTP; Mon, 11 Jan 2016 22:53:19 -0800 (PST) In-Reply-To: <1452580195206-2509.post@n6.nabble.com> References: <1452580195206-2509.post@n6.nabble.com> Date: Mon, 11 Jan 2016 22:53:19 -0800 Message-ID: Subject: Re: SQL Query returns no value if different values put twice with same key From: Valentin Kulichenko To: user@ignite.apache.org Content-Type: multipart/alternative; boundary=001a11c015364311e105291d82db --001a11c015364311e105291d82db Content-Type: text/plain; charset=UTF-8 Vinay, The last put operation updates Person with key '2' and changes its 'id' field value to '3'. As a result, there are no persons with id=2 and SQL query, which selects by this condition, returns empty result. Test query is based on 'personName' field which is not changed, therefore result of the query does not change as well. As for error in 1.5.0, you definitely still have 1.4 node(s) running somewhere. Please double-check Java processes of your computer and other computers in the same network if there are any. -Val On Mon, Jan 11, 2016 at 10:29 PM, vinshar wrote: > Hi, > > Below is a test code for a behavior i noticed. Below code returns nothing > for SQL query if i add a entry twice on cache. I tested this with 1.4 > version. > > problem 1:- For below code, SQL query returns no result where as text query > does. If i comment 3rd put comment then both SQL and text queries return > result. Text query returns 1 value both times. > > Problem 2:- If i enable client mode i see ClassNotFound exception for > Person > class in server node logs. This appears even if peerClassLoading is true on > both client and server. > > problem 3:- If i upgrade POM to use version 1.5.0.final then i get > following > error even though client node is false and there is no other node running > on > my local machine. > > /Caused by: class org.apache.ignite.spi.IgniteSpiException: Local node and > remote node have different version numbers (node will not join, Ignite does > not support rolling updates, so versions must be exactly the same)/ > > public static void main(String[] args) throws Exception { > class Person implements Serializable { > /** > * > */ > private static final long serialVersionUID = 1L; > > @QuerySqlField(index = true) > private int id; > > @QueryTextField > private String personName; > > public Person(int personId, String personName) { > super(); > this.id = personId; > this.personName = personName; > } > > public int getId() { > return id; > } > > public void setId(int personId) { > this.id = personId; > } > > public String getPersonName() { > return personName; > } > > public void setPersonName(String personName) { > this.personName = personName; > } > > } > > Ignite ignite = Ignition.start(new > > IgniteConfiguration().setClientMode(false).setPeerClassLoadingEnabled(true)); > > CacheConfiguration config = new > CacheConfiguration<>(); > config.setName("PROBLEM"); > config.setIndexedTypes(Integer.class, Person.class); > IgniteCache cache = ignite.createCache(config); > > cache.put(1, new Person(1,"test1")); > cache.put(2, new Person(2,"test2")); > cache.put(2, new Person(3,"test2")); > > SqlQuery sql = new > SqlQuery<>(Person.class, "from Person > where id = 2"); > TextQuery text = new > TextQuery<>(Person.class, "test2"); > > > System.out.println("##################################################################"); > System.out.println(cache.get(2)); > System.out.println(cache.query(sql).getAll()); > System.out.println(cache.query(text).getAll()); > > > System.out.println("##################################################################3"); > > } > > > > > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/SQL-Query-returns-no-value-if-different-values-put-twice-with-same-key-tp2509.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. > --001a11c015364311e105291d82db Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Vinay,

The last put operation updates P= erson with key '2' and changes its 'id' field value to '= ;3'. As a result, there are no persons with id=3D2 and SQL query, which= selects by this condition, returns empty result. Test query is based on &#= 39;personName' field which is not changed, therefore result of the quer= y does not change as well.

As for error in=C2=A01.5.0, you=C2=A0definitely=C2=A0still have 1= .4 node(s) running somewhere. Please double-check Java processes of your co= mputer and other computers in the same network if there are any.

-Val
On Mon, Jan 11, 2016 at 10:29 PM, vinshar <vinsharma.tech@gmail.com> wrote:
Hi,

Below is a test code for a behavior i noticed. Below code returns nothing for SQL query if i add a entry twice on cache. I tested this with 1.4
version.

problem 1:- For below code, SQL query returns no result where as text query=
does. If i comment 3rd put comment then both SQL and text queries return result. Text query returns 1 value both times.

Problem 2:- If i enable client mode i see ClassNotFound exception for Perso= n
class in server node logs. This appears even if peerClassLoading is true on=
both client and server.

problem 3:- If i upgrade POM to use version 1.5.0.final then i get followin= g
error even though client node is false and there is no other node running o= n
my local machine.

/Caused by: class org.apache.ignite.spi.IgniteSpiException: Local node and<= br> remote node have different version numbers (node will not join, Ignite does=
not support rolling updates, so versions must be exactly the same)/

=C2=A0 =C2=A0 =C2=A0 =C2=A0 public static void main(String[] args) throws E= xception {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 class Person implem= ents Serializable {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 /**
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0*
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0*/
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 private static final long serialVersionUID =3D 1L;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 @QuerySqlField(index =3D true)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 private int id;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 @QueryTextField
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 private String personName;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 public Person(int personId, String personName) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 super();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this.id =3D personId;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this.personName =3D personName;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 public int getId() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return id;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 public void setId(int personId) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this.id =3D personId;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 public String getPersonName() {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return personName;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 public void setPersonName(String personName) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this.personName =3D personName;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ignite ignite =3D I= gnition.start(new
IgniteConfiguration().setClientMode(false).setPeerClassLoadingEnabled(true)= );

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CacheConfiguration&= lt;Integer, Person> config =3D new CacheConfiguration<>();
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 config.setName(&quo= t;PROBLEM");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 config.setIndexedTy= pes(Integer.class, Person.class);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 IgniteCache cache = =3D ignite.createCache(config);

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cache.put(1, new Pe= rson(1,"test1"));
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cache.put(2, new Pe= rson(2,"test2"));
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cache.put(2, new Pe= rson(3,"test2"));

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SqlQuery<Integer= , Person> sql =3D new SqlQuery<>(Person.class, "from Person where id =3D 2");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TextQuery<Intege= r, Person> text =3D new TextQuery<>(Person.class, "test2"= ;);

System.out.println("##################################################= ################");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 System.out.println(= cache.get(2));
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 System.out.println(= cache.query(sql).getAll());
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 System.out.println(= cache.query(text).getAll());

System.out.println("##################################################= ################3");

=C2=A0 =C2=A0 =C2=A0 =C2=A0 }







--
View this message in context: http://apache-ig= nite-users.70518.x6.nabble.com/SQL-Query-returns-no-value-if-different-valu= es-put-twice-with-same-key-tp2509.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

--001a11c015364311e105291d82db--