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 9CBA5200B4B for ; Thu, 21 Jul 2016 15:33:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9B4F1160A73; Thu, 21 Jul 2016 13:33:54 +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 BBF5E160A72 for ; Thu, 21 Jul 2016 15:33:53 +0200 (CEST) Received: (qmail 65484 invoked by uid 500); 21 Jul 2016 13:33:52 -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 65472 invoked by uid 99); 21 Jul 2016 13:33:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jul 2016 13:33:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 4193EC18DF for ; Thu, 21 Jul 2016 13:33:52 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id y-_v-9kH9iF9 for ; Thu, 21 Jul 2016 13:33:49 +0000 (UTC) Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com [209.85.213.50]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id DE3FC5F485 for ; Thu, 21 Jul 2016 13:33:48 +0000 (UTC) Received: by mail-vk0-f50.google.com with SMTP id x130so113539167vkc.0 for ; Thu, 21 Jul 2016 06:33:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=FXTnsEP6lp5OAz5bxJn7LkMpBDXfZ94LZbYtPTIPe60=; b=qBtu76SQv+X0Ii8CPvknvf/jqhed8nm/MRQYrI2pUDWW7MAsUQ04CjwW2zeB66S5lb hQgEam8bnEPoBBkRzNk7MkTgVwPacnc6EO/M20T4Ts/JVUDjb7YiskZBuoY+PJzSl2Er OGTFB26PuL9/R4+GTIRBaZYg+jwi3LQbBgWqlqLPkb2VA7AwgMhg10Pg44yHSE0Emfyx lYkyV5bduMX0+/hD5W4s2gyKqx6sOn3RwXz5CvCjmSxGa78yfQo65+kSNPHsML69Onzv P4AllWTLjpswbKW8OjEHQXI0a474mBSzWBOjbFU2jhAp/ZKTGXpAF4QhvkR+gvBlk22/ AcIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=FXTnsEP6lp5OAz5bxJn7LkMpBDXfZ94LZbYtPTIPe60=; b=iEXJhh7N+M4LAtavvjT9nwFj7c9ns90+uqddw/qlwMxQOLTtJTHP05IEvTtsaxnlTJ +IgeWeKO7dv20a2Kfoq4/MAr8ee/ewKwfGluQ4oHodEQvcj6XlsKn1q78OAl0PIg5JO2 gm+W9BS50nDLv8LJiolC5v/DwrU6MbhN/JyWbRPKeu/0gAZCgK7gTT1SE9HexAc+W8sD odoewgOeojLGBkJpylR6lu2oBbYdeuayhOfis+7o8QQ8jwwzZuverNWw7Ds/Cg8xljVY er/GZR7Bx6XuY14SyR9QDzVqHp19BmBTLGOaindawOmn3MpgPQavuMRK7woYDkfhJ7JI iYgQ== X-Gm-Message-State: ALyK8tKK7i7wV943Samm2iosTGrP3Xs6XZkE4CiDx+b80BTPFRv37qBEeanZgRIjuLgHaaNCPmfvHvTI6yCGqQ== X-Received: by 10.159.55.206 with SMTP id q72mr23880401uaq.152.1469108027526; Thu, 21 Jul 2016 06:33:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.49.2 with HTTP; Thu, 21 Jul 2016 06:33:08 -0700 (PDT) In-Reply-To: References: From: Sergi Vladykin Date: Thu, 21 Jul 2016 16:33:08 +0300 Message-ID: Subject: Re: IGNITE-2294 implementation details To: dev@ignite.apache.org Content-Type: multipart/alternative; boundary=94eb2c03ea661e120a0538255e0f archived-at: Thu, 21 Jul 2016 13:33:54 -0000 --94eb2c03ea661e120a0538255e0f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I don't see why we need to start with DDL. We have table definitions with key and value definitions in them, so what is the problem? Sergi On Thu, Jul 21, 2016 at 2:14 PM, Alexey Goncharuk < alexey.goncharuk@gmail.com> wrote: > For me the main question here is how we define Key and Value for a cache > when using SQL interface. Unless we are going to re-architect the whole > Ignite, it will still be a key-value storage in the first place, so > whenever we do an INSERT, we must generate Key and Value. Given that valu= es > in INSERT are supposed to be fields of either Key or Value, this confuses > me a lot. > > Maybe we should come up with DDL first? > > 2016-07-21 14:06 GMT+03:00 Sergi Vladykin : > > > No, this does not make sense. > > > > There is no upsert mode in databases. There are operations: INSERT, > UPDATE, > > DELETE, MERGE. > > > > I want to have clear understanding of how they have to behave in SQL > > databases and how they will actually behave in Ignite in different > > scenarios. Also I want to have clear understanding of performance > > implications of each decision here. > > > > Anything wrong with that? > > > > Sergi > > > > On Thu, Jul 21, 2016 at 1:04 PM, Dmitriy Setrakyan < > dsetrakyan@apache.org> > > wrote: > > > > > Serj, are you asking what will happen as of today? Then the answer to > all > > > your questions is that duplicate keys are not an issue, and Ignite > always > > > operates in **upsert** mode (which is essentially a *=E2=80=9Cput(=E2= =80=A6)=E2=80=9D *method). > > > > > > However, the *=E2=80=9Cinsert=E2=80=9D* that is suggested by Alex wou= ld delegate to > > > *=E2=80=9CputIfAbsent(=E2=80=A6)=E2=80=9D*, which in database world m= akes more sense. However, > in > > > this case, the *=E2=80=9Cupdate=E2=80=9D* syntax should delegate to *= =E2=80=9Creplace(=E2=80=A6)=E2=80=9D*, as > > > update should fail in case if a key is absent. > > > > > > Considering the above, a notion of =E2=80=9C*upsert=E2=80=9D* or =E2= =80=9C*merge=E2=80=9D *operation is > > > very much needed, as it will give a user an option to perform > > > =E2=80=9Cinsert-or-update=E2=80=9D in 1 call. > > > > > > Does this make sense? > > > > > > D. > > > > > > On Wed, Jul 20, 2016 at 9:39 PM, Sergi Vladykin < > > sergi.vladykin@gmail.com> > > > wrote: > > > > > > > I'd prefer to do MERGE operation last because in H2 it is not > standard > > > ANSI > > > > SQL MERGE. Or may be not implement it at all, or may be contribute > ANSI > > > > correct version to H2, then implement it on Ignite. Need to > investigate > > > the > > > > semantics deeper before making any decisions here. > > > > > > > > Lets start with simple scenarios for INSERT and go through all the > > > possible > > > > cases and answer the questions: > > > > - What will happen on key conflict in TX cache? > > > > - What will happen on key conflict in Atomic cache? > > > > - What will happen with the previous two if we use DataLoader? > > > > - How to make these operations efficient (it will be simple enough = to > > > > implement them with separate put/putIfAbsent operations but probabl= y > we > > > > will need some batching like putAllIfAbsent for efficiency)? > > > > > > > > As for API, we still will need to have a single entry point for all > SQL > > > > queries/commands to allow any console work with it transparently. I= t > > > would > > > > be great if we will be able to come up with something consistent wi= th > > > this > > > > idea on public API. > > > > > > > > Sergi > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Jul 20, 2016 at 2:23 PM, Dmitriy Setrakyan < > > > > dsetrakyan@gridgain.com> > > > > wrote: > > > > > > > > > Like the idea of merge and insert. I need more time to think abou= t > > the > > > > API > > > > > changes. > > > > > > > > > > Sergi, what do you think? > > > > > > > > > > Dmitriy > > > > > > > > > > > > > > > > > > > > On Jul 20, 2016, at 12:36 PM, Alexander Paschenko < > > > > > alexander.a.paschenko@gmail.com> wrote: > > > > > > > > > > >> Thus, I suggest that we implement MERGE as a separate operatio= n > > > backed > > > > > by putIfAbsent operation, while INSERT will be implemented via pu= t. > > > > > > > > > > > > Sorry, of course I meant that MERGE has to be put-based, while > > INSERT > > > > > > has to be putIfAbsent-based. > > > > > > > > > > > > 2016-07-20 12:30 GMT+03:00 Alexander Paschenko > > > > > > : > > > > > >> Hell Igniters, > > > > > >> > > > > > >> In this thread I would like to share and discuss some thoughts > on > > > DML > > > > > >> operations' implementation, so let's start and keep it here. > > > Everyone > > > > > >> is of course welcome to share their suggestions. > > > > > >> > > > > > >> For starters, I was thinking about semantics of INSERT. In > > > traditional > > > > > >> RDBMSs, INSERT works only for records whose primary keys don't > > > > > >> conflict with those of records that are already persistent - y= ou > > > can't > > > > > >> try to insert the same key more than once because you'll get a= n > > > error. > > > > > >> However, semantics of cache put is obviously different - it do= es > > not > > > > > >> have anything about duplicate keys, it just quietly updates > values > > > in > > > > > >> case of keys' duplication. Still, cache has putIfAbsent > operation > > > that > > > > > >> is closer to traditional notion of INSERT, and H2's SQL dialec= t > > has > > > > > >> MERGE operation which corresponds to semantics of cache put. > > Thus, I > > > > > >> suggest that we implement MERGE as a separate operation backed > by > > > > > >> putIfAbsent operation, while INSERT will be implemented via pu= t. > > > > > >> > > > > > >> And one more, probably more important thing: I suggest that we > > > create > > > > > >> separate class Update and corresponding operation update() in > > > > > >> IgniteCache. The reasons are as follows: > > > > > >> > > > > > >> - Query bears some flags that are clearly redundant for Update > > (page > > > > > >> size, locality) > > > > > >> - query() method in IgniteCache (one that accepts Query) and > > query() > > > > > >> methods in GridQueryIndexing return iterators. So, if we striv= e > to > > > > > >> leave interfaces unchanged, we still will introduce some desig= n > > > > > >> ugliness like query methods returning empty iterators for > certain > > > > > >> queries, and/or query flags that indicate whether it's an upda= te > > > query > > > > > >> or not, etc. > > > > > >> - If some Queries are update queries, then continuous queries > > can't > > > be > > > > > >> based on them - more design-wise ugly checks and stuff like > that. > > > > > >> - I'm pretty sure there's more I don't know about. > > > > > >> > > > > > >> Comments and suggestions are welcome. Sergi Vladykin, Dmitry > > > > > >> Setrakyan, your opinions are of particular interest, please > > advise. > > > > > >> > > > > > >> Regards, > > > > > >> Alex > > > > > > > > > > > > > > > --94eb2c03ea661e120a0538255e0f--