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 B15D2200C54 for ; Wed, 12 Apr 2017 22:52:21 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id AFC76160B95; Wed, 12 Apr 2017 20:52:21 +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 019A0160B85 for ; Wed, 12 Apr 2017 22:52:20 +0200 (CEST) Received: (qmail 19578 invoked by uid 500); 12 Apr 2017 20:52:20 -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 19566 invoked by uid 99); 12 Apr 2017 20:52:20 -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, 12 Apr 2017 20:52:20 +0000 Received: from mail-qk0-f182.google.com (mail-qk0-f182.google.com [209.85.220.182]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id BE0F11A036B for ; Wed, 12 Apr 2017 20:52:19 +0000 (UTC) Received: by mail-qk0-f182.google.com with SMTP id h67so33881688qke.0 for ; Wed, 12 Apr 2017 13:52:19 -0700 (PDT) X-Gm-Message-State: AFeK/H2m7qpcvK+BDTTgeA8/uyJDW5NA4mjxo9vyof5Y4wtsUTZUsaMtXOB53jAMcLQfzLBSEDXwzMsRLI2WUiA5 X-Received: by 10.55.115.67 with SMTP id o64mr68101071qkc.215.1492030338858; Wed, 12 Apr 2017 13:52:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.52.243 with HTTP; Wed, 12 Apr 2017 13:51:38 -0700 (PDT) In-Reply-To: <9EB58B66-8FE8-4B9C-9253-BBE7D5EF835D@apache.org> References: <9EB58B66-8FE8-4B9C-9253-BBE7D5EF835D@apache.org> From: Dmitriy Setrakyan Date: Wed, 12 Apr 2017 13:51:38 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: SQL on PARTITIONED vs REPLICATED cache To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=001a114ff3b6579b84054cfe62d3 archived-at: Wed, 12 Apr 2017 20:52:21 -0000 --001a114ff3b6579b84054cfe62d3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Denis, I think that you meant selecting from replicated cache first as 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 we jus= t 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 node yo= u > >> 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 >: > >> > >>> Sergi, > >>> > >>> Got it. > >>> > >>> Does query execution way and results will be same for isReplicatedOnl= y > >> flag > >>> and for isLocal flag turned on? > >>> If my understanding is correct, we will get same results and there 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, but > >>> select > >>>>> data from a > >>>>> partitioned table. It will result with IlleagalStateException on > >> 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 stuff in > >> H2 > >>>> SQL > >>>>>> and fail in some case where it worked previously. > >>>>>> > >>>>>> Because of this the change may affect existing applications and 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 node. > >>>>>>>>> > >>>>>>>>> This behavior historically existed for performance reasons. > >> But > >>>> it > >>>>> is > >>>>>>> not > >>>>>>>>> obvious and leads to wrong query results. This issue becomes > >>> 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 > > --001a114ff3b6579b84054cfe62d3--