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 6D473200BB9 for ; Mon, 7 Nov 2016 22:47:01 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 6BED3160AEC; Mon, 7 Nov 2016 21:47:01 +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 8ADB9160AE0 for ; Mon, 7 Nov 2016 22:47:00 +0100 (CET) Received: (qmail 93367 invoked by uid 500); 7 Nov 2016 21:46:59 -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 93356 invoked by uid 99); 7 Nov 2016 21:46:59 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Nov 2016 21:46:59 +0000 Received: from mail-qk0-f170.google.com (mail-qk0-f170.google.com [209.85.220.170]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 5B3B01A041D for ; Mon, 7 Nov 2016 21:46:59 +0000 (UTC) Received: by mail-qk0-f170.google.com with SMTP id n204so184107775qke.2 for ; Mon, 07 Nov 2016 13:46:59 -0800 (PST) X-Gm-Message-State: ABUngvcwtGKMBvVx/JQbfj8KUEdbvxi6wqZv+dAss2d2TXym4BiCCHavxWfvqFJP+5Hw1zlw4lPHzx+8tXuDgaN9 X-Received: by 10.55.101.151 with SMTP id z145mr8179738qkb.35.1478555218333; Mon, 07 Nov 2016 13:46:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.237.54.226 with HTTP; Mon, 7 Nov 2016 13:46:17 -0800 (PST) In-Reply-To: <6B66EC0C-E331-4815-9BDD-C3C333CA0FAE@gridgain.com> References: <6B66EC0C-E331-4815-9BDD-C3C333CA0FAE@gridgain.com> From: Dmitriy Setrakyan Date: Mon, 7 Nov 2016 13:46:17 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: TX savepoints To: dev@ignite.apache.org Cc: Igor Sapego Content-Type: multipart/alternative; boundary=001a11482a729235da0540bcf6fd archived-at: Mon, 07 Nov 2016 21:47:01 -0000 --001a11482a729235da0540bcf6fd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Couldn't agree more about ODBC and JDBC. We must support savepoints from SLQ, given the DML functionality being planned for 1.8 release. On Mon, Nov 7, 2016 at 11:23 AM, Denis Magda wrote: > This is how how the savepoints are supported by PostgreSQL [1], Oracle [2= ] > and MySQL [3]. The implementation details and behavior are pretty the sam= e > and similar to the Yakov=E2=80=99s proposal. > > It worth to note that all the engines support multiple savepoints per > transaction named uniquely and the RELEASE statement. If the one start a > second savepoint with the name of an already existed one then the old > savepoint will be erased/deleted. > > In addition it makes sense to support the feature at the level of our JDB= C > [4] and ODBC creating respective sub-tasks. Igor, I=E2=80=99ve googled th= at ODBC > supports savepoints but didn=E2=80=99t succeed at finding exact APIs. Ple= ase assist. > > [1] https://www.postgresql.org/docs/8.1/static/sql-savepoint.html < > https://www.postgresql.org/docs/8.1/static/sql-savepoint.html> > [2] https://docs.oracle.com/cd/B19306_01/server.102/b14200/ > statements_10001.htm B19306_01/server.102/b14200/statements_10001.htm> > [3] http://dev.mysql.com/doc/refman/5.7/en/savepoint.html < > http://dev.mysql.com/doc/refman/5.7/en/savepoint.html> > [4] https://docs.oracle.com/javase/tutorial/jdbc/basics/ > transactions.html#set_roll_back_savepoints > > =E2=80=94 > Denis > > > On Nov 7, 2016, at 9:13 AM, Dmitriy Setrakyan > wrote: > > > > Does anyone know how MySQL or PostgreSQL work with checkpoints? Do they > > support it in a similar way? > > > > On Mon, Nov 7, 2016 at 5:58 AM, Yakov Zhdanov > wrote: > > > >> Alex, I think we should put consecutive checkpoints to stack thus your > >> example should be illegal and should result to exception. And we will > throw > >> exception on rollback to CP if CP is not defined. > >> > >> --Yakov > >> > >> 2016-11-07 14:23 GMT+03:00 Alexey Goncharuk >: > >> > >>> We also should define savepoint behavior and API rules for each of th= e > >>> transaction concurrency and isolation types. > >>> > >>> * Should rollbackToSavepoint() always release locks or clear saved > >>> optimistic versions? > >>> * Are forward-rollbacks allowed, e.g. > >>> > >>> try (Transaction tx =3D ignite.transactions().txStart()) { > >>> c.put(1, 1); > >>> > >>> tx.savepoint("sp1"); > >>> > >>> c.put(2, 2); > >>> > >>> tx.savepoint("sp2") > >>> > >>> c.put(3, 3); > >>> > >>> tx.rollbackToSavepoint("sp1"); > >>> > >>> c.put(4, 4); > >>> > >>> tx.rollbackToSavepoint("sp2"); // Is this allowed? > >>> > >>> tx.commit(); > >>> } > >>> > >>> > >>> 2016-11-07 13:47 GMT+03:00 Sergey Kozlov : > >>> > >>>> Hi, Yakov > >>>> > >>>> I suppose it's very very handy feature. > >>>> My two cents are following: > >>>> - number of savepoints may be more than one per transaction > >>>> - what's about RELEASE SAVEPOINT statement? > >>>> > >>>> > >>>> On Mon, Nov 7, 2016 at 11:24 AM, Yakov Zhdanov > >>>> wrote: > >>>> > >>>>> Guys, > >>>>> > >>>>> Let's think of implementing savepoints for Ignite transactions. For > >> me, > >>>>> this is not too hard to do. > >>>>> > >>>>> Having "savepoints" seems to be pretty handy. Please consider the > >>>> following > >>>>> snippet. > >>>>> > >>>>> ignite.transactions.; > >>>>> INSERT INTO table1 VALUES (1); > >>>>> SAVEPOINT my_savepoint; > >>>>> INSERT INTO table1 VALUES (2); > >>>>> ROLLBACK TO SAVEPOINT my_savepoint; > >>>>> INSERT INTO table1 VALUES (3); > >>>>> COMMIT; > >>>>> > >>>>> Which should result in values 1 and 3 inserted to table1. > >>>>> > >>>>> In Ignite, I think, it would be like the following (preserving the > >>> same > >>>>> behavior as above). > >>>>> > >>>>> Ignite ignite =3D ....; > >>>>> IgniteCache c =3D ....; > >>>>> > >>>>> try (Transaction tx =3D ignite.transactions().txStart()) { > >>>>> c.put(1, 1); > >>>>> > >>>>> tx.savepoint("mysavepoint"); > >>>>> > >>>>> c.put(2, 2); > >>>>> > >>>>> tx.rollbackToSavepoint("mysavepoint"); > >>>>> > >>>>> c.put(3, 3); > >>>>> > >>>>> tx.commit(); > >>>>> } > >>>>> > >>>>> As far as implementation complexity I would give 2 weeks ballpark. > >>>>> > >>>>> 5 days - API design and implementation for different types of > >>>> transactions > >>>>> - savepoint implementation for local transaction objects > >>>>> - rollback implementation for different types of transactions - dra= in > >>>> local > >>>>> tx buffers, release remote locks for pessimistic transactions, etc. > >>>>> > >>>>> 5 days - testing, benchmarking, fixing issues. > >>>>> > >>>>> Please leave your comments here. I will file a ticket after we > >> discuss > >>>> this > >>>>> and put our summary to it. > >>>>> > >>>>> Thanks! > >>>>> > >>>>> --Yakov > >>>>> > >>>> > >>>> > >>>> > >>>> -- > >>>> Sergey Kozlov > >>>> GridGain Systems > >>>> www.gridgain.com > >>>> > >>> > >> > > --001a11482a729235da0540bcf6fd--