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 31965200C55 for ; Thu, 13 Apr 2017 08:35:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 30216160B98; Thu, 13 Apr 2017 06:35:09 +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 29E8D160B8B for ; Thu, 13 Apr 2017 08:35:08 +0200 (CEST) Received: (qmail 71340 invoked by uid 500); 13 Apr 2017 06:35:07 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 71328 invoked by uid 99); 13 Apr 2017 06:35:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Apr 2017 06:35:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 79AB8C07B0 for ; Thu, 13 Apr 2017 06:35:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.38 X-Spam-Level: *** X-Spam-Status: No, score=3.38 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, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd1-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 (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ZXRT5nJ7p9MY for ; Thu, 13 Apr 2017 06:35:04 +0000 (UTC) Received: from mail-yw0-f170.google.com (mail-yw0-f170.google.com [209.85.161.170]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 71E575FAD8 for ; Thu, 13 Apr 2017 06:35:03 +0000 (UTC) Received: by mail-yw0-f170.google.com with SMTP id l189so21208330ywb.0 for ; Wed, 12 Apr 2017 23:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=G4VCAG6zRbIQD6y7FGNmInoWL0+bIkT1hnY9Ix57Awk=; b=OPfMunmuOkVu5GaUVGdPUXcED5Xobr1/G3DTS3v5Kr2MfKHwNPHJQPQaf/1CapX6DO FNdq62JpDdQNTZQxU146Z1oKUg+CNgs3ClDnFxt95OKDweg7cQryfcQ43pcbIERWEbVd JUguwF7x8DjCbB7VW+AHD3OSh119x03i1nC+vMFOwF9gIggbdAbkYMmu1PCps5Kedrjj Zi948TLI0SkbZArXTFF52uk4S4eQCmqpx+gGmQQUsPfgA1WPHcDY/QSXaVOJdDbhX1Yb HsqhLUJ/3ngedrPt/H9UAn/geNxD83fDxLsj4ddo58NExxz8B6UOyrjMh6AeNGv5dPfq nHMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=G4VCAG6zRbIQD6y7FGNmInoWL0+bIkT1hnY9Ix57Awk=; b=TZa8RFgj/FOxxZzG0X0tJNFOfUL8tzn7x7a9vHIqCJbY2n3Qe9Gkz045GZTEP6WFNP gTTQGgmt5WH8ANFezi01NDj9ozPE+Lf1KB3dPoiWxnHKi20zK/Mw6theYd2azIcJ0V42 EJoFKBgN5ynDHKR6T5YSzQxpi5p16peZlk71EzebAeKvPnehhJqh04gfRLaPVJRA7+fi Br7xaO7PzCtRir5R35+K1+PWEqolPdqifPagjG/VutgoH1XwOHFKx1YhxlgusZUHnp8e 6uHFmEwsjWPFRzPWjMVVtzQzerq9apR0JtTonutjKnNMTWJnP/1JWgP7S6CcYrU9qJfx kRgA== X-Gm-Message-State: AN3rC/67VQoHsEf4nnXYhjoMHt/ZIp1h/7lkUTYBIe1dS4abzSBR7+is 1LUSiVplX0fbvu0bBkjOzmDywZEq6ksY8KM= X-Received: by 10.129.198.2 with SMTP id l2mr1036805ywi.260.1492065302342; Wed, 12 Apr 2017 23:35:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.220.131 with HTTP; Wed, 12 Apr 2017 23:34:21 -0700 (PDT) In-Reply-To: References: <9EB58B66-8FE8-4B9C-9253-BBE7D5EF835D@apache.org> <7226F351-452F-4ECF-B228-FEB4EBF0A635@apache.org> From: Sergi Vladykin Date: Thu, 13 Apr 2017 09:34:21 +0300 Message-ID: Subject: Re: SQL on PARTITIONED vs REPLICATED cache To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=94eb2c1a2d6c53f4c2054d0686f8 archived-at: Thu, 13 Apr 2017 06:35:09 -0000 --94eb2c1a2d6c53f4c2054d0686f8 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Yes, it is a correct explanation. I've created the issue https://issues.apache.org/jira/browse/IGNITE-4955 Sergi 2017-04-13 0:25 GMT+03:00 Dmitriy Setrakyan : > Got it, Denis. I think you are right. > > On Wed, Apr 12, 2017 at 2:20 PM, Denis Magda wrote: > > > Dmitriy, > > > > No, I think that Sergi supposed a type of cache which reference is used > > for a query execution. In my example > > > > >> 2. Error-prone scenario - *replicatedCache*.query(=E2=80=9CSELECT * = FROM > > >> partitionedCache =E2=80=A6 JOIN replicatedCache =E2=80=A6=E2=80=9D); > > > > *replicatedCache* reference is used for the query execution and, as I > > understand, this causes the issue. > > > > Sergi, please clarify. > > > > =E2=80=94 > > Denis > > > > > On Apr 12, 2017, at 1:51 PM, Dmitriy Setrakyan > > wrote: > > > > > > Denis, I think that you meant selecting from replicated cache first a= s > an > > > invalid scenario, but provided the wrong example. Here is the correct > > > example for the invalid query: > > > > > > SELECT * FROM replicatedCache =E2=80=A6 JOIN partitionedCache =E2=80= =A6=E2=80=9D > > > > > > I do agree, we should make the change, as long as we keep the flag to > > > enable the old behavior. > > > > > > D. > > > > > > On Wed, Apr 12, 2017 at 12:50 PM, Denis Magda > wrote: > > > > > >> Sergi, > > >> > > >> As far as I understand you=E2=80=99re considering an example below: > > >> > > >> IgniteCache partitioneCache =3D ...; > > >> IgniteCache replicatedCache =3D =E2=80=A6; > > >> > > >> 1. Valid scenario - *partitionedCache*.query(=E2=80=9CSELECT * FROM > > >> partitionedCache =E2=80=A6 JOIN replicatedCache =E2=80=A6=E2=80=9D); > > >> 2. Error-prone scenario - *replicatedCache*.query(=E2=80=9CSELECT * = FROM > > >> partitionedCache =E2=80=A6 JOIN replicatedCache =E2=80=A6=E2=80=9D); > > >> > > >> Do you mean 2. as the issue? If it=E2=80=99s so then can=E2=80=99t w= e just detect on > our > > >> own that all the caches are replicated and execute a query more > optimal? > > >> This should omit necessity to add isReplicatedOnly()? > > >> > > >> =E2=80=94 > > >> Denis > > >> > > >>> On Apr 12, 2017, at 7:07 AM, Andrey Mashenkov < > > >> andrey.mashenkov@gmail.com> wrote: > > >>> > > >>> Yes, it's reasonable. > > >>> > > >>> On Wed, Apr 12, 2017 at 3:23 PM, Sergi Vladykin < > > >> sergi.vladykin@gmail.com> > > >>> wrote: > > >>> > > >>>> Good point, but I'm not sure. The difference is that on client nod= e > > you > > >>>> should not be able to enable isLocal, while isReplicatedOnly is > > >> perfectly > > >>>> valid. What do you think? > > >>>> > > >>>> Sergi > > >>>> > > >>>> 2017-04-12 15:18 GMT+03:00 Andrey Mashenkov < > > andrey.mashenkov@gmail.com > > >>> : > > >>>> > > >>>>> Sergi, > > >>>>> > > >>>>> Got it. > > >>>>> > > >>>>> Does query execution way and results will be same for > > isReplicatedOnly > > >>>> flag > > >>>>> and for isLocal flag turned on? > > >>>>> If my understanding is correct, we will get same results and ther= e > is > > >> no > > >>>>> need to introduce a new flag. > > >>>>> > > >>>>> > > >>>>> > > >>>>> On Wed, Apr 12, 2017 at 2:54 PM, Sergi Vladykin < > > >>>> sergi.vladykin@gmail.com> > > >>>>> wrote: > > >>>>> > > >>>>>> Ok, let it be an exception. I'm just saying that the thing does > not > > >>>> work > > >>>>>> now. > > >>>>>> > > >>>>>> Sergi > > >>>>>> > > >>>>>> 2017-04-12 14:50 GMT+03:00 Andrey Mashenkov < > > >>>> andrey.mashenkov@gmail.com > > >>>>>> : > > >>>>>> > > >>>>>>> Sergi, > > >>>>>>> > > >>>>>>> I wounder how it is possible? > > >>>>>>> > > >>>>>>> Looks like it is impossible to run query on replicated cache, b= ut > > >>>>> select > > >>>>>>> data from a > > >>>>>>> partitioned table. It will result with IlleagalStateException o= n > > >>>> stable > > >>>>>>> topology or > > >>>>>>> IgniteCacheException on unstable topology. > > >>>>>>> See ReduceQueryExecutor.stableDataNodes() and > > >>>>>>> replicatedUnstableDataNodes() > > >>>>>>> methods. > > >>>>>>> > > >>>>>>> BTW, IlleagalStateException with no message is confusing. > > >>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> On Wed, Apr 12, 2017 at 2:36 PM, Sergi Vladykin < > > >>>>>> sergi.vladykin@gmail.com> > > >>>>>>> wrote: > > >>>>>>> > > >>>>>>>> Andrey, > > >>>>>>>> > > >>>>>>>> Because if you run query on replicated cache, but select data > from > > >>>> a > > >>>>>>>> partitioned table, you will get only a part of the result. > > >>>>>>>> > > >>>>>>>> Igor, > > >>>>>>>> > > >>>>>>>> You are mostly right, but > > >>>>>>>> > > >>>>>>>> 1. Performance characteristics may change. > > >>>>>>>> 2. Ignite SQL processing pipeline may not support all the stuf= f > in > > >>>> H2 > > >>>>>> SQL > > >>>>>>>> and fail in some case where it worked previously. > > >>>>>>>> > > >>>>>>>> Because of this the change may affect existing applications an= d > I > > >>>>> want > > >>>>>> to > > >>>>>>>> have it in 2.0 to make it legal. > > >>>>>>>> > > >>>>>>>> Sergi > > >>>>>>>> > > >>>>>>>> 2017-04-12 14:10 GMT+03:00 Igor Sapego : > > >>>>>>>> > > >>>>>>>>> Also, is it really a breaking change if the results are wrong= ? > > >>>>>>>>> To me it looks more like a bugfix, i.e. you can't break > something > > >>>>>>>>> that does not work properly. > > >>>>>>>>> > > >>>>>>>>> Best Regards, > > >>>>>>>>> Igor > > >>>>>>>>> > > >>>>>>>>> On Wed, Apr 12, 2017 at 2:04 PM, Andrey Mashenkov < > > >>>>>>>>> andrey.mashenkov@gmail.com> wrote: > > >>>>>>>>> > > >>>>>>>>>> Sergi, > > >>>>>>>>>> > > >>>>>>>>>> How can query to replicated cache leads to to wrong results? > > >>>>>>>>>> Is it due to we can read backup entries? > > >>>>>>>>>> > > >>>>>>>>>> On Wed, Apr 12, 2017 at 12:31 PM, Sergi Vladykin < > > >>>>>>>>> sergi.vladykin@gmail.com > > >>>>>>>>>>> > > >>>>>>>>>> wrote: > > >>>>>>>>>> > > >>>>>>>>>>> Guys, > > >>>>>>>>>>> > > >>>>>>>>>>> I want to introduce another breaking change for 2.0. > > >>>>>>>>>>> > > >>>>>>>>>>> Currently SQL is being processed differently when we call > > >>>>> method > > >>>>>>>>> `query` > > >>>>>>>>>> on > > >>>>>>>>>>> partitioned cache and on replicated: on replicated cache we > > >>>> do > > >>>>>> not > > >>>>>>> do > > >>>>>>>>> any > > >>>>>>>>>>> extra processing and execute the query as is on current nod= e. > > >>>>>>>>>>> > > >>>>>>>>>>> This behavior historically existed for performance reasons. > > >>>> But > > >>>>>> it > > >>>>>>> is > > >>>>>>>>> not > > >>>>>>>>>>> obvious and leads to wrong query results. This issue become= s > > >>>>> even > > >>>>>>>> more > > >>>>>>>>>>> creepy with JDBC and ODBC drivers. > > >>>>>>>>>>> > > >>>>>>>>>>> In 2.0 I want to execute all the SQL queries the same way > > >>>>> through > > >>>>>>> the > > >>>>>>>>>> whole > > >>>>>>>>>>> processing pipeline to guaranty the correct result > > >>>>> irrespectively > > >>>>>>> to > > >>>>>>>>> the > > >>>>>>>>>>> cache that was the query originator. > > >>>>>>>>>>> > > >>>>>>>>>>> To be able to have the old behavior (skip all the > > >>>> preprocessing > > >>>>>> and > > >>>>>>>> run > > >>>>>>>>>>> query on current node) add a flag isReplicatedOnly() on > > >>>>> SqlQuery > > >>>>>>> and > > >>>>>>>>>>> SqlFieldsQuery. It will be disabled by default and if one > > >>>> knows > > >>>>>>> that > > >>>>>>>>> the > > >>>>>>>>>>> only replicated tables participate in a query, then he can > > >>>>> enable > > >>>>>>> it > > >>>>>>>>> for > > >>>>>>>>>>> better performance. > > >>>>>>>>>>> > > >>>>>>>>>>> Sergi > > >>>>>>>>>>> > > >>>>>>>>>> > > >>>>>>>>>> > > >>>>>>>>>> > > >>>>>>>>>> -- > > >>>>>>>>>> Best regards, > > >>>>>>>>>> Andrey V. Mashenkov > > >>>>>>>>>> > > >>>>>>>>> > > >>>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> > > >>>>>>> -- > > >>>>>>> Best regards, > > >>>>>>> Andrey V. Mashenkov > > >>>>>>> > > >>>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> -- > > >>>>> Best regards, > > >>>>> Andrey V. Mashenkov > > >>>>> > > >>>> > > >>> > > >>> > > >>> > > >>> -- > > >>> Best regards, > > >>> Andrey V. Mashenkov > > >> > > >> > > > > > --94eb2c1a2d6c53f4c2054d0686f8--