Tarantool development patches archive
 help / color / mirror / Atom feed
From: Aleksandr Lyapunov <alyapunov@tarantool.org>
To: tarantool-patches@dev.tarantool.org,
	Nikita Pettik <korablev@tarantool.org>,
	"Alexander V . Tikhonov" <avtikhon@tarantool.org>
Subject: [Tarantool-patches] [PATCH 1/2] memtx: fix a bug in unlinking story lists
Date: Thu, 22 Oct 2020 19:02:32 +0300	[thread overview]
Message-ID: <1603382553-5570-2-git-send-email-alyapunov@tarantool.org> (raw)
In-Reply-To: <1603382553-5570-1-git-send-email-alyapunov@tarantool.org>

Tx stories must be linked into correct double-linked list.
Preserve it.

Part of #5423
---
 src/box/memtx_tx.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/box/memtx_tx.c b/src/box/memtx_tx.c
index 55748ad..e378054 100644
--- a/src/box/memtx_tx.c
+++ b/src/box/memtx_tx.c
@@ -433,9 +433,20 @@ memtx_tx_story_gc_step()
 				}
 				assert(story->tuple == unused);
 			}
-			memtx_tx_story_unlink(story, i);
+
+			if (link->older.is_story) {
+				struct memtx_story *older_story = link->older.story;
+				memtx_tx_story_unlink(story, i);
+				older_story->link[i].newer_story = older_story;
+			} else {
+				memtx_tx_story_unlink(story, i);
+			}
 		} else {
+			/* Just unlink from list */
 			link->newer_story->link[i].older = link->older;
+			if (link->older.is_story)
+				link->older.story->link[i].newer_story =
+					link->newer_story;
 			link->older.is_story = false;
 			link->older.story = NULL;
 			link->newer_story = NULL;
-- 
2.7.4

  reply	other threads:[~2020-10-22 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 16:02 [Tarantool-patches] [PATCH 0/2] Fix transaction manager Aleksandr Lyapunov
2020-10-22 16:02 ` Aleksandr Lyapunov [this message]
2020-10-22 16:02 ` [Tarantool-patches] [PATCH 2/2] memtx: fix a bug in TX that caused deletion of a durty tuple Aleksandr Lyapunov
2020-10-22 16:42 ` [Tarantool-patches] [PATCH 0/2] Fix transaction manager 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=1603382553-5570-2-git-send-email-alyapunov@tarantool.org \
    --to=alyapunov@tarantool.org \
    --cc=avtikhon@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/2] memtx: fix a bug in unlinking story lists' \
    /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