From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: =?utf-8?B?0JPQtdC+0YDQs9C40Lkg0JrQuNGA0LjRh9C10L3QutC+?= Subject: Re: [tarantool-patches] [PATCH v3 11/14] txn: introduce asynchronous txn commit Date: Thu, 13 Jun 2019 22:45:18 +0300 Message-ID: <1668523.8YztoT5jxX@home.lan> In-Reply-To: <20190613143400.uminobjjgnkeleat@esperanza> References: <697f3313f6ad706a71c74ec259c0ea37d2702184.1560112747.git.georgy@tarantool.org> <20190613143400.uminobjjgnkeleat@esperanza> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2042071.cTj5VgQ1Jv"; micalg="pgp-sha256"; protocol="application/pgp-signature" To: Vladimir Davydov Cc: tarantool-patches@freelists.org List-ID: --nextPart2042071.cTj5VgQ1Jv Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Thursday, June 13, 2019 5:34:00 PM MSK Vladimir Davydov wrote: > On Sun, Jun 09, 2019 at 11:44:40PM +0300, Georgy Kirichenko wrote: > > diff --git a/src/box/txn.c b/src/box/txn.c > I don't see why we need to have in_txn() in on_commit/rollback triggers. > Could you please point me? Unfortunately lua on_commit triggers use it (because of vshard requirements) and I'm don't see the right way to remove it. > > > diff --git a/src/box/wal.c b/src/box/wal.c > > index e868a8e71..eff48b4fe 100644 > > --- a/src/box/wal.c > > +++ b/src/box/wal.c > > @@ -272,6 +272,8 @@ tx_schedule_f(va_list ap) > > > > struct journal_entry *req = > > > > stailq_shift_entry(&writer->schedule_queue, > > > > struct journal_entry, fifo); > > > > + if (req->on_done_cb != NULL) > > + req->on_done_cb(req, req->on_done_cb_data); > > > > req->done = true; > > fiber_cond_broadcast(&req->done_cond); > > Why do we need cond if we have a callback? Can't we wake up the awaiting > fiber from the callback? The condition and the done variable is required the time when all transaction data could be purged. Definitely it could not be done while on_done_cb because we will lost transaction status in this case. I think there are some ways to handle this but I think the solution would be too complicated. I use the callback to process txn finalization and call on_commit/on_rollback trigger one of them signals an applier fiber to collect transaction and determine replication state. --nextPart2042071.cTj5VgQ1Jv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEFB+nbqWGnp59Rk9ZFSyY70x8X3sFAl0Cp84ACgkQFSyY70x8 X3sT7Af/YQ2bWp6wJzwU2Uj1Jg9iJN+dj2PdxCcP7ZQfB6kDWavFONl//VhBfOl6 SzAIpsyrghcsRhIZwPhlSxdVGyTpK0hMVMBr63YEtsVbK1HebUp6/L+Hz+JxsI6Y iLLAs9W6Qw9DaMQrA6McBo8RkSv9zepNJ7LVkxoy4F0YmkjpYWSSE/uyTbR/Qs9n 1l56bzaDbSUgtzGo4T6KMDIsxgYPRKJLEEm0UMJR9BVcwn1Yl4GXmx1l7ZhlDzYm 3ACsdcbmP8GYYrmSF1MieY7ULRkM7KCxuOLvvbRTUt1MIDV0dG3PlcFDeuk4JCLY +jvITgu+cYLLP3pb6DsrQt5CRn6CIQ== =wmbb -----END PGP SIGNATURE----- --nextPart2042071.cTj5VgQ1Jv--