Skip to content

{Replace, {in, up}sert} after full scan in hash index with memtx transaction manager enabled causes transaction to self-conflict #7221

@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..d32128e6d 100644
--- a/src/box/memtx_tx.c
+++ b/src/box/memtx_tx.c
@@ -543,6 +543,7 @@ memtx_tx_abort_all_for_ddl(struct txn *ddl_owner)
 int
 memtx_tx_cause_conflict(struct txn *breaker, struct txn *victim)
 {
+       assert(breaker != victim);
        struct tx_conflict_tracker *tracker = NULL;
        struct rlist *r1 = breaker->conflict_list.next;
        struct rlist *r2 = victim->conflicted_by_list.next;

Steps to reproduce

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

local txn_proxy = require('txn_proxy')
local log = require('log')
local yaml = require('yaml')

box.cfg{memtx_use_mvcc_engine = true}

box.schema.space.create('s')
box.space.s:create_index('pk', {type = 'hash'})

local tx1 = txn_proxy.new()
tx1:begin()
tx1('box.space.s:select{}')
tx1('box.space.s:replace{0}')
log.info("%s", yaml.encode(tx1:commit()))

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

local txn_proxy = require('txn_proxy')
local log = require('log')
local yaml = require('yaml')

box.cfg{memtx_use_mvcc_engine = true}

box.schema.space.create('s')
box.space.s:create_index('pk', {type = 'hash'})

local tx1 = txn_proxy.new()
tx1:begin()
tx1('box.space.s:select{}')
tx1('box.space.s:insert{0}')
log.info("%s", yaml.encode(tx1:commit()))

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

local txn_proxy = require('txn_proxy')
local log = require('log')
local yaml = require('yaml')

box.cfg{memtx_use_mvcc_engine = true}

box.schema.space.create('s')
box.space.s:create_index('pk', {type = 'hash'})

local tx1 = txn_proxy.new()
tx1:begin()
tx1('box.space.s:select{}')
tx1('box.space.s:upsert({0}, {{"=", 1, 0}})')
log.info("%s", yaml.encode(tx1:commit()))

os.exit()

Actual behavior

Assertion failed: (breaker != victim), function memtx_tx_cause_conflict, file memtx_tx.c, line 546.

Expected behavior
Script successfully exits.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions