From 37b4561f57625f8af033d46f1a703bc706bf79e6 Mon Sep 17 00:00:00 2001 From: Aleksandr Lyapunov Date: Tue, 21 Mar 2023 15:10:09 +0300 Subject: [PATCH] memtx: add a couple of test cases to tx_man.test That's strange, but in this test in a group of simple test cases there are test cases that checks replaces, updates and deletes, but occasionally there's no test case that checks inserts. Fix it and add simple test cases for inserts. No logical changes. Part of #8648 Part of #8654 NO_DOC=new test case NO_CHANGELOG=new test case --- test/box/tx_man.result | 68 ++++++++++++++++++++++++++++++++++++++++ test/box/tx_man.test.lua | 20 ++++++++++++ 2 files changed, 88 insertions(+) diff --git a/test/box/tx_man.result b/test/box/tx_man.result index ff57fb19a439..53e8cff3fea8 100644 --- a/test/box/tx_man.result +++ b/test/box/tx_man.result @@ -165,6 +165,74 @@ s:select{} | - - [1, 2] | ... +-- Insert read/write conflicts. +s:delete{1} + | --- + | - [1, 2] + | ... +tx1:begin() + | --- + | - + | ... +tx2:begin() + | --- + | - + | ... +tx1('s:insert{1, 1}') + | --- + | - - [1, 1] + | ... +tx2('s:insert{1, 2}') + | --- + | - - [1, 2] + | ... +tx1:commit() + | --- + | - + | ... +tx2:commit() + | --- + | - - {'error': 'Transaction has been aborted by conflict'} + | ... +s:select{} + | --- + | - - [1, 1] + | ... + +-- Insert read/write conflicts, different order. +s:delete{1} + | --- + | - [1, 1] + | ... +tx1:begin() + | --- + | - + | ... +tx2:begin() + | --- + | - + | ... +tx1('s:insert{1, 1}') + | --- + | - - [1, 1] + | ... +tx2('s:insert{1, 2}') + | --- + | - - [1, 2] + | ... +tx2:commit() -- note that tx2 commits first. + | --- + | - + | ... +tx1:commit() + | --- + | - - {'error': 'Transaction has been aborted by conflict'} + | ... +s:select{} + | --- + | - - [1, 2] + | ... + -- Implicit read/write conflicts. s:replace{1, 0} | --- diff --git a/test/box/tx_man.test.lua b/test/box/tx_man.test.lua index 9ef8f9bd6646..10440c568fe0 100644 --- a/test/box/tx_man.test.lua +++ b/test/box/tx_man.test.lua @@ -54,6 +54,26 @@ tx2:commit() -- note that tx2 commits first. tx1:commit() s:select{} +-- Insert read/write conflicts. +s:delete{1} +tx1:begin() +tx2:begin() +tx1('s:insert{1, 1}') +tx2('s:insert{1, 2}') +tx1:commit() +tx2:commit() +s:select{} + +-- Insert read/write conflicts, different order. +s:delete{1} +tx1:begin() +tx2:begin() +tx1('s:insert{1, 1}') +tx2('s:insert{1, 2}') +tx2:commit() -- note that tx2 commits first. +tx1:commit() +s:select{} + -- Implicit read/write conflicts. s:replace{1, 0} tx1:begin()