From: Alexander Turenko <alexander.turenko@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: Alexander Turenko <alexander.turenko@tarantool.org>, tarantool-patches@freelists.org Subject: [tarantool-patches] [PATCH v2 3/3] lua-yaml: treat an empty document/value as null Date: Tue, 22 Jan 2019 05:12:54 +0300 [thread overview] Message-ID: <be09222062ccbd971fa3b39b760b43735d5ba334.1548123025.git.alexander.turenko@tarantool.org> (raw) In-Reply-To: <cover.1548123025.git.alexander.turenko@tarantool.org> It improves our compatibility with the YAML standard. yaml.encode('') result changed from --- ... to --- '' ... yaml.decode('') returns zero values count before, now it returns box.NULL. yaml.decode('- ') returns {''} before, now {box.NULL}. This commit touches many tests and test result files, which use console, without behaviour changes. It also adds two test cases to app-tap/console.test.lua. --- test/app-tap/console.test.lua | 16 +- test/app/fio.result | 2 +- test/app/socket.result | 26 +- test/box/access.result | 8 +- test/box/role.result | 8 +- test/box/sequence.result | 2 +- test/vinyl/errinj_tx.result | 10 +- test/vinyl/hermitage.result | 122 ++-- test/vinyl/mvcc.result | 1066 +++++++++++++++---------------- test/vinyl/mvcc.test.lua | 4 +- test/vinyl/tx_conflict.result | 2 +- test/vinyl/tx_conflict.test.lua | 2 +- test/vinyl/tx_gap_lock.result | 189 +++--- test/vinyl/tx_gap_lock.test.lua | 3 +- test/vinyl/tx_serial.result | 2 +- test/vinyl/tx_serial.test.lua | 2 +- third_party/lua-yaml/lyaml.cc | 22 +- 17 files changed, 747 insertions(+), 739 deletions(-) diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua index 68f273234..b694a2787 100755 --- a/test/app-tap/console.test.lua +++ b/test/app-tap/console.test.lua @@ -21,7 +21,7 @@ local EOL = "\n...\n" test = tap.test("console") -test:plan(68) +test:plan(74) -- Start console and connect to it local server = console.listen(CONSOLE_SOCKET) @@ -68,12 +68,12 @@ client_info = nil -- Check console.delimiter() client:write("require('console').delimiter(';')\n") -test:is(yaml.decode(client:read(EOL)), '', "set delimiter to ';'") +test:is(yaml.decode(client:read(EOL)), nil, "set delimiter to ';'") test:is(state.delimiter, ';', "state.delimiter is ';'") client:write("require('console').delimiter();\n") test:is(yaml.decode(client:read(EOL))[1], ';', "get delimiter is ';'") client:write("require('console').delimiter('');\n") -test:is(yaml.decode(client:read(EOL)), '', "clear delimiter") +test:is(yaml.decode(client:read(EOL)), nil, "clear delimiter") -- -- gh-3476: yaml.encode encodes 'false' and 'true' incorrectly. @@ -86,16 +86,26 @@ test:is(yaml.encode(true), "--- true\n...\n") test:is(yaml.encode('false'), "--- 'false'\n...\n") test:is(yaml.encode('true'), "--- 'true'\n...\n") test:is(yaml.encode(nil), "--- null\n...\n") +test:is(yaml.encode('false'), "--- 'false'\n...\n") +test:is(yaml.encode('true'), "--- 'true'\n...\n") +test:is(yaml.encode(''), "--- ''\n...\n") test:is(yaml.decode('false'), false) test:is(yaml.decode('no'), false) test:is(yaml.decode('true'), true) test:is(yaml.decode('yes'), true) test:is(yaml.decode('~'), nil) +test:is(yaml.decode(''), nil) test:is(yaml.decode('null'), nil) test:is(yaml.decode('Null'), nil) test:is(yaml.decode('NULL'), nil) +-- Verify that yaml.decode() correctly handles nested nulls. +test:is(yaml.decode('-')[1], nil) + +-- Verify that yaml.decode() returns null, not zero values count. +test:is(select('#', yaml.decode('')), 1) + box.cfg{ listen=IPROTO_SOCKET; memtx_memory = 107374182, diff --git a/test/app/fio.result b/test/app/fio.result index 486cb8043..2f3530509 100644 --- a/test/app/fio.result +++ b/test/app/fio.result @@ -69,7 +69,7 @@ err:match("basename") ~= nil ... fio.basename('/') --- -- +- '' ... fio.basename('abc') --- diff --git a/test/app/socket.result b/test/app/socket.result index 1209ec218..35c53d253 100644 --- a/test/app/socket.result +++ b/test/app/socket.result @@ -1235,7 +1235,7 @@ c:error() ... x, type(x), #x --- -- +- '' - string - 0 ... @@ -1248,7 +1248,7 @@ c:error() ... x, type(x), #x --- -- +- '' - string - 0 ... @@ -1285,7 +1285,7 @@ c:error() ... x, type(x), #x --- -- +- '' - string - 0 ... @@ -1298,7 +1298,7 @@ c:error() ... x, type(x), #x --- -- +- '' - string - 0 ... @@ -1311,7 +1311,7 @@ c:error() ... x, type(x), #x --- -- +- '' - string - 0 ... @@ -1975,7 +1975,7 @@ c:receive(4) ... c:receive("*l") --- -- +- '' ... wch:put("Fu") --- @@ -1999,19 +1999,19 @@ c:receive() --- - null - closed -- +- '' ... c:receive(10) --- - null - closed -- +- '' ... c:receive("*a") --- - null - closed -- +- '' ... c:close() --- @@ -2345,7 +2345,7 @@ received_message == '' -- expected true ... received_message --- -- +- '' ... e == 0 -- expected true --- @@ -2368,7 +2368,7 @@ received_message == '' -- expected true ... received_message --- -- +- '' ... from ~= nil -- expected true --- @@ -2445,7 +2445,7 @@ received_message == '' -- expected true ... received_message --- -- +- '' ... e == 0 -- expected true --- @@ -2468,7 +2468,7 @@ received_message == '' -- expected true ... received_message --- -- +- '' ... from ~= nil -- expected true --- diff --git a/test/box/access.result b/test/box/access.result index 9c190240f..269881bc1 100644 --- a/test/box/access.result +++ b/test/box/access.result @@ -999,7 +999,7 @@ box.schema.user.info('test_user') - test_space - - session,usage - universe - - + - '' - - alter - user - test_user @@ -1032,7 +1032,7 @@ box.schema.user.info('test_user') - public - - session,usage - universe - - + - '' - - alter - user - test_user @@ -1350,7 +1350,7 @@ e.type, e.access_type, e.object_type, e.message obj_type, obj_name, op_type --- - universe -- +- '' - Usage ... euid, auid @@ -1370,7 +1370,7 @@ c = (require 'net.box').connect(LISTEN.host, LISTEN.service, {user="test_user", obj_type, obj_name, op_type --- - universe -- +- '' - Session ... euid, auid diff --git a/test/box/role.result b/test/box/role.result index 3a54e2460..9b044667a 100644 --- a/test/box/role.result +++ b/test/box/role.result @@ -28,7 +28,7 @@ box.schema.role.info('iddqd') --- - - - execute - universe - - + - '' ... box.schema.role.revoke('iddqd', 'execute', 'universe') --- @@ -48,7 +48,7 @@ box.schema.user.info('tester') - public - - session,usage - universe - - + - '' - - alter - user - tester @@ -66,7 +66,7 @@ box.schema.user.info('tester') - iddqd - - session,usage - universe - - + - '' - - alter - user - tester @@ -940,7 +940,7 @@ box.schema.user.info('test_user') - public - - session,usage - universe - - + - '' - - alter - user - test_user diff --git a/test/box/sequence.result b/test/box/sequence.result index b3907659f..f429d7dae 100644 --- a/test/box/sequence.result +++ b/test/box/sequence.result @@ -1361,7 +1361,7 @@ box.schema.user.info() - _priv - - session,usage - universe - - + - '' - - alter - user - user diff --git a/test/vinyl/errinj_tx.result b/test/vinyl/errinj_tx.result index a7583b2e2..2df9bc6d0 100644 --- a/test/vinyl/errinj_tx.result +++ b/test/vinyl/errinj_tx.result @@ -207,28 +207,28 @@ c0 = txn_proxy.new() ... c0:begin() --- -- +- null ... c1 = txn_proxy.new() --- ... c1:begin() --- -- +- null ... c2 = txn_proxy.new() --- ... c2:begin() --- -- +- null ... c3 = txn_proxy.new() --- ... c3:begin() --- -- +- null ... -- -- Prepared transactions @@ -336,7 +336,7 @@ c3('s:select{3}') -- c2 is not visible ... c3:commit() --- -- +- null ... s:drop() --- diff --git a/test/vinyl/hermitage.result b/test/vinyl/hermitage.result index 23495fde1..fbe2090ce 100644 --- a/test/vinyl/hermitage.result +++ b/test/vinyl/hermitage.result @@ -51,11 +51,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:replace{1, 11}") --- @@ -71,7 +71,7 @@ c1("t:replace{2, 21}") ... c1:commit() --- -- +- null ... c2("t:replace{2, 22}") --- @@ -79,7 +79,7 @@ c2("t:replace{2, 22}") ... c2:commit() -- success, the last writer wins --- -- +- null ... t:get{1} -- {1, 12} --- @@ -107,11 +107,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:update(1, {{'=', 2, 11}})") --- @@ -127,7 +127,7 @@ c1("t:update(2, {{'=', 2, 21}})") ... c1:commit() --- -- +- null ... c2("t:update(2, {{'=', 2, 22}})") --- @@ -163,11 +163,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:replace{1, 101}") --- @@ -179,7 +179,7 @@ c2("t:replace{1, 10}") ... c1:rollback() --- -- +- null ... c2("t:get{1}") -- {1, 10} --- @@ -187,7 +187,7 @@ c2("t:get{1}") -- {1, 10} ... c2:commit() -- true --- -- +- null ... -- teardown t:truncate() @@ -207,11 +207,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:replace{1, 101}") --- @@ -227,7 +227,7 @@ c1("t:replace{1, 11}") ... c1:commit() -- ok --- -- +- null ... c2("t:get{1}") -- {1, 10} --- @@ -235,7 +235,7 @@ c2("t:get{1}") -- {1, 10} ... c2:commit() -- ok --- -- +- null ... -- teardown t:truncate() @@ -255,11 +255,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:replace{1, 11}") --- @@ -279,7 +279,7 @@ c2("t:get{1}") -- {1, 10} ... c1:commit() -- ok --- -- +- null ... c2:commit() -- rollback (@fixme: not necessary) --- @@ -303,15 +303,15 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c1("t:replace{1, 11}") --- @@ -327,7 +327,7 @@ c2("t:replace{1, 12}") ... c1:commit() -- ok --- -- +- null ... c3("t:get{1}") -- {1, 11} --- @@ -343,7 +343,7 @@ c3("t:get{2}") -- {2, 19} ... c2:commit() -- write only transaction - OK to commit --- -- +- null ... c3("t:get{2}") -- {2, 19} --- @@ -355,7 +355,7 @@ c3("t:get{1}") -- {1, 11} ... c3:commit() -- read only transaction - OK to commit, stays with its read view --- -- +- null ... -- teardown t:truncate() @@ -375,11 +375,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:select()") -- {1, 10}, {2, 20} --- @@ -391,7 +391,7 @@ c2("t:replace{3, 30}") ... c2:commit() -- ok --- -- +- null ... c1("t:select()") -- still {1, 10}, {2, 20} --- @@ -399,7 +399,7 @@ c1("t:select()") -- still {1, 10}, {2, 20} ... c1:commit() -- ok --- -- +- null ... -- teardown t:truncate() @@ -419,11 +419,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:replace{1, 20}") --- @@ -443,11 +443,11 @@ c2("t:get{2}") -- {2, 20} ... c2("t:delete{2}") --- -- +- null ... c1:commit() -- ok --- -- +- null ... c2("t:get{1}") -- {1, 10} --- @@ -483,11 +483,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -507,7 +507,7 @@ c2("t:replace{1, 12}") ... c1:commit() -- ok --- -- +- null ... c2:commit() -- rollback -- conflict --- @@ -531,11 +531,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -559,7 +559,7 @@ c2("t:replace{2, 18}") ... c2:commit() -- ok --- -- +- null ... c1("t:get{2}") -- {2, 20} --- @@ -567,7 +567,7 @@ c1("t:get{2}") -- {2, 20} ... c1:commit() -- ok --- -- +- null ... -- teardown t:truncate() @@ -587,11 +587,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -615,15 +615,15 @@ c2("t:replace{2, 18}") ... c2:commit() -- T2 --- -- +- null ... c1("t:delete{2}") --- -- +- null ... c1("t:get{2}") -- finds nothing --- -- +- null ... c1:commit() -- rollback --- @@ -647,11 +647,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -679,7 +679,7 @@ c2("t:replace{1, 21}") ... c1:commit() -- ok --- -- +- null ... c2:commit() -- rollback -- conflict --- @@ -703,11 +703,11 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... -- select * from test where value % 3 = 0 c1("t:select()") -- {1, 10}, {2, 20} @@ -728,7 +728,7 @@ c2("t:replace{4, 42}") ... c1:commit() -- ok --- -- +- null ... c2:commit() -- rollback --- @@ -752,7 +752,7 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -764,7 +764,7 @@ c1("t:get{2}") -- {2, 20} ... c2:begin() --- -- +- null ... c2("t:replace{2, 25}") --- @@ -772,11 +772,11 @@ c2("t:replace{2, 25}") ... c2:commit() -- ok --- -- +- null ... c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 10} --- @@ -788,7 +788,7 @@ c3("t:get{2}") -- {2, 25} ... c3:commit() -- ok --- -- +- null ... c1("t:replace{1, 0}") --- @@ -816,7 +816,7 @@ t:replace{2, 20} ... c1:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -828,7 +828,7 @@ c1("t:get{2}") -- {2, 20} ... c2:begin() --- -- +- null ... c2("t:replace{2, 25}") --- @@ -836,11 +836,11 @@ c2("t:replace{2, 25}") ... c2:commit() -- ok --- -- +- null ... c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 10} --- @@ -852,12 +852,12 @@ c3("t:get{2}") -- {2, 25} ... c3:commit() -- ok --- -- +- null ... -- c1("t:replace{1, 0)") c1:commit() -- ok --- -- +- null ... -- teardown t:truncate() diff --git a/test/vinyl/mvcc.result b/test/vinyl/mvcc.result index 1941744b9..db7fc8e83 100644 --- a/test/vinyl/mvcc.result +++ b/test/vinyl/mvcc.result @@ -41,29 +41,29 @@ t = box.space.test -- c1:begin() --- -- +- null ... c1:commit() --- -- +- null ... -- -- empty transaction rollback -- c1:begin() --- -- +- null ... c1:rollback() --- -- +- null ... -- -- single-statement transaction commit -- c1:begin() --- -- +- null ... c1("t:replace{1}") --- @@ -71,7 +71,7 @@ c1("t:replace{1}") ... c1:commit() --- -- +- null ... c1("t:get{1}") --- @@ -80,14 +80,14 @@ c1("t:get{1}") -- cleanup c1("t:delete{1}") --- -- +- null ... -- -- single-statement transaction rollback -- c1:begin() --- -- +- null ... c1("t:replace{1}") --- @@ -95,18 +95,18 @@ c1("t:replace{1}") ... c1:rollback() --- -- +- null ... c1("t:get{1}") --- -- +- null ... -- -- basic effects: if a transaction is rolled back, it has no effect -- c1:begin() --- -- +- null ... c1("t:insert{1}") --- @@ -118,15 +118,15 @@ c1("t:get{1}") ... c1:rollback() --- -- +- null ... c1("t:get{1}") --- -- +- null ... c2("t:get{1}") --- -- +- null ... -- -- multi-statement transaction @@ -137,7 +137,7 @@ test_run:cmd("setopt delimiter ';'") ... c1:begin(); --- -- +- null ... for i = 1,100 do c1(string.format("t:insert{%d}", i)) @@ -147,7 +147,7 @@ end; ... c1:commit(); --- -- +- null ... for i = 1,100 do c1(string.format("t:delete{%d}", i)) @@ -155,7 +155,7 @@ end; --- ... for i = 1,100 do - assert(#c1(string.format("t:get{%d}", i)) == 0) + assert(c1(string.format("t:get{%d}", i)) == nil) end; --- ... @@ -172,7 +172,7 @@ test_run:cmd("setopt delimiter ';'") ... c1:begin(); --- -- +- null ... for i = 1,100 do c1(string.format("t:insert{%d}", i)) @@ -182,10 +182,10 @@ end; ... c1:rollback(); --- -- +- null ... for i = 1,100 do - assert(#c1(string.format("t:get{%d}", i)) == 0) + assert(c1(string.format("t:get{%d}", i)) == nil) end; --- ... @@ -196,7 +196,7 @@ test_run:cmd("setopt delimiter ''"); -- transaction_set_set_get_commit(void) c1:begin() --- -- +- null ... c1("t:replace{1, 1}") --- @@ -212,7 +212,7 @@ c1("t:get{1}") ... c1:commit() --- -- +- null ... c1("t:get{1}") --- @@ -220,12 +220,12 @@ c1("t:get{1}") ... c1("t:delete{1}") --- -- +- null ... -- transaction_set_set_commit_get(void) c1:begin() --- -- +- null ... c1("t:replace{1}") --- @@ -237,11 +237,11 @@ c1("t:replace{1, 2}") ... c1:commit() --- -- +- null ... c2:begin() --- -- +- null ... c2("t:get{1}") --- @@ -249,16 +249,16 @@ c2("t:get{1}") ... c2:rollback() --- -- +- null ... c1("t:delete{1}") --- -- +- null ... -- transaction_set_set_rollback_get(void) c1:begin() --- -- +- null ... c1("t:replace{1}") --- @@ -270,24 +270,24 @@ c1("t:replace{1, 2}") ... c1:rollback() --- -- +- null ... c2:begin() --- -- +- null ... c2("t:get{1}") --- -- +- null ... c2:rollback() --- -- +- null ... -- transaction_set_delete_get_commit(void) c1:begin() --- -- +- null ... c1("t:insert{1}") --- @@ -295,20 +295,20 @@ c1("t:insert{1}") ... c1("t:delete{1}") --- -- +- null ... c1("t:get{1}") --- -- +- null ... c1:commit() --- -- +- null ... -- transaction_set_delete_get_commit_get(void) c1:begin() --- -- +- null ... c1("t:insert{1}") --- @@ -316,26 +316,26 @@ c1("t:insert{1}") ... c1("t:delete{1}") --- -- +- null ... c1("t:get{1}") --- -- +- null ... c1:commit() --- -- +- null ... c1("t:get{1}") --- -- +- null ... -- -- transaction_set_delete_set_commit_get(void) -- c1:begin() --- -- +- null ... c1("t:insert{1, 1}") --- @@ -343,7 +343,7 @@ c1("t:insert{1, 1}") ... c1("t:delete{1}") --- -- +- null ... c1("t:insert{1, 2}") --- @@ -355,7 +355,7 @@ c1("t:get{1}") ... c1:commit() --- -- +- null ... c2("t:get{1}") --- @@ -366,14 +366,14 @@ c2("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -- transaction_set_delete_commit_get_set(void) -- c1:begin() --- -- +- null ... c1("t:insert{1}") --- @@ -381,15 +381,15 @@ c1("t:insert{1}") ... c1("t:delete{1}") --- -- +- null ... c1:commit() --- -- +- null ... c1("t:get{1}") --- -- +- null ... c1("t:insert{1}") --- @@ -401,22 +401,22 @@ c1("t:get{1}") ... c1("t:delete{1}") --- -- +- null ... c1("t:get{1}") --- -- +- null ... -- -- transaction_p_set_commit(void) -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:replace{1, 10}") --- @@ -424,7 +424,7 @@ c1("t:replace{1, 10}") ... c1:commit() --- -- +- null ... c2("t:replace{2, 15}"); --- @@ -432,7 +432,7 @@ c2("t:replace{2, 15}"); ... c2:commit() --- -- +- null ... c1("t:get{1}") --- @@ -444,11 +444,11 @@ c1("t:get{2}") ... c1("t:delete{1}") --- -- +- null ... c1("t:delete{2}") --- -- +- null ... -- -- no dirty reads: if a transaction is not committed, its effects are not @@ -456,7 +456,7 @@ c1("t:delete{2}") -- c1:begin() --- -- +- null ... c1("t:insert{1}") --- @@ -471,11 +471,11 @@ c1("t:get{1}") -- c2("t:get{1}") --- -- +- null ... c1:commit() --- -- +- null ... -- -- become visible in c2 after c1 commits (c2 runs in autocommit) @@ -491,7 +491,7 @@ c2("t:get{1}") -- c1:begin() --- -- +- null ... c1("t:get{1}") --- @@ -510,7 +510,7 @@ c1("t:get{1}") ... c2:commit() --- -- +- null ... -- -- still not visible, even though c2 has committed @@ -522,7 +522,7 @@ c1("t:get{1}") -- commits ok since is a read only transaction c1:commit() --- -- +- null ... -- -- now visible @@ -533,7 +533,7 @@ c1("t:get{1}") ... c1("t:delete{1}") --- -- +- null ... -- ******************************* -- tx manager tests from sophia * @@ -544,19 +544,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c1("t:replace{1, 10}") --- @@ -569,7 +569,7 @@ c1("t:get{1}") -- {1, 10} -- c1:commit() --- -- +- null ... -- -- @@ -585,18 +585,18 @@ c2("t:get{2}") -- {2, 15} -- c2:commit() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... c1("t:delete{2}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -605,19 +605,19 @@ c1("t:delete{2}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -627,7 +627,7 @@ c1("t:replace{1, 10}") -- c1:commit() --- -- +- null ... -- c2("t:replace{2, 15}") @@ -636,12 +636,12 @@ c2("t:replace{2, 15}") ... c2:commit() --- -- +- null ... -- c1:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -654,18 +654,18 @@ c1("t:get{2}") -- {2, 15} ... c1:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... c1("t:delete{2}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_p_set_commit_get1(void) @@ -673,19 +673,19 @@ c1("t:delete{2}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") --- -- +- null ... c2("t:get{200}") --- -- +- null ... -- c2("t:replace{1, 10}") @@ -694,7 +694,7 @@ c2("t:replace{1, 10}") ... c2:commit() --- -- +- null ... -- -- try writing an unrelated key @@ -705,12 +705,12 @@ c1("t:replace{2, 15}") ... c1:commit() --- -- +- null ... -- c2:begin() --- -- +- null ... c2("t:get{1}") -- {1, 10} --- @@ -718,37 +718,37 @@ c2("t:get{1}") -- {1, 10} ... c2:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... c1("t:delete{2}") --- -- +- null ... -- -- -- now try the same key -- -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") --- -- +- null ... c2("t:get{200}") --- -- +- null ... -- c2("t:replace{1, 10}") @@ -757,7 +757,7 @@ c2("t:replace{1, 10}") ... c2:commit() --- -- +- null ... -- c1("t:replace{1, 15}") @@ -766,12 +766,12 @@ c1("t:replace{1, 15}") ... c1:commit() --- -- +- null ... -- c2:begin() --- -- +- null ... c2("t:get{1}") -- {1, 15} --- @@ -779,14 +779,14 @@ c2("t:get{1}") -- {1, 15} ... c2:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_p_set_commit_get2(void) @@ -794,19 +794,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") --- -- +- null ... c2("t:get{200}") --- -- +- null ... -- -- @@ -816,7 +816,7 @@ c1("t:replace{2, 15}") ... c1:commit() --- -- +- null ... -- -- @@ -826,12 +826,12 @@ c2("t:replace{1, 10}") ... c2:commit() -- commits successfully --- -- +- null ... -- c1:begin() --- -- +- null ... c1("t:get{1}") -- {1, 10} --- @@ -844,18 +844,18 @@ c1("t:get{2}") -- {2, 15} ... c1:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... c1("t:delete{2}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_p_set_rollback_get0(void) @@ -863,19 +863,19 @@ c1("t:delete{2}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") --- -- +- null ... c2("t:get{200}") --- -- +- null ... -- -- @@ -885,7 +885,7 @@ c1("t:replace{1, 10}") ... c1:rollback() --- -- +- null ... -- c2("t:replace{2, 15}") @@ -894,24 +894,24 @@ c2("t:replace{2, 15}") ... c2:rollback() --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:get{1}") -- finds nothing --- -- +- null ... c3("t:get{2}") -- finds nothing --- -- +- null ... c3:rollback() --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_p_set_rollback_get1(void) @@ -920,19 +920,19 @@ c3:rollback() -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 10}") @@ -941,7 +941,7 @@ c2("t:replace{1, 10}") ... c2:rollback() --- -- +- null ... -- c1("t:replace{2, 15}") @@ -950,24 +950,24 @@ c1("t:replace{2, 15}") ... c1:rollback() --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:get{1}") -- finds nothing --- -- +- null ... c3("t:get{2}") -- finds nothing --- -- +- null ... c3:rollback() --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -976,19 +976,19 @@ c3:rollback() -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- -- @@ -998,7 +998,7 @@ c2("t:replace{1, 10}") ... c2:rollback() --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1007,29 +1007,29 @@ c1("t:replace{1, 15}") ... c1:rollback() --- -- +- null ... -- c3("t:get{1}") -- finds nothing --- -- +- null ... -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- -- @@ -1039,7 +1039,7 @@ c2("t:replace{1, 10}") ... c2:rollback() --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1048,7 +1048,7 @@ c1("t:replace{1, 15}") ... c1:commit() --- -- +- null ... -- c3("t:get{1}") -- {1, 15} @@ -1060,7 +1060,7 @@ c3("t:get{1}") -- {1, 15} -- c3("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_c_set_commit0(void) @@ -1068,19 +1068,19 @@ c3("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c1("t:replace{1, 10}") --- @@ -1088,7 +1088,7 @@ c1("t:replace{1, 10}") ... c1:commit() --- -- +- null ... -- c2("t:replace{1, 15}") @@ -1097,7 +1097,7 @@ c2("t:replace{1, 15}") ... c2:commit() --- -- +- null ... -- c2("t:get{1}") -- {1,15} @@ -1108,7 +1108,7 @@ c2("t:get{1}") -- {1,15} -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_c_set_commit1(void) @@ -1116,19 +1116,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 10}") @@ -1137,7 +1137,7 @@ c2("t:replace{1, 10}") ... c2:commit() --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1146,7 +1146,7 @@ c1("t:replace{1, 15}") ... c1:commit() --- -- +- null ... -- c3("t:get{1}") -- {1, 15} @@ -1158,7 +1158,7 @@ c3("t:get{1}") -- {1, 15} -- c3("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_c_set_commit2(void) @@ -1166,19 +1166,19 @@ c3("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1193,11 +1193,11 @@ c2("t:replace{1, 10}") -- c2:commit() --- -- +- null ... c1:commit() --- -- +- null ... -- c3("t:get{1}") -- {1, 15} @@ -1209,24 +1209,24 @@ c3("t:get{1}") -- {1, 15} -- c1("t:delete{1}") --- -- +- null ... -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1242,11 +1242,11 @@ c2("t:replace{1, 10}") -- sic: commit order c1:commit() --- -- +- null ... c2:commit() -- write after write is ok, the last writer to commit wins --- -- +- null ... -- c3("t:get{1}") -- {1, 10} @@ -1258,7 +1258,7 @@ c3("t:get{1}") -- {1, 10} -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_c_set_commit_rollback_a0(void) @@ -1266,19 +1266,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 10}") @@ -1288,7 +1288,7 @@ c2("t:replace{1, 10}") -- c2:rollback() --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1298,7 +1298,7 @@ c1("t:replace{1, 15}") -- c1:commit() --- -- +- null ... -- c3("t:get{1}") @@ -1310,26 +1310,26 @@ c3("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -- -- statement order is irrelevant, rollback order is important c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1343,11 +1343,11 @@ c2("t:replace{1, 15}") -- c2:rollback() --- -- +- null ... c1:commit() --- -- +- null ... -- c3("t:get{1}") @@ -1359,7 +1359,7 @@ c3("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_c_set_commit_rollback_a1(void) @@ -1367,19 +1367,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 10}") @@ -1393,37 +1393,37 @@ c1("t:replace{1, 15}") -- c2:rollback() --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- statements in different order now -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1437,18 +1437,18 @@ c2("t:replace{1, 15}") -- c2:rollback() --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1457,19 +1457,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 10}") @@ -1478,7 +1478,7 @@ c2("t:replace{1, 10}") ... c2:commit() -- success --- -- +- null ... -- c1("t:replace{1, 15}") @@ -1487,7 +1487,7 @@ c1("t:replace{1, 15}") ... c1:rollback() -- success --- -- +- null ... -- c3("t:get{1}") @@ -1498,7 +1498,7 @@ c3("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_c_set_commit_rollback_b1(void) @@ -1506,19 +1506,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 15}") @@ -1532,11 +1532,11 @@ c1("t:replace{1, 10}") -- c2:commit() --- -- +- null ... c1:rollback() --- -- +- null ... -- c3("t:get{1}") @@ -1548,26 +1548,26 @@ c3("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -- now commit the second transaction -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 15}") @@ -1581,11 +1581,11 @@ c1("t:replace{1, 10}") -- c2:commit() --- -- +- null ... c1:commit() -- ok, the last committer wins --- -- +- null ... -- c3("t:get{1}") -- {1, 10} @@ -1597,7 +1597,7 @@ c3("t:get{1}") -- {1, 10} -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1606,19 +1606,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 15}") @@ -1627,7 +1627,7 @@ c2("t:replace{1, 15}") ... c2:rollback() --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1636,38 +1636,38 @@ c1("t:replace{1, 10}") ... c1:rollback() --- -- +- null ... -- c3("t:get{1}") --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- now commit the second transaction -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 15}") @@ -1676,7 +1676,7 @@ c2("t:replace{1, 15}") ... c2:rollback() --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1685,7 +1685,7 @@ c1("t:replace{1, 10}") ... c1:commit() --- -- +- null ... -- c3("t:get{1}") @@ -1697,7 +1697,7 @@ c3("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1706,19 +1706,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 10}") @@ -1732,23 +1732,23 @@ c1("t:replace{1, 15}") -- c2:rollback() --- -- +- null ... c1:rollback() --- -- +- null ... -- c3("t:get{1}") --- -- +- null ... -- -- cleanup -- c2("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1757,19 +1757,19 @@ c2("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c2("t:replace{1, 15}") @@ -1784,11 +1784,11 @@ c1("t:replace{1, 10}") -- c1:commit() -- success --- -- +- null ... c2:commit() -- success, the last writer wins --- -- +- null ... -- c2("t:get{1}") -- {1, 15} @@ -1800,7 +1800,7 @@ c2("t:get{1}") -- {1, 15} -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1809,19 +1809,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1836,18 +1836,18 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c1:commit() -- success, the last writer wins --- -- +- null ... -- -- cleanup -- c2("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1856,19 +1856,19 @@ c2("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1883,18 +1883,18 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1903,19 +1903,19 @@ c1("t:delete{1}") -- c2:begin() --- -- +- null ... c1:begin() --- -- +- null ... c2("t:get{100}") -- start transaction in the engine --- -- +- null ... c1("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1930,18 +1930,18 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1950,19 +1950,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -1977,18 +1977,18 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -1997,19 +1997,19 @@ c1("t:delete{1}") -- c2:begin() --- -- +- null ... c1:begin() --- -- +- null ... c2("t:get{100}") -- start transaction in the engine --- -- +- null ... c1("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -2024,18 +2024,18 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c1:rollback() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2044,19 +2044,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -2071,22 +2071,22 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c2:rollback() -- not in transaction --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2095,19 +2095,19 @@ c1("t:delete{1}") -- c2:begin() --- -- +- null ... c1:begin() --- -- +- null ... c2("t:get{100}") -- start transaction in the engine --- -- +- null ... c1("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -2122,26 +2122,26 @@ c2("t:replace{1, 15}") -- c2:commit() -- success --- -- +- null ... c2:rollback() -- not in transaction --- -- +- null ... c1:commit() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... c1("t:delete{2}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2150,27 +2150,27 @@ c1("t:delete{2}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c3:begin() --- -- +- null ... c3("t:get{300}") -- start transaction in the engine --- -- +- null ... -- -- @@ -2191,23 +2191,23 @@ c3("t:replace{1, 20}") -- c2:commit() -- success --- -- +- null ... c3:commit() -- success --- -- +- null ... c1:commit() -- success, the last committer wins --- -- +- null ... c2:commit() -- not in transaction --- -- +- null ... c3:commit() -- not in transaction --- -- +- null ... -- c3:get{1} -- {1, 20} @@ -2219,7 +2219,7 @@ c3:get{1} -- {1, 20} -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2228,27 +2228,27 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c3:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c3("t:get{200}") -- start transaction in the engine --- -- +- null ... c2("t:get{300}") -- start transaction in the engine --- -- +- null ... -- -- @@ -2269,15 +2269,15 @@ c3("t:replace{1, 30}") -- c1:commit() -- success --- -- +- null ... c2:commit() -- success --- -- +- null ... c3:commit() -- success --- -- +- null ... -- c3("t:get{1}") -- {1, 30} @@ -2288,7 +2288,7 @@ c3("t:get{1}") -- {1, 30} -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2297,27 +2297,27 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c3("t:get{300}") -- start transaction in the engine --- -- +- null ... -- -- @@ -2338,22 +2338,22 @@ c3("t:replace{1, 20}") -- c2:commit() -- success --- -- +- null ... c3:commit() -- rollback --- -- +- null ... c1:rollback() -- success --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2362,27 +2362,27 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c3("t:get{300}") -- start transaction in the engine --- -- +- null ... -- -- @@ -2403,30 +2403,30 @@ c3("t:replace{1, 20}") -- c2:commit() -- success --- -- +- null ... c3:commit() -- rollback --- -- +- null ... c2:rollback() -- success, not in transaction in tarantool --- -- +- null ... c3:commit() -- success, not in transaction in tarantool --- -- +- null ... c1:commit() -- rollback --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2435,27 +2435,27 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c3("t:get{300}") -- start transaction in the engine --- -- +- null ... -- -- @@ -2476,22 +2476,22 @@ c3("t:replace{1, 20}") -- c3:rollback() --- -- +- null ... c2:commit() --- -- +- null ... c1:commit() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2500,27 +2500,27 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c3("t:get{300}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -2540,22 +2540,22 @@ c3("t:replace{1, 20}") -- c2:commit() --- -- +- null ... c3:rollback() --- -- +- null ... c1:commit() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2564,27 +2564,27 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c3("t:get{300}") -- start transaction in the engine --- -- +- null ... -- -- @@ -2605,22 +2605,22 @@ c3("t:replace{1, 20}") -- c2:commit() --- -- +- null ... c3:rollback() --- -- +- null ... c1:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2629,19 +2629,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -2650,7 +2650,7 @@ c1("t:replace{1, 10}") ... c1:commit() --- -- +- null ... -- c2("t:get{1}") -- find newest {1, 10} @@ -2664,12 +2664,12 @@ c2("t:replace{1, 15}") ... c2:commit() -- rollback --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 10} --- @@ -2677,14 +2677,14 @@ c3("t:get{1}") -- {1, 10} ... c3:commit() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2693,19 +2693,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... -- c1("t:replace{1, 10}") @@ -2715,12 +2715,12 @@ c1("t:replace{1, 10}") -- c1:rollback() --- -- +- null ... -- c2("t:get{1}") -- finds nothing --- -- +- null ... -- c2("t:replace{1, 15}") @@ -2729,12 +2729,12 @@ c2("t:replace{1, 15}") ... c2:commit() --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 15} --- @@ -2742,14 +2742,14 @@ c3("t:get{1}") -- {1, 15} ... c3:commit() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2758,15 +2758,15 @@ c1("t:delete{1}") -- c7:begin() --- -- +- null ... c7("t:get{100}") -- start transaction in the engine --- -- +- null ... c1:begin() --- -- +- null ... -- c1("t:replace{1, 1}") @@ -2776,7 +2776,7 @@ c1("t:replace{1, 1}") -- c2:begin() --- -- +- null ... -- c2("t:replace{1, 2}") @@ -2786,7 +2786,7 @@ c2("t:replace{1, 2}") -- c4:begin() --- -- +- null ... c4("t:replace{1, 4}") --- @@ -2795,7 +2795,7 @@ c4("t:replace{1, 4}") -- c5:begin() --- -- +- null ... c5("t:replace{1, 5}") --- @@ -2804,11 +2804,11 @@ c5("t:replace{1, 5}") -- c6:begin() --- -- +- null ... c6("t:get{100}") -- start transaction in the engine --- -- +- null ... -- c1("t:get{1}") -- {1, 1} @@ -2833,62 +2833,62 @@ c5("t:get{1}") -- {1, 5} -- c6("t:get{1}") -- nothing --- -- +- null ... -- c7("t:get{1}") -- nothing --- -- +- null ... -- c3:begin() --- -- +- null ... -- c3("t:get{1}") -- nothing --- -- +- null ... c3:rollback() --- -- +- null ... -- c1:rollback() --- -- +- null ... c2:rollback() --- -- +- null ... c3:rollback() --- -- +- null ... c4:rollback() --- -- +- null ... c5:rollback() --- -- +- null ... c6:rollback() --- -- +- null ... c7:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -2897,24 +2897,24 @@ c1("t:delete{1}") -- c7:begin() --- -- +- null ... c1:begin() --- -- +- null ... c7("t:get{100}") -- start transaction in the engine --- -- +- null ... c1("t:get{1}") -- start transaction in the engine --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:replace{1, 3}") --- @@ -2922,24 +2922,24 @@ c3("t:replace{1, 3}") ... c3:commit() --- -- +- null ... -- c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c2("t:get{500}") -- start transaction in the engine --- -- +- null ... c3("t:get{600}") -- start transaction in the engine --- -- +- null ... c2("t:get{1}") -- {1, 3} --- @@ -2952,16 +2952,16 @@ c3("t:replace{1, 6}") ... c3:commit() -- c2 goes to read view now --- -- +- null ... -- c4:begin() --- -- +- null ... c3:begin() --- -- +- null ... -- c3("t:replace{1, 9}") @@ -2970,24 +2970,24 @@ c3("t:replace{1, 9}") ... c3:commit() --- -- +- null ... -- c5:begin() --- -- +- null ... c3:begin() --- -- +- null ... c5("t:get{800}") -- start transaction in the engine --- -- +- null ... c3("t:get{900}") -- start transaction in the engine --- -- +- null ... -- c3("t:replace{1, 12}") @@ -2996,16 +2996,16 @@ c3("t:replace{1, 12}") ... c3:commit() --- -- +- null ... -- c6:begin() --- -- +- null ... c6("t:get{1000}") -- start transaction in the engine --- -- +- null ... -- c2("t:get{1}") -- {1, 3} @@ -3030,7 +3030,7 @@ c6("t:get{1}") -- {1, 12} -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 12} --- @@ -3038,12 +3038,12 @@ c3("t:get{1}") -- {1, 12} ... c3:rollback() --- -- +- null ... -- c1("t:get{1}") -- nothing --- -- +- null ... -- c7("t:get{1}") -- {1, 12} @@ -3053,7 +3053,7 @@ c7("t:get{1}") -- {1, 12} -- c2:rollback() --- -- +- null ... -- c4("t:get{1}") -- {1, 12} @@ -3073,7 +3073,7 @@ c6("t:get{1}") -- {1, 12} -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 12} --- @@ -3081,12 +3081,12 @@ c3("t:get{1}") -- {1, 12} ... c3:rollback() --- -- +- null ... -- c1("t:get{1}") -- nothing --- -- +- null ... -- c7("t:get{1}") -- {1, 12} @@ -3096,7 +3096,7 @@ c7("t:get{1}") -- {1, 12} -- c4:rollback() --- -- +- null ... -- c5("t:get{1}") -- {1, 12} @@ -3111,7 +3111,7 @@ c6("t:get{1}") -- {1, 12} -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 12} --- @@ -3119,12 +3119,12 @@ c3("t:get{1}") -- {1, 12} ... c3:rollback() --- -- +- null ... -- c1("t:get{1}") -- nothing --- -- +- null ... -- c7("t:get{1}") -- {1, 12} @@ -3134,7 +3134,7 @@ c7("t:get{1}") -- {1, 12} -- c5:rollback() --- -- +- null ... -- c6("t:get{1}") -- {1, 12} @@ -3144,7 +3144,7 @@ c6("t:get{1}") -- {1, 12} -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 12} --- @@ -3152,12 +3152,12 @@ c3("t:get{1}") -- {1, 12} ... c3:rollback() --- -- +- null ... -- c1("t:get{1}") -- nothing --- -- +- null ... -- c7("t:get{1}") -- {1, 12} @@ -3167,12 +3167,12 @@ c7("t:get{1}") -- {1, 12} -- c6:rollback() --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 12} --- @@ -3180,12 +3180,12 @@ c3("t:get{1}") -- {1, 12} ... c3:rollback() --- -- +- null ... -- c1("t:get{1}") -- nothing --- -- +- null ... -- c7("t:get{1}") -- {1, 12} @@ -3195,16 +3195,16 @@ c7("t:get{1}") -- {1, 12} -- c1:rollback() --- -- +- null ... c7:rollback() --- -- +- null ... -- c3:begin() --- -- +- null ... c3("t:get{1}") -- {1, 12} --- @@ -3212,14 +3212,14 @@ c3("t:get{1}") -- {1, 12} ... c3:rollback() --- -- +- null ... -- -- cleanup -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -3228,19 +3228,19 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:get{100}") -- start transaction in the engine --- -- +- null ... c2("t:get{200}") -- start transaction in the engine --- -- +- null ... c1("t:replace{1, 10}") --- @@ -3253,7 +3253,7 @@ c2("t:replace{1, 15}") -- c1:commit() --- -- +- null ... -- c2("t:replace{1, 20}") -- should not reset conflict flag @@ -3263,7 +3263,7 @@ c2("t:replace{1, 20}") -- should not reset conflict flag -- c2:commit() -- rollback --- -- +- null ... -- c3("t:get{1}") @@ -3275,7 +3275,7 @@ c3("t:get{1}") -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -3284,7 +3284,7 @@ c1("t:delete{1}") -- c1:begin() --- -- +- null ... -- c1("t:replace{1, 10}") @@ -3301,7 +3301,7 @@ c2("t:replace{1, 15}") -- c1:commit() --- -- +- null ... -- c2("t:get{1}") -- {1, 10} @@ -3311,7 +3311,7 @@ c2("t:get{1}") -- {1, 10} -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- transaction_sc_get(void) @@ -3324,7 +3324,7 @@ c1("t:replace{1, 7}") -- c2:begin() --- -- +- null ... -- c2("t:replace{1, 8}") @@ -3339,7 +3339,7 @@ c1("t:get{1}") -- {1, 7} -- c2:commit() --- -- +- null ... -- c1("t:get{1}") -- {1, 8} @@ -3356,18 +3356,18 @@ c3("t:get{1}") -- {1, 8} -- c1("t:delete{1}") --- -- +- null ... -- -------------------------------------------------------------------------- -- two conflicting inserts -- -------------------------------------------------------------------------- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... -- c1("t:insert{1, 10}") @@ -3382,7 +3382,7 @@ c2("t:insert{1, 15}") -- c1:commit() -- success --- -- +- null ... c2:commit() -- rollback, c2 reads {1} before writing it --- @@ -3399,16 +3399,16 @@ c3("t:get{1}") -- {1, 10} -- c1("t:delete{1}") --- -- +- null ... -- c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... -- c1("t:insert{1, 10}") @@ -3423,7 +3423,7 @@ c2("t:insert{1, 15}") -- c2:commit() -- success --- -- +- null ... c1:commit() -- rollback, c1 reads {1} before writing it --- @@ -3440,7 +3440,7 @@ c3("t:get{1}") -- {1, 15} -- c1("t:delete{1}") --- -- +- null ... -- -- -------------------------------------------------------------------------- @@ -3456,7 +3456,7 @@ t:insert{2, 20} ... c7:begin() --- -- +- null ... c7("t:insert{8, 800}") --- @@ -3464,7 +3464,7 @@ c7("t:insert{8, 800}") ... c3:begin() --- -- +- null ... c3("t:get{1}") --- @@ -3472,15 +3472,15 @@ c3("t:get{1}") ... c3:commit() --- -- +- null ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... -- c1("t:replace{4, 40}") @@ -3495,7 +3495,7 @@ c2("t:get{1}") -- c3:begin() --- -- +- null ... c3("t:insert{3, 30}") --- @@ -3503,7 +3503,7 @@ c3("t:insert{3, 30}") ... c3:commit() --- -- +- null ... -- c2("t:replace{5, 50}") @@ -3516,15 +3516,15 @@ c1("t:get{1}") ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... c7:rollback() --- -- +- null ... -- -- cleanup @@ -3557,11 +3557,11 @@ t:insert{2, 20} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:select{}") --- @@ -3581,7 +3581,7 @@ c2("t:replace{2, 'new'}") ... c1:commit() --- -- +- null ... c2:commit() -- rollback --- @@ -3593,7 +3593,7 @@ c2:commit() -- rollback -- c1:begin() --- -- +- null ... c1("t:select{}") --- @@ -3645,7 +3645,7 @@ c1("t:select({3}, {iterator='eq'})") ... c1("t:delete{3}") --- -- +- null ... c1("t:select({3}, {iterator='ge'})") --- @@ -3669,7 +3669,7 @@ c1("t:replace{3}") ... c1("t:delete{2}") --- -- +- null ... c1("t:select({3}, {iterator='lt'})") --- @@ -3685,7 +3685,7 @@ c1("t:replace{2}") ... c1("t:delete{1}") --- -- +- null ... c1("t:select({3}, {iterator='lt'})") --- @@ -3697,7 +3697,7 @@ c1("t:select({3}, {iterator='le'})") ... c1("t:delete{3}") --- -- +- null ... c1("t:select({3}, {iterator='lt'})") --- @@ -3709,7 +3709,7 @@ c1("t:select({3}, {iterator='le'})") ... c1:rollback() --- -- +- null ... c1("t:select{}") --- @@ -3722,7 +3722,7 @@ c1("t:select{}") -- c1:begin() --- -- +- null ... c1("t:select{1}") --- @@ -3734,11 +3734,11 @@ c1("for k, v in box.space.test:pairs() do box.commit() end") ... c1:rollback() --- -- +- null ... c1:begin() --- -- +- null ... c1("t:select{1}") --- @@ -3750,7 +3750,7 @@ c1("for k, v in box.space.test:pairs() do box.rollback() end") ... c1:rollback() --- -- +- null ... t:truncate() --- @@ -3764,7 +3764,7 @@ t:replace{1} ... c1:begin() --- -- +- null ... c1("t.index.pk:max()") -- {1} --- @@ -3780,7 +3780,7 @@ c1("t.index.pk:count()") -- 1 ... c2:begin() --- -- +- null ... c2("t:replace{2}") -- conflicts with c1 so c1 starts using a read view --- @@ -3788,7 +3788,7 @@ c2("t:replace{2}") -- conflicts with c1 so c1 starts using a read view ... c2:commit() --- -- +- null ... c1("t.index.pk:max()") -- {1} --- @@ -3804,7 +3804,7 @@ c1("t.index.pk:count()") -- 1 ... c1:commit() --- -- +- null ... -- -- Convert the reader to a read view: in this test we have @@ -3813,7 +3813,7 @@ c1:commit() -- c1:begin() --- -- +- null ... c1("t.index.pk:max()") -- {2} --- @@ -3829,7 +3829,7 @@ c1("t.index.pk:count()") -- 2 ... c2:begin() --- -- +- null ... c2("t:replace{1, 'new'}") -- conflits with c1 so c1 starts using a read view --- @@ -3841,7 +3841,7 @@ c2("t:replace{3}") ... c2:commit() --- -- +- null ... c1("t.index.pk:max()") -- {2} --- @@ -3857,7 +3857,7 @@ c1("t.index.pk:count()") -- 2 ... c1:commit() --- -- +- null ... t:truncate() --- @@ -3876,7 +3876,7 @@ t:replace{2} ... c1:begin() --- -- +- null ... c1("t:select({}, {limit = 0})") -- none --- @@ -3884,7 +3884,7 @@ c1("t:select({}, {limit = 0})") -- none ... c2:begin() --- -- +- null ... c2("t:replace{1, 'new'}") --- @@ -3892,7 +3892,7 @@ c2("t:replace{1, 'new'}") ... c2:commit() --- -- +- null ... c1("t:select({}, {limit = 1})") -- {1, 'new'} --- @@ -3900,7 +3900,7 @@ c1("t:select({}, {limit = 1})") -- {1, 'new'} ... c2:begin() --- -- +- null ... c2("t:replace{2, 'new'}") --- @@ -3908,7 +3908,7 @@ c2("t:replace{2, 'new'}") ... c2:commit() --- -- +- null ... c1("t:select()") -- {1, 'new'}, {2, 'new'} --- @@ -3916,7 +3916,7 @@ c1("t:select()") -- {1, 'new'}, {2, 'new'} ... c1:commit() --- -- +- null ... t:truncate() --- @@ -3929,11 +3929,11 @@ _ = t:create_index('sk', {parts = {2, 'unsigned'}, unique = true}) ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("t:insert{1, 2}") --- @@ -3945,7 +3945,7 @@ c2("t:insert{2, 2}") ... c1:commit() --- -- +- null ... c2:commit() -- rollback --- @@ -4034,19 +4034,19 @@ c4 = txn_proxy.new() ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c4:begin() --- -- +- null ... box.stat.vinyl().tx.read_views -- 0 (no read views needed) --- @@ -4094,7 +4094,7 @@ box.stat.vinyl().tx.transactions -- 4 ... c4:commit() --- -- +- null ... box.stat.vinyl().tx.read_views -- 1 (one read view for all TXs) --- @@ -4106,7 +4106,7 @@ box.stat.vinyl().tx.transactions -- 3 ... c1:commit() --- -- +- null ... box.stat.vinyl().tx.read_views -- 1 (one read view for all TXs) --- @@ -4118,7 +4118,7 @@ box.stat.vinyl().tx.transactions -- 2 ... c2:rollback() --- -- +- null ... box.stat.vinyl().tx.read_views -- 1 (one read view for all TXs) --- @@ -4130,7 +4130,7 @@ box.stat.vinyl().tx.transactions -- 1 ... c3:commit() --- -- +- null ... box.stat.vinyl().tx.read_views -- 0 (no read views needed) --- diff --git a/test/vinyl/mvcc.test.lua b/test/vinyl/mvcc.test.lua index 79b1f3428..9455e66fa 100644 --- a/test/vinyl/mvcc.test.lua +++ b/test/vinyl/mvcc.test.lua @@ -73,7 +73,7 @@ for i = 1,100 do c1(string.format("t:delete{%d}", i)) end; for i = 1,100 do - assert(#c1(string.format("t:get{%d}", i)) == 0) + assert(c1(string.format("t:get{%d}", i)) == nil) end; test_run:cmd("setopt delimiter ''"); @@ -88,7 +88,7 @@ for i = 1,100 do end; c1:rollback(); for i = 1,100 do - assert(#c1(string.format("t:get{%d}", i)) == 0) + assert(c1(string.format("t:get{%d}", i)) == nil) end; test_run:cmd("setopt delimiter ''"); diff --git a/test/vinyl/tx_conflict.result b/test/vinyl/tx_conflict.result index 03cc62a49..7809cb1e3 100644 --- a/test/vinyl/tx_conflict.result +++ b/test/vinyl/tx_conflict.result @@ -186,7 +186,7 @@ function apply(t, k, op) table.insert(order_of_commit, t) num_committed = num_committed + 1 local res = tx.con:commit() - if res ~= "" and res[1]['error'] then + if res ~= nil and res[1]['error'] then tx.conflicted = true else tx.select_all = s1:select{} diff --git a/test/vinyl/tx_conflict.test.lua b/test/vinyl/tx_conflict.test.lua index 9208c256e..a02b87246 100644 --- a/test/vinyl/tx_conflict.test.lua +++ b/test/vinyl/tx_conflict.test.lua @@ -153,7 +153,7 @@ function apply(t, k, op) table.insert(order_of_commit, t) num_committed = num_committed + 1 local res = tx.con:commit() - if res ~= "" and res[1]['error'] then + if res ~= nil and res[1]['error'] then tx.conflicted = true else tx.select_all = s1:select{} diff --git a/test/vinyl/tx_gap_lock.result b/test/vinyl/tx_gap_lock.result index a456c017e..c1fa996b6 100644 --- a/test/vinyl/tx_gap_lock.result +++ b/test/vinyl/tx_gap_lock.result @@ -42,7 +42,7 @@ _ = s:insert{3} ... c:begin() --- -- +- null ... c("s:select()") -- {1}, {3} --- @@ -57,7 +57,7 @@ c("s:select()") -- {1}, {3} ... c:commit() --- -- +- null ... s:truncate() --- @@ -71,7 +71,7 @@ _ = s:insert{2} ... c:begin() --- -- +- null ... c("s:select()") -- {1}, {2} --- @@ -86,7 +86,7 @@ c("s:select()") -- {1}, {2} ... c:commit() --- -- +- null ... s:truncate() --- @@ -100,7 +100,7 @@ _ = s:insert{3} ... c:begin() --- -- +- null ... c("s:select()") -- {2}, {3} --- @@ -115,7 +115,7 @@ c("s:select()") -- {2}, {3} ... c:commit() --- -- +- null ... s:truncate() --- @@ -126,11 +126,11 @@ _ = s:insert{123} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("s:select({}, {iterator = 'GT'})") -- {123} --- @@ -153,11 +153,11 @@ c2("s:select({}, {iterator = 'LT'})") -- {123} ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... s:truncate() --- @@ -176,27 +176,27 @@ _ = s:insert{30} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c4:begin() --- -- +- null ... c5:begin() --- -- +- null ... c6:begin() --- -- +- null ... c1("s:select({10}, {iterator = 'GE'})") -- {10}, {20}, {30} --- @@ -254,11 +254,11 @@ _ = s:replace{15, 2} -- send c2 and c3 to read view ... c2("s:get(15)") -- none --- -- +- null ... c3("s:get(15)") -- none --- -- +- null ... c4("s:get(15)") -- {15, 2} --- @@ -277,39 +277,39 @@ _ = s:replace{35, 3} -- send c4, c5, and c6 to read view ... c4("s:get(35)") -- none --- -- +- null ... c5("s:get(35)") -- none --- -- +- null ... c6("s:get(35)") -- none --- -- +- null ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... c3:commit() --- -- +- null ... c4:commit() --- -- +- null ... c5:commit() --- -- +- null ... c6:commit() --- -- +- null ... s:truncate() --- @@ -328,27 +328,27 @@ _ = s:insert{30} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c4:begin() --- -- +- null ... c5:begin() --- -- +- null ... c6:begin() --- -- +- null ... c1("s:select({30}, {iterator = 'LE'})") -- {30}, {20}, {10} --- @@ -406,11 +406,11 @@ _ = s:replace{25, 2} -- send c2 and c3 to read view ... c2("s:get(25)") -- none --- -- +- null ... c3("s:get(25)") -- none --- -- +- null ... c4("s:get(25)") -- {25, 2} --- @@ -429,39 +429,39 @@ _ = s:replace{5, 3} -- send c4, c5, and c6 to read view ... c4("s:get(5)") -- none --- -- +- null ... c5("s:get(5)") -- none --- -- +- null ... c6("s:get(5)") -- none --- -- +- null ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... c3:commit() --- -- +- null ... c4:commit() --- -- +- null ... c5:commit() --- -- +- null ... c6:commit() --- -- +- null ... s:truncate() --- @@ -474,19 +474,19 @@ for i = 1, 9 do s:insert{i * 10} end ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c4:begin() --- -- +- null ... c1("s:select({20}, {iterator = 'GE', limit = 3})") -- {20}, {30}, {40} --- @@ -562,7 +562,7 @@ _ = s:replace{25, 4} -- send c3 to read view ... c3("s:get(25)") -- none --- -- +- null ... c4("s:get(25)") -- {25, 4} --- @@ -573,23 +573,23 @@ _ = s:replace{75, 5} -- send c4 to read view ... c4("s:get(75)") -- none --- -- +- null ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... c3:commit() --- -- +- null ... c4:commit() --- -- +- null ... s:drop() --- @@ -620,11 +620,11 @@ _ = s:insert{3, 3} ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c1("s:select({2}, {iterator = 'EQ'})") -- {2, 1}, {2, 2}, {2, 3} --- @@ -669,11 +669,11 @@ c2("s:select({2}, {iterator = 'REQ'})") -- {2, 3}, {2, 2}, {2, 1} ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... s:drop() --- @@ -708,7 +708,7 @@ gap_lock_count() -- 0 ... c:begin() --- -- +- null ... c("s:select({10}, {iterator = 'GE', limit = 4})") -- locks [10, 40] --- @@ -769,11 +769,11 @@ _ = s:insert{25} -- send c to read view ... c("s:get(25)") -- none --- -- +- null ... c:commit() --- -- +- null ... s:truncate() --- @@ -797,7 +797,7 @@ gap_lock_count() -- 0 ... c:begin() --- -- +- null ... c("s:select({1}, {iterator = 'GT', limit = 1})") -- locks (1, 10] --- @@ -842,11 +842,11 @@ _ = s:insert{5} -- send c to read view ... c("s:get(5)") -- none --- -- +- null ... c:commit() --- -- +- null ... s:truncate() --- @@ -861,7 +861,7 @@ gap_lock_count() -- 0 ... c:begin() --- -- +- null ... c("s:select({100}, {iterator = 'GT'})") -- locks (100, +inf) --- @@ -888,11 +888,11 @@ _ = s:insert{1000} -- send c to read view ... c("s:get(1000)") -- none --- -- +- null ... c:commit() --- -- +- null ... s:truncate() --- @@ -916,7 +916,7 @@ gap_lock_count() -- 0 ... c:begin() --- -- +- null ... c("s:select({1}, {iterator = 'GE', limit = 2})") -- locks [1, 2] --- @@ -932,7 +932,7 @@ gap_lock_count() -- 1 ... c:commit() --- -- +- null ... s:drop() --- @@ -950,19 +950,19 @@ gap_lock_count() -- 0 ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c4:begin() --- -- +- null ... c1("s:select({100}, {iterator = 'GE'})") -- c1: locks [{100}, +inf) --- @@ -1005,11 +1005,11 @@ _ = s:insert{100, 50} -- send c1 and c2 to read view ... c1("s:get({100, 50})") -- none --- -- +- null ... c2("s:get({100, 50})") -- none --- -- +- null ... c3("s:get({100, 50})") -- {100, 50} --- @@ -1028,7 +1028,7 @@ _ = s:insert{100, 100} -- send c3 to read view ... c3("s:get({100, 100})") -- none --- -- +- null ... c4("s:get({100, 100})") -- {100, 100} --- @@ -1043,7 +1043,7 @@ _ = s:insert{100, 101} -- send c4 to read view ... c4("s:get({100, 101})") -- none --- -- +- null ... gap_lock_count() -- 6 --- @@ -1051,19 +1051,19 @@ gap_lock_count() -- 6 ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... c3:commit() --- -- +- null ... c4:commit() --- -- +- null ... s:truncate() --- @@ -1075,19 +1075,19 @@ gap_lock_count() -- 0 ... c1:begin() --- -- +- null ... c2:begin() --- -- +- null ... c3:begin() --- -- +- null ... c4:begin() --- -- +- null ... c1("s:select({100}, {iterator = 'LE'})") -- c1: locks (-inf, {100}] --- @@ -1130,11 +1130,11 @@ _ = s:insert{100, 150} -- send c1 and c2 to read view ... c1("s:get({100, 150})") -- none --- -- +- null ... c2("s:get({100, 150})") -- none --- -- +- null ... c3("s:get({100, 150})") -- {100, 150} --- @@ -1153,7 +1153,7 @@ _ = s:insert{100, 100} -- send c3 to read view ... c3("s:get({100, 100})") -- none --- -- +- null ... c4("s:get({100, 100})") -- {100, 100} --- @@ -1168,7 +1168,7 @@ _ = s:insert{100, 99} -- send c4 to read view ... c4("s:get({100, 99})") -- none --- -- +- null ... gap_lock_count() -- 6 --- @@ -1176,19 +1176,19 @@ gap_lock_count() -- 6 ... c1:commit() --- -- +- null ... c2:commit() --- -- +- null ... c3:commit() --- -- +- null ... c4:commit() --- -- +- null ... s:drop() --- @@ -1391,7 +1391,8 @@ invalid = {}; for i = 1, TX_COUNT do local tx = tx_list[i] local v = tx.conn(string.format("s:get({%d, %d})", - conflict[1], conflict[2]))[1] + conflict[1], conflict[2])) + v = v ~= nil and v[1] or nil local was_aborted = false if v == nil or v[PAYLOAD_FIELD] == nil then was_aborted = true diff --git a/test/vinyl/tx_gap_lock.test.lua b/test/vinyl/tx_gap_lock.test.lua index 4ad558608..b57bf0426 100644 --- a/test/vinyl/tx_gap_lock.test.lua +++ b/test/vinyl/tx_gap_lock.test.lua @@ -508,7 +508,8 @@ invalid = {}; for i = 1, TX_COUNT do local tx = tx_list[i] local v = tx.conn(string.format("s:get({%d, %d})", - conflict[1], conflict[2]))[1] + conflict[1], conflict[2])) + v = v ~= nil and v[1] or nil local was_aborted = false if v == nil or v[PAYLOAD_FIELD] == nil then was_aborted = true diff --git a/test/vinyl/tx_serial.result b/test/vinyl/tx_serial.result index 37c3f4467..133fec710 100644 --- a/test/vinyl/tx_serial.result +++ b/test/vinyl/tx_serial.result @@ -152,7 +152,7 @@ function apply(t, k, op) table.insert(order_of_commit, t) num_committed = num_committed + 1 local res = tx.con:commit() - if res ~= "" and res[1]['error'] then + if res ~= nil and res[1]['error'] then tx.conflicted = true else tx.select_all = s1:select{} diff --git a/test/vinyl/tx_serial.test.lua b/test/vinyl/tx_serial.test.lua index 0a695a7e5..7395ef36a 100644 --- a/test/vinyl/tx_serial.test.lua +++ b/test/vinyl/tx_serial.test.lua @@ -123,7 +123,7 @@ function apply(t, k, op) table.insert(order_of_commit, t) num_committed = num_committed + 1 local res = tx.con:commit() - if res ~= "" and res[1]['error'] then + if res ~= nil and res[1]['error'] then tx.conflicted = true else tx.select_all = s1:select{} diff --git a/third_party/lua-yaml/lyaml.cc b/third_party/lua-yaml/lyaml.cc index 73e5d2c31..3a427263e 100644 --- a/third_party/lua-yaml/lyaml.cc +++ b/third_party/lua-yaml/lyaml.cc @@ -121,12 +121,10 @@ yaml_get_bool(const char *str, const size_t len) /** * Verify whether a string represents a null literal in YAML. - * - * Non-standard: don't match an empty string as null. */ static yaml_type yaml_get_null(const char *str, const size_t len){ - if (len == 1 && str[0] == '~') + if (len == 0 || (len == 1 && str[0] == '~')) return YAML_NULL; if (len == 4 && (strcmp(str, "null") == 0 || strcmp(str, "Null") == 0 || strcmp(str, "NULL") == 0)) @@ -259,15 +257,7 @@ static void load_scalar(struct lua_yaml_loader *loader) { if (loader->event.data.scalar.style == YAML_PLAIN_SCALAR_STYLE) { yaml_type type; - if (!length) { - /* - * Non-standard: an empty value/document is null - * according to the standard, but we decode it as an - * empty string. - */ - lua_pushliteral(loader->L, ""); - return; - } else if (yaml_get_null(str, length) == YAML_NULL) { + if (yaml_get_null(str, length) == YAML_NULL) { luaL_pushnull(loader->L); return; } else if ((type = yaml_get_bool(str, length)) != YAML_NO_MATCH) { @@ -407,8 +397,14 @@ static void load(struct lua_yaml_loader *loader) { if (!do_parse(loader)) return; - if (loader->event.type == YAML_STREAM_END_EVENT) + if (loader->event.type == YAML_STREAM_END_EVENT) { + if (loader->document_count == 0) { + /* Return null, not zero values count. */ + loader->document_count++; + luaL_pushnull(loader->L); + } return; + } loader->document_count++; if (load_node(loader) != 1) -- 2.20.1
next prev parent reply other threads:[~2019-01-22 2:13 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-01-22 2:12 [tarantool-patches] [PATCH v2 0/3] lua-yaml null/boolean fixes Alexander Turenko 2019-01-22 2:12 ` [tarantool-patches] [PATCH v2 1/3] lua-yaml: verify arguments count Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] " Vladislav Shpilevoy 2019-02-05 3:29 ` Alexander Turenko 2019-02-05 19:36 ` Vladislav Shpilevoy 2019-02-11 13:32 ` Alexander Turenko 2019-02-15 21:28 ` Vladislav Shpilevoy 2019-01-22 2:12 ` [tarantool-patches] [PATCH v2 2/3] lua-yaml: fix boolean/null representation in yaml Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] " Vladislav Shpilevoy 2019-01-24 21:32 ` Vladislav Shpilevoy 2019-02-05 3:29 ` Alexander Turenko 2019-02-05 19:36 ` Vladislav Shpilevoy 2019-02-15 21:06 ` Vladislav Shpilevoy 2019-02-15 21:23 ` Alexander Turenko 2019-02-18 18:55 ` Alexander Turenko 2019-02-22 15:14 ` Vladislav Shpilevoy 2019-01-22 2:12 ` Alexander Turenko [this message] 2019-01-24 21:26 ` [tarantool-patches] Re: [PATCH v2 3/3] lua-yaml: treat an empty document/value as null Vladislav Shpilevoy 2019-02-05 3:30 ` Alexander Turenko 2019-01-24 21:26 ` [tarantool-patches] Re: [PATCH v2 0/3] lua-yaml null/boolean fixes Vladislav Shpilevoy 2019-02-25 11:27 ` Kirill Yukhin 2019-03-05 16:40 ` Alexander Turenko 2019-03-06 7:21 ` Kirill Yukhin
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=be09222062ccbd971fa3b39b760b43735d5ba334.1548123025.git.alexander.turenko@tarantool.org \ --to=alexander.turenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH v2 3/3] lua-yaml: treat an empty document/value as null' \ /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