[Tarantool-patches] [PATCH 1/2] memtx: fix a bug in unlinking story lists

Aleksandr Lyapunov alyapunov at tarantool.org
Thu Oct 22 19:02:32 MSK 2020


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



More information about the Tarantool-patches mailing list