From 1decf9c5fd5c8efe4cab0c50bfeb5283846c5953 Mon Sep 17 00:00:00 2001 From: Alexandr Lyapunov <a.lyapunov@corp.mail.ru> Date: Mon, 16 Nov 2015 16:35:37 +0300 Subject: [PATCH] Added special error detection - old (1.6.5) style of upsert lua call --- src/box/lua/schema.lua | 12 +++++++++--- test/box/update.result | 2 +- test/box/update.test.lua | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua index 0d776cbdab..61d977df22 100644 --- a/src/box/lua/schema.lua +++ b/src/box/lua/schema.lua @@ -833,7 +833,13 @@ function box.schema.space.bless(space) index_mt.update = function(index, key, ops) return internal.update(index.space_id, index.id, keify(key), ops); end - index_mt.upsert = function(index, tuple_key, ops) + index_mt.upsert = function(index, tuple_key, ops, deprecated) + if deprecated ~= nil then + local msg = "Error: extra argument in upsert call: " + msg = msg .. tostring(deprecated) + msg = msg .. ". Usage :upsert(tuple, operations)" + box.error(box.error.PROC_LUA, msg) + end return internal.upsert(index.space_id, index.id, tuple_key, ops); end index_mt.delete = function(index, key) @@ -895,9 +901,9 @@ function box.schema.space.bless(space) check_index(space, 0) return space.index[0]:update(key, ops) end - space_mt.upsert = function(space, tuple_key, ops) + space_mt.upsert = function(space, tuple_key, ops, deprecated) check_index(space, 0) - return space.index[0]:upsert(tuple_key, ops) + return space.index[0]:upsert(tuple_key, ops, deprecated) end space_mt.delete = function(space, key) check_index(space, 0) diff --git a/test/box/update.result b/test/box/update.result index 30fc9c0772..95e5ad7afa 100644 --- a/test/box/update.result +++ b/test/box/update.result @@ -807,7 +807,7 @@ ops = {} for i = 1,10 do table.insert(ops, {'=', 2, '1234567890'}) end --- ... -s:upsert({0}, ops, {0}) +s:upsert({0}, ops) --- ... --#stop server default diff --git a/test/box/update.test.lua b/test/box/update.test.lua index cacf9b9a69..66782da0d2 100644 --- a/test/box/update.test.lua +++ b/test/box/update.test.lua @@ -248,7 +248,7 @@ s:update({0}, {{0, 0, 0}}) -- broken WAL during upsert ops = {} for i = 1,10 do table.insert(ops, {'=', 2, '1234567890'}) end -s:upsert({0}, ops, {0}) +s:upsert({0}, ops) --#stop server default --#start server default s = box.space.tweedledum -- GitLab