From: Cyrill Gorcunov <gorcunov@gmail.com>
To: tml <tarantool-patches@dev.tarantool.org>
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [Tarantool-patches] [PATCH 06/11] qsync: txn_limbo_append -- use owner_id in argument name
Date: Thu, 12 Nov 2020 22:51:16 +0300 [thread overview]
Message-ID: <20201112195121.191366-7-gorcunov@gmail.com> (raw)
In-Reply-To: <20201112195121.191366-1-gorcunov@gmail.com>
And change the callers. This id is needed to test for
foreign keys and to set limbo owner on demand.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
src/box/txn.c | 8 ++++----
src/box/txn_limbo.c | 15 ++++++++++-----
src/box/txn_limbo.h | 2 +-
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/box/txn.c b/src/box/txn.c
index f8726026b..d608f6989 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -832,8 +832,8 @@ txn_commit_async(struct txn *txn)
}
/* See txn_commit(). */
- uint32_t origin_id = req->rows[0]->replica_id;
- limbo_entry = txn_limbo_append(&txn_limbo, origin_id, txn);
+ uint32_t owner_id = req->rows[0]->replica_id;
+ limbo_entry = txn_limbo_append(&txn_limbo, owner_id, txn);
if (limbo_entry == NULL)
goto rollback;
@@ -900,14 +900,14 @@ txn_commit(struct txn *txn)
* Remote rows, if any, come before local rows, so
* check for originating instance id here.
*/
- uint32_t origin_id = req->rows[0]->replica_id;
+ uint32_t owner_id = req->rows[0]->replica_id;
/*
* Append now. Before even WAL write is done.
* After WAL write nothing should fail, even OOM
* wouldn't be acceptable.
*/
- limbo_entry = txn_limbo_append(&txn_limbo, origin_id, txn);
+ limbo_entry = txn_limbo_append(&txn_limbo, owner_id, txn);
if (limbo_entry == NULL)
goto rollback;
}
diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
index 2c35cd785..674dcad28 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -49,7 +49,7 @@ txn_limbo_create(struct txn_limbo *limbo)
}
struct txn_limbo_entry *
-txn_limbo_append(struct txn_limbo *limbo, uint32_t id, struct txn *txn)
+txn_limbo_append(struct txn_limbo *limbo, uint32_t owner_id, struct txn *txn)
{
assert(txn_has_flag(txn, TXN_WAIT_SYNC));
/*
@@ -70,12 +70,17 @@ txn_limbo_append(struct txn_limbo *limbo, uint32_t id, struct txn *txn)
diag_set(ClientError, ER_SYNC_ROLLBACK);
return NULL;
}
- if (id == 0)
- id = instance_id;
- if (limbo->owner_id != id) {
+ if (owner_id == REPLICA_ID_NIL) {
+ /*
+ * Transactionis initiated on the local node,
+ * thus we're the owner of the transaction.
+ */
+ owner_id = instance_id;
+ }
+ if (limbo->owner_id != owner_id) {
if (limbo->owner_id == REPLICA_ID_NIL ||
rlist_empty(&limbo->queue)) {
- limbo->owner_id = id;
+ limbo->owner_id = owner_id;
limbo->confirmed_lsn = 0;
} else {
diag_set(ClientError, ER_UNCOMMITTED_FOREIGN_SYNC_TXNS,
diff --git a/src/box/txn_limbo.h b/src/box/txn_limbo.h
index c7e70ba64..1b56903b7 100644
--- a/src/box/txn_limbo.h
+++ b/src/box/txn_limbo.h
@@ -191,7 +191,7 @@ txn_limbo_last_entry(struct txn_limbo *limbo)
* The limbo entry is allocated on the transaction's region.
*/
struct txn_limbo_entry *
-txn_limbo_append(struct txn_limbo *limbo, uint32_t id, struct txn *txn);
+txn_limbo_append(struct txn_limbo *limbo, uint32_t owner_id, struct txn *txn);
/** Remove the entry from the limbo, mark as rolled back. */
void
--
2.26.2
next prev parent reply other threads:[~2020-11-12 19:52 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 19:51 [Tarantool-patches] [PATCH 00/11] qsync: code refactoring Cyrill Gorcunov
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 01/11] build: add more ignore paths for tags target Cyrill Gorcunov
2020-11-16 13:09 ` Cyrill Gorcunov
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-21 12:09 ` Cyrill Gorcunov
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 02/11] vclock: vclock_get - drop misleading masking Cyrill Gorcunov
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 03/11] vclock: vclock_inc -- add assert() to catch overflow Cyrill Gorcunov
2020-11-13 9:30 ` Serge Petrenko
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 04/11] txn: txn_commit_async -- drop redundant variable Cyrill Gorcunov
2020-11-13 9:31 ` Serge Petrenko
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-21 12:30 ` Cyrill Gorcunov
2020-11-21 13:29 ` Vladislav Shpilevoy
2020-11-21 16:14 ` Cyrill Gorcunov
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 05/11] qsync: rename txn_limbo::instance_id to owner_id Cyrill Gorcunov
2020-11-13 9:37 ` Serge Petrenko
2020-11-12 19:51 ` Cyrill Gorcunov [this message]
2020-11-13 9:43 ` [Tarantool-patches] [PATCH 06/11] qsync: txn_limbo_append -- use owner_id in argument name Serge Petrenko
2020-11-13 10:11 ` Cyrill Gorcunov
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 07/11] qsync: move limbo owner transition into separate helper Cyrill Gorcunov
2020-11-13 9:47 ` Serge Petrenko
2020-11-13 10:12 ` Cyrill Gorcunov
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 08/11] qsync: txn_limbo_wait_confirm -- refactor code a bit Cyrill Gorcunov
2020-11-13 9:56 ` Serge Petrenko
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 09/11] qsync: drop redundant type convention Cyrill Gorcunov
2020-11-13 10:11 ` Serge Petrenko
2020-11-13 10:13 ` Cyrill Gorcunov
2020-11-13 10:19 ` Serge Petrenko
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 10/11] relay: use verbose names for fibers Cyrill Gorcunov
2020-11-13 10:17 ` Serge Petrenko
2020-11-13 10:28 ` Cyrill Gorcunov
2020-11-20 23:55 ` Vladislav Shpilevoy
2020-11-12 19:51 ` [Tarantool-patches] [PATCH 11/11] raft: drop redundant argument Cyrill Gorcunov
2020-11-13 10:18 ` Serge Petrenko
2020-11-20 23:54 ` [Tarantool-patches] [PATCH 00/11] qsync: code refactoring Vladislav Shpilevoy
2020-11-24 23:24 ` Vladislav Shpilevoy
2020-11-23 23:26 ` Vladislav Shpilevoy
2020-11-24 6:52 ` Cyrill Gorcunov
2020-11-24 21:41 ` Alexander V. Tikhonov
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=20201112195121.191366-7-gorcunov@gmail.com \
--to=gorcunov@gmail.com \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 06/11] qsync: txn_limbo_append -- use owner_id in argument name' \
/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