[Tarantool-patches] [PATCH 1/2] box: rework local_recovery to use async txn_commit

Serge Petrenko sergepetrenko at tarantool.org
Fri Jun 19 21:45:01 MSK 2020


19.06.2020 21:00, Serge Petrenko пишет:
> Local recovery should use asynchronous txn commit procedure in order to
> get to CONFIRM and ROLLBACK statements for a transaction that needs
> confirmation before confirmation timeout happens.
> Using async txn commit doesn't harm other transactions, since the
> journal used during local recovery fakes writes and its write_async()
> method may reuse plain write().


Added a new commit. I didn't squash it, because its debatable.

commit 83760f8b0d1a59e17ab6adeeda60efc1bc6e94ad
Author: Serge Petrenko <sergepetrenko at tarantool.org>
Date:   Fri Jun 19 21:42:35 2020 +0300

     box: fix for 'box: rework local_recovery to use async txn_commit'

     [TO BE SQUASHED INTO THE PREVIOUS COMMIT]

diff --git a/src/box/box.cc b/src/box/box.cc
index f80d6f8e6..0fe7625fb 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -222,6 +222,12 @@ box_process_rw(struct request *request, struct 
space *space,
                  */
                 if (is_local_recovery) {
                         res = txn_commit_async(txn);
+                       /*
+                        * Hack: remove the unnecessary trigger.
+                        * I don't know of a better place to do
+                        * it.
+                        */
+ trigger_clear(&txn->on_write_failure);
                 } else {
                         res = txn_commit(txn);
                 }
diff --git a/src/box/txn.c b/src/box/txn.c
index 2360ecae3..d36c11dda 100644
--- a/src/box/txn.c
+++ b/src/box/txn.c
@@ -688,9 +688,9 @@ txn_commit_async(struct txn *txn)
          * Set a trigger to abort waiting for confirm on WAL write
          * failure.
          */
-       trigger_create(&txn->on_write_failure, txn_limbo_on_rollback,
-                      limbo_entry, NULL);
         if (is_sync) {
+ trigger_create(&txn->on_write_failure, txn_limbo_on_rollback,
+                              limbo_entry, NULL);
                 txn_on_rollback(txn, &txn->on_write_failure);
         }
         return 0;

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list