Skip to content

Replace in read-view transaction with memtx transaction manager enabled triggers assertion #7239

@CuriousGeorgiy

Description

@CuriousGeorgiy

Bug description
Consider the following fair assertion:

diff --git a/src/box/memtx_tx.c b/src/box/memtx_tx.c
index 74814cfbe..b5775edca 100644
--- a/src/box/memtx_tx.c
+++ b/src/box/memtx_tx.c
@@ -857,7 +857,12 @@ memtx_tx_story_get(struct tuple *tuple)
 
        mh_int_t pos = mh_history_find(txm.history, tuple, 0);
        assert(pos != mh_end(txm.history));
-       return *mh_history_node(txm.history, pos);
+       struct memtx_story *story = *mh_history_node(txm.history, pos);
+       if (story->add_stmt != 0)
+               assert(story->add_psn == story->add_stmt->txn->psn);
+       if (story->del_stmt != 0)
+               assert(story->del_psn == story->del_stmt->txn->psn);
+       return story;
 }
 
 /**

Steps to reproduce

os.execute('rm -rf *.snap *.xlog *.vylog 512')

local txn_proxy = require("txn_proxy")

box.cfg{memtx_use_mvcc_engine = true}

box.schema.space.create('s')
box.space.s:create_index('pk')

box.space.s:insert{0, 0}

local tx1 = txn_proxy:new()
tx1('box.begin()')
tx1('box.space.s:select{}')

local tx2 = txn_proxy:new()
tx2('box.begin()')
tx2('box.space.s:delete{0}')
tx2('box.commit()')

tx1('box.space.s:replace{0, 1}')
tx1:commit()

os.exit()

Actual behavior

Assertion failed: (story->del_psn == story->del_stmt->txn->psn), function memtx_tx_story_get, file memtx_tx.c, line 864.

Expected behavior
Script successfully exits.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions