Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Konstantin Osipov <kostja@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [tarantool-patches] Re: [PATCH 4/4] txn: undo commit/rollback triggers when reverting to savepoint
Date: Tue, 30 Jul 2019 13:54:32 +0300	[thread overview]
Message-ID: <20190730105432.GH4659@esperanza> (raw)
In-Reply-To: <20190729131150.GA16930@atlas>

Please take a look at an alternative solution then:

  https://www.freelists.org/post/tarantool-patches/PATCH-v2-03-Support-savepoints-in-DDL-transactions

Rather than trying to maintain global commit/rollback trigger list and
removing triggers from them, the second version of this patch simply
attaches triggers to txn statements. I hope you'll find it easier for
understanding.

On Mon, Jul 29, 2019 at 04:11:50PM +0300, Konstantin Osipov wrote:
> * Vladimir Davydov <vdavydov.dev@gmail.com> [19/07/19 21:09]:
> 
> I spent some time thinking about this patch.
> 
> I agree we need to make commit and rollback
> triggers, as well as some SQL related members, part of the
> savepoint state.
> 
> DDL now can be part of a transaction, and since we may roll back
> to a savepoint, we need to make sure that all parts of the
> transaction, including a commit/rollback trigger, are part of
> the savepoint.
> 
> However the patch itself suffers from quite a bit of
> rot.
> 
> Initially, the idea of struct txn was very simple: it is a linked
> list of txn_stmt objects, and each txn_stmt object represents a
> change in transaction state. The history is easy to navigate over,
> and a savepoint is just a link inside the history chain.
> 
> commit/rollback triggers were not part of this story because they
> were only used for DDL which was non-transactional.
> 
> This code was allowed to rot and when some SQL related members
> were added directly to struct txn without considering the issue of
> sub-statements and savepoints.
> 
> This patch, in this vein, instead of designing the transaction
> system to make sure that every part of transaction state is part
> of a change history, adds a few extra savepoint members and
> makes sure that transaction state is carefully copied to the
> savepoint when it is created. This is contrary to how savepoints
> used to work, when a savepoint was just a link in the history of
> changes of the transaction state.
> 
> As an ugly artefact, we store such members as has_triggers,
> on_commit, on_rollback in struct txn twice: once in struct txn
> itself, and another time in txn->in_sub_stmt[0], which is
> initialized along with the txn.
> 
> So I think that some work needs to be done to move 
> transaction state which can participate in a savepoint to
> either an existing object representing a piece of the transaction
> history (struct txn_stmt) or a new object (txn_stmt_chain,
> txn_savepoint_state or something similar), the transaction is
> represented as a chain of such objects, the first
> object in the chain is a member of struct txn and is created when
> the transaction starts, and the savepoint can continue to be 
> just a link in that chain.
> 
> Let's discuss this when you have a chance.

      reply	other threads:[~2019-07-30 10:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 18:08 [PATCH 0/4] Support savepoints in DDL transactions Vladimir Davydov
2019-07-19 18:08 ` [PATCH 1/4] Update small library Vladimir Davydov
2019-07-24 22:48   ` [tarantool-patches] " Konstantin Osipov
2019-07-25  9:23     ` Vladimir Davydov
2019-07-19 18:08 ` [PATCH 2/4] txn: reverse commit trigger list only before running commit triggers Vladimir Davydov
2019-07-24 22:48   ` [tarantool-patches] " Konstantin Osipov
2019-07-25  9:24     ` Vladimir Davydov
2019-07-25  9:29       ` Konstantin Osipov
2019-07-25  9:35         ` Vladimir Davydov
2019-07-25 14:56           ` Vladimir Davydov
2019-07-26 19:25             ` Konstantin Osipov
2019-07-29  8:45               ` Vladimir Davydov
2019-07-19 18:08 ` [PATCH 3/4] txn: use savepoints to roll back statements on yield or error Vladimir Davydov
2019-07-24 22:55   ` [tarantool-patches] " Konstantin Osipov
2019-07-24 23:19     ` Konstantin Osipov
2019-07-25  9:28       ` Vladimir Davydov
2019-07-25 11:57     ` Vladimir Davydov
2019-07-19 18:08 ` [PATCH 4/4] txn: undo commit/rollback triggers when reverting to savepoint Vladimir Davydov
2019-07-19 19:36   ` [tarantool-patches] " Vladislav Shpilevoy
2019-07-19 19:42     ` Vladimir Davydov
2019-07-26  8:56   ` Vladimir Davydov
2019-07-29 13:11   ` [tarantool-patches] " Konstantin Osipov
2019-07-30 10:54     ` Vladimir Davydov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190730105432.GH4659@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] Re: [PATCH 4/4] txn: undo commit/rollback triggers when reverting to savepoint' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox