Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko <sergepetrenko@tarantool.org>
To: v.shpilevoy@tarantool.org, gorcunov@gmail.com
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 4/4] txn_limbo: add ROLLBACK processing
Date: Tue, 23 Jun 2020 11:37:43 +0300	[thread overview]
Message-ID: <b81349e6-08dc-dd70-23f8-30075f095582@tarantool.org> (raw)
In-Reply-To: <16c9d1ffb9d09bb2b2f206a23973e2734616c345.1592482315.git.sergepetrenko@tarantool.org>


18.06.2020 15:14, Serge Petrenko пишет:
> Now txn_limbo writes a ROLLBACK entry to WAL when one of the limbo
> entries fails to gather quorum during a txn_limbo_confirm_timeout.
> All the limbo entries, starting with the failed one, are rolled back in
> reverse order.
>
> Closes #4848


New commit:

commit 2ee0c4380f17658b0fd1a507d565cd79b6910e3d
Author: Serge Petrenko <sergepetrenko@tarantool.org>
Date:   Mon Jun 22 21:08:49 2020 +0300

     fix for 'txn_limbo: add ROLLBACK processing'

     Fix parameter use inside applier_on_rollback_written().

     Make applier_txn_rollback_cb() respect rollback reason in
     txn->signature.

     Make limbo set rollback reason after timeout or read ROLLBACK message.

     [TO BE SQUASHED INTO THE PREVIOUS COMMIT]

diff --git a/src/box/applier.cc b/src/box/applier.cc
index 98a140a57..774af0149 100644
--- a/src/box/applier.cc
+++ b/src/box/applier.cc
@@ -273,10 +273,10 @@ applier_on_confirm_written(struct trigger *trig, 
void *event)
   * Rolls back part of the txs waiting in limbo.
   */
  static int
-applier_on_rollback_written(struct trigger *trig, void *data)
+applier_on_rollback_written(struct trigger *trig, void *event)
  {
-    (void) trig;
-    int64_t lsn = *(int64_t *)data;
+    (void) event;
+    int64_t lsn = *(int64_t *)trig->data;
      txn_limbo_read_rollback(&txn_limbo, lsn);
      return 0;
  }
@@ -801,6 +801,14 @@ static int
  applier_txn_rollback_cb(struct trigger *trigger, void *event)
  {
      (void) trigger;
+    struct txn *txn = (struct txn *) event;
+    /*
+     * Synchronous transaction rollback due to receiving a
+     * ROLLBACK entry is a normal event and requires no
+     * special handling.
+     */
+    if (txn->signature == TXN_SIGNATURE_SYNC_ROLLBACK)
+        return 0;

      /*
       * Setup shared applier diagnostic area.
diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
index 03badf9fc..931f5c3d4 100644
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -150,7 +150,7 @@ txn_limbo_wait_complete(struct txn_limbo *limbo, 
struct txn_limbo_entry *entry)
          rlist_foreach_entry_safe_reverse(e, &limbo->queue,
                           in_queue, tmp) {
              e->is_rollback = true;
-            e->txn->signature = -1;
+            e->txn->signature = TXN_SIGNATURE_QUORUM_TIMEOUT;
              txn_limbo_pop(limbo, e);
              txn_clear_flag(e->txn, TXN_WAIT_ACK);
              txn_complete(e->txn);
@@ -274,7 +274,7 @@ txn_limbo_read_rollback(struct txn_limbo *limbo, 
int64_t lsn)
          txn_clear_flag(e->txn, TXN_WAIT_ACK);

          /* Rollback the transaction. */
-        e->txn->signature = -1;
+        e->txn->signature = TXN_SIGNATURE_SYNC_ROLLBACK;
          txn_complete(e->txn);
      }
  }

-- 
Serge Petrenko

  parent reply	other threads:[~2020-06-23  8:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 12:13 [Tarantool-patches] [PATCH 0/4] sync replication: add rollback processing Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 1/4] xrow: fix comment typo Serge Petrenko
2020-06-18 22:15   ` Vladislav Shpilevoy
2020-06-18 22:15   ` Vladislav Shpilevoy
2020-06-19 17:28     ` Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 2/4] xrow: add ability to encode/decode ROLLBACK requests Serge Petrenko
2020-06-18 14:46   ` Cyrill Gorcunov
2020-06-19 17:30     ` Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 3/4] txn_limbo: add timeout when waiting for acks Serge Petrenko
2020-06-18 12:14 ` [Tarantool-patches] [PATCH 4/4] txn_limbo: add ROLLBACK processing Serge Petrenko
2020-06-18 22:15   ` Vladislav Shpilevoy
2020-06-19 17:35     ` Serge Petrenko
2020-06-21 15:53       ` Vladislav Shpilevoy
2020-06-19 17:53   ` Serge Petrenko
2020-06-23  8:37   ` Serge Petrenko [this message]
2020-06-25 22:14   ` Vladislav Shpilevoy
2020-06-25 22:43     ` Vladislav Shpilevoy

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=b81349e6-08dc-dd70-23f8-30075f095582@tarantool.org \
    --to=sergepetrenko@tarantool.org \
    --cc=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 4/4] txn_limbo: add ROLLBACK processing' \
    /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