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 5D390200D0E for ; Tue, 12 Sep 2017 00:29:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5BD541609C5; Mon, 11 Sep 2017 22:29:27 +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 50DE61609C4 for ; Tue, 12 Sep 2017 00:29:26 +0200 (CEST) Received: (qmail 43887 invoked by uid 500); 11 Sep 2017 22:29:24 -0000 Mailing-List: contact dev-help@geode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.apache.org Delivered-To: mailing list dev@geode.apache.org Received: (qmail 43875 invoked by uid 99); 11 Sep 2017 22:29:23 -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; Mon, 11 Sep 2017 22:29:23 +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 165BAC6A2B for ; Mon, 11 Sep 2017 22:29:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.48 X-Spam-Level: ** X-Spam-Status: No, score=2.48 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.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] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=pivotal-io.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id YNwEKnXbpXlC for ; Mon, 11 Sep 2017 22:29:20 +0000 (UTC) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com [209.85.214.49]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id E593D5FCB9 for ; Mon, 11 Sep 2017 22:29:19 +0000 (UTC) Received: by mail-it0-f49.google.com with SMTP id v19so18928713ite.0 for ; Mon, 11 Sep 2017 15:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pivotal-io.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=rJn2y0BSm79mPtAtDCsWSnncVL2oIiDuizFp4dMI0fA=; b=Z69/CkXZov73vIKk7SkKuXh6gOdQ4JzLVV4sOySZkyb26aTHcJztpHjop1/9Tzt9WT FSpT9v9txR+9aagFVeSp/Qd4e/svJvcUsewWSDqmPlkBQQsdw/F8dJ0VbNVPHTyT5IFL QLuDK6glpsMLq4YIPyk966bsJmuMLyyXoP73Bz4Junq8qL2gv7x+AXou9kGpPAQSpE3Y bMrLCC37NoIfwO30WA9w7W+XXgU109upYdWIkm3mhAgxJvhIIFnUZvlGioNSm+ZiS5uf TH9EocbkdgwkSnrIairEi1bM4IsM6ZNHeHNXqPY/LY7Ebf43YjqHfajV248he6giXXvf VVuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=rJn2y0BSm79mPtAtDCsWSnncVL2oIiDuizFp4dMI0fA=; b=M5I6LB7nTO33ChH5sY6+lj3eeRp5zprPWtdU2S/Bz54P9zdPy7GuTISObpFU6BYKMh FQRdmu1lfdqFMqmzdyVXPH8TY+exJNBf0smh5SjFc8eX+NdX55ya/d97MBuK8obXiOvX YVkQt1yvGw/T1VjXCnAAvtCX3BsobPBh++ZS/rXXLNBkIVEM7KVaw4iQEHWz/Xr/i037 7NiuaHavl+RKW7wfB4TJvC40bf9nxV5iMOrfAUlBrJ+yXCRUlnyS2Vj7IVy6gJFXmZS0 6XnQHJ7GdFdqEfIntYuwy6IVZkHXJCWXOTJOVdD8xHM0YxRJTcrbygiB3BB7YmJlr7xh 26/w== X-Gm-Message-State: AHPjjUizT3sc9AD4IMFolmw5bzlfJa/qBoa2F7Zs8PvNx2ZykqYTrAmb 7VXfM8s8qqqpN2o6aJoIX8QpIWOKc317 X-Google-Smtp-Source: AOwi7QDfr1CYtxAaZFa3B8a8HjDnC1pZ7HdvEqVWNzTcCeecV85dN7s4TCKCBYZJR+NJcNRRbQmkpEuVc5ivukmTwUw= X-Received: by 10.36.69.166 with SMTP id c38mr15678860itd.0.1505168958967; Mon, 11 Sep 2017 15:29:18 -0700 (PDT) MIME-Version: 1.0 References: <808F6671-642A-4671-9F07-534D5C25F78D@pivotal.io> In-Reply-To: From: Jason Huynh Date: Mon, 11 Sep 2017 22:29:08 +0000 Message-ID: Subject: Re: [DISCUSS] Addition of isValid API to Index interface To: dev@geode.apache.org Content-Type: multipart/alternative; boundary="001a11445ed4206e7f0558f175e6" archived-at: Mon, 11 Sep 2017 22:29:27 -0000 --001a11445ed4206e7f0558f175e6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Anil, we actually do have a case where the index is out of sync with the region currently. It's just not likely to happen but if there is an exception from an index, the end result is that certain indexes get updated and the region has already been updated. However the exception is thrown back to the putter, so it becomes very obvious something is wrong but I believe Naba has updated the ticket to show a test that reproduces the problem... On Mon, Sep 11, 2017 at 2:50 PM Anilkumar Gingade wrote: > The other way to look at it is; what happens to a cache op; when there is > an exception after Region.Entry is created? can it happen? In that case, = do > we stick the entry into the Cache or not? If an exception is handled, how > is it done, can we look at using the same for Index... > > Also previously, once the valid index is created (verified during create = or > first put into the cache); we never had any issue where index is out of > sync with cache...If that changes with new futures (security?) then we ma= y > have to change the expectation with indexing... > > -Anil. > > > > On Mon, Sep 11, 2017 at 2:16 PM, Anthony Baker wrote: > > > I=E2=80=99m confused. Once a cache update has been distributed to othe= r members > > it can=E2=80=99t be undone. That update could have triggered myriad ot= her > > application behaviors. > > > > Anthony > > > > > On Sep 11, 2017, at 2:04 PM, Michael Stolz wrote: > > > > > > Great, that's exactly the behavior I would expect. > > > > > > Thanks. > > > > > > -- > > > Mike Stolz > > > Principal Engineer, GemFire Product Manager > > > Mobile: +1-631-835-4771 <(631)%20835-4771> > > > > > > On Mon, Sep 11, 2017 at 4:34 PM, Jason Huynh > wrote: > > > > > >> Hi Mike, I think the concern was less about the security portion but > > rather > > >> if any exception occurs during index update, right now, the region > gets > > >> updated and the rest of the system (index/wan/callbacks) may or may > not > > be > > >> updated. I think Naba just tried to provide an example where this > might > > >> occur, but that specific scenario is invalid. > > >> > > >> I believe Nabarun has opened a ticket for rolling back the put > operation > > >> when an index exception occurs. GEODE-3589. It can probably be > > modified to > > >> state any exception instead of index exceptions. > > >> > > >> To summarize my understanding: > > >> -Someone will need to implement the rollback for GEODE-3589. This > means > > >> that if any exception occurs during a put, geode it will propagate > back > > to > > >> the user and it is expected the rollback mechanism will clean up any > > >> partial put. > > >> > > >> GEODE-3520 should be modified to: > > >> -Add the isValid() api to index interface > > >> -Mark an index as invalid during async index updates but not for > > >> synchronous index updates. The synchronous index updates will rely > on a > > >> rollback mechanism > > >> > > >> > > >> > > >> > > >> On Mon, Sep 11, 2017 at 1:23 PM Michael Stolz > > wrote: > > >> > > >>> I think there was an intention of having CREATION of an index > require a > > >>> higher privilege than DATA:WRITE, but it shouldn't affect applying > the > > >>> index on either of put or get operations. > > >>> > > >>> If we are requiring something like CLUSTER:MANAGE for put on an > indexed > > >>> region, that is an incorrect requirement. Only DATA:WRITE should be > > >>> required to put an entry and have it be indexed if an index is > present. > > >>> > > >>> -- > > >>> Mike Stolz > > >>> Principal Engineer, GemFire Product Manager > > >>> Mobile: +1-631-835-4771 <(631)%20835-4771> <(631)%20835-4771> > > >>> > > >>> On Fri, Sep 8, 2017 at 6:04 PM, Anilkumar Gingade < > agingade@pivotal.io > > > > > >>> wrote: > > >>> > > >>>> Indexes are critical for querying; most of the databases doesn't > allow > > >>>> insert/update if there is any failure with index maintenance... > > >>>> > > >>>> As Geode OQL supports two ways (sync and async) to maintain the > > >> indexes, > > >>> we > > >>>> need be careful about the error handling in both cases... > > >>>> > > >>>> My take is: > > >>>> 1. For synchronous index maintenance: > > >>>> If there is any failure in updating any index (security/auth or > > logical > > >>>> error) on the region; throw an exception and rollback the cache > > >> update/op > > >>>> (index management id done under region.entry lock - we should be > able > > >> to > > >>>> revert the op). If index or cache is left in bad state, then its a > bug > > >>> that > > >>>> needs to be addressed. > > >>>> > > >>>> Most of the time, If there is any logical error in index, it will = be > > >>>> detected as soon as index is created (on existing data) or when > first > > >>>> update is done to the cache. > > >>>> > > >>>> 2. For Asynchronous index maintenance: > > >>>> As this is async (assuming) user has good understanding of the ris= k > > >>>> involved with async, any error with index maintenance, the index > > should > > >>> be > > >>>> invalidated... > > >>>> > > >>>> About the security/auth, the user permission with region read/writ= e > > >>> needs > > >>>> to be applied for index updates, there should not be different > > >> permission > > >>>> on index. > > >>>> > > >>>> -Anil. > > >>>> > > >>>> > > >>>> > > >>>> On Fri, Sep 8, 2017 at 2:01 PM, Nabarun Nag > wrote: > > >>>> > > >>>>> Hi Mike, > > >>>>> > > >>>>> Please do find our answers below: > > >>>>> *Question:* What if there were multiple indices that were in flig= ht > > >> and > > >>>>> only the third > > >>>>> one errors out, will they all be marked invalid? > > >>>>> > > >>>>> *Answer:* Only the third will be marked invalid and only the thir= d > > >> one > > >>>> will > > >>>>> not be used for query execution. > > >>>>> > > >>>>> *Question/Statement:* If anything goes wrong with the put it shou= ld > > >>>>> probably still throw back to > > >>>>> the caller. Silent invalidation of the index is probably not > > >> desirable. > > >>>>> > > >>>>> *Answer: * > > >>>>> In our current design this the flow of execution of a put > operation: > > >>>>> entry put into region -> update index -> other wan related > > >> executions / > > >>>>> callbacks etc. > > >>>>> > > >>>>> If an exception happens while updating the index, the cache gets > > >> into a > > >>>> bad > > >>>>> state, and we may end up getting different results depending on t= he > > >>> index > > >>>>> we are using. As the failure happens half way in a put operation, > the > > >>>>> regions / cache are now in a bad state. > > >>>>> -------------------------- > > >>>>> We are thinking that if index is created over a method invocatio= n > in > > >>> an > > >>>>> empty region and then we do puts, but method invocation is not > > >> allowed > > >>> as > > >>>>> per security policies. The puts will now be successful but the > index > > >>> will > > >>>>> be rendered invalid. Previously the puts will fail with exception > and > > >>> put > > >>>>> the entire cache in a bad state. > > >>>>> > > >>>>> > > >>>>> > > >>>>> Regards > > >>>>> Nabarun > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> > > >>>>> On Fri, Sep 8, 2017 at 10:43 AM Michael Stolz > > >>> wrote: > > >>>>> > > >>>>>> Just to help me understand, the index is corrupted in a way beyo= nd > > >>> just > > >>>>> the > > >>>>>> field that errors out? > > >>>>>> What if there were multiple indices that were in flight and only > > >> the > > >>>>> third > > >>>>>> one errors out, will they all be marked invalid? > > >>>>>> If anything goes wrong with the put it should probably still thr= ow > > >>> back > > >>>>> to > > >>>>>> the caller. Silent invalidation of the index is probably not > > >>> desirable. > > >>>>>> > > >>>>>> -- > > >>>>>> Mike Stolz > > >>>>>> Principal Engineer, GemFire Product Manager > > >>>>>> Mobile: +1-631-835-4771 <(631)%20835-4771> <(631)%20835-4771> > <(631)%20835-4771> > > >>>>>> > > >>>>>> On Fri, Sep 8, 2017 at 12:34 PM, Dan Smith > > >>> wrote: > > >>>>>> > > >>>>>>> +1 > > >>>>>>> > > >>>>>>> -Dan > > >>>>>>> > > >>>>>>> On Thu, Sep 7, 2017 at 9:14 PM, Nabarun Nag > > >>> wrote: > > >>>>>>> > > >>>>>>>> *Proposal:* > > >>>>>>>> * Index interface will include an API - isValid() which will > > >>> return > > >>>>>> true > > >>>>>>> if > > >>>>>>>> the index is still valid / uncorrupted, else will return false > > >> if > > >>>> it > > >>>>>>>> corrupted / invalid. > > >>>>>>>> * gfsh command "list index" will have one more column "Is > > >> Valid" > > >>>>> which > > >>>>>>> will > > >>>>>>>> state the status as "true" or "false". > > >>>>>>>> * Invalid indexes will not be used during query executions. > > >>>>>>>> * In case the index is found to be invalid, the user will be > > >> able > > >>>> to > > >>>>>>>> remove/destroy the index. > > >>>>>>>> * When a put operation corrupts an index, it will be logged. > > >>>>>>>> > > >>>>>>>> *Reasoning:* > > >>>>>>>> * Currently if a put operation raises an exception while > > >> updating > > >>>> the > > >>>>>>>> index, the put operation fails with an exception to the putter= . > > >>>>>>>> * For example, if an index is created on an object method, and > > >>> that > > >>>>>>> method > > >>>>>>>> causes an exception while updating the index as a part of a pu= t > > >>>>>>> operation, > > >>>>>>>> then the put operation fails for that particular entry and the > > >>>> index > > >>>>> is > > >>>>>>>> left in a bad state. > > >>>>>>>> * This may occur also due to lack of permission to update inde= x > > >>> but > > >>>>>> have > > >>>>>>>> permission to do puts. > > >>>>>>>> * We are proposing that in the above mentioned scenarios, the > > >> put > > >>>>>>> succeeds > > >>>>>>>> in putting the entry in the region but the index which it was > > >>>> trying > > >>>>> to > > >>>>>>>> update will be marked invalid and will not be used for query > > >>>>>> executions. > > >>>>>>>> * This can be justified because the corrupted index will not > > >>>>> correctly > > >>>>>>>> represent the region entries. > > >>>>>>>> > > >>>>>>>> *Status Quo:* > > >>>>>>>> * Index creation will still fail if we are trying to create an > > >>>> index > > >>>>>>> over a > > >>>>>>>> region containing an entry/entries which will cause an > > >> exception > > >>>>> while > > >>>>>>>> loading the entry into the index. > > >>>>>>>> > > >>>>>>>> Regards > > >>>>>>>> Nabarun Nag > > >>>>>>>> > > >>>>>>> > > >>>>>> > > >>>>> > > >>>> > > >>> > > >> > > > > > --001a11445ed4206e7f0558f175e6--