From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 65D5522BBD for ; Thu, 3 May 2018 14:49:36 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2UHEsh1wNJdT for ; Thu, 3 May 2018 14:49:36 -0400 (EDT) Received: from smtp29.i.mail.ru (smtp29.i.mail.ru [94.100.177.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 2573E22B2E for ; Thu, 3 May 2018 14:49:34 -0400 (EDT) From: Nikita Pettik Subject: [tarantool-patches] [PATCH 0/4] Rework SQL transaction processing Date: Thu, 3 May 2018 21:49:21 +0300 Message-Id: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: v.shpilevoy@tarantool.org, Nikita Pettik Branch: https://github.com/tarantool/tarantool/tree/np/rework-sql-transactions Issue: https://github.com/tarantool/tarantool/issues/3237 https://github.com/tarantool/tarantool/issues/3313 https://github.com/tarantool/tarantool/issues/3379 This patch-set consists of several fixes related to SQL transactions. First patch provides slight refactoring of transactions processing in SQL: instead of using one opcode OP_AutoCommit for BEGIN, COMMIT and ROLLBACK handling during VDBE execution, three different opcodes are added. Moreover, redundant switches of auto-commit flag are removed. Now, it is set during VDBE creation and can be changed only by BEGIN statement or by DML request (since DML must be surrounded in a separate txn). Second patch is the main in series and introduces transitive transactions between SQL and Lua. To implement this feature, deferred FK counter has become attribute of transaction, and removed from VDBE. Last two patches fix bugs connected with SQL savepoints: first one led to assertion fault due to wrong assert condition; second one resulted in incorrect processing of RELEASE statement due to obsolete SQLite code. Nikita Pettik (4): sql: remove OP_AutoCommit opcode sql: allow transitive Lua <-> SQL transactions sql: allow SAVEPOINT statement outside transaction sql: fix SAVEPOINT RELEASE statement src/box/errcode.h | 1 + src/box/sql/build.c | 51 ++----- src/box/sql/fkey.c | 66 +++------ src/box/sql/main.c | 8 +- src/box/sql/parse.y | 11 +- src/box/sql/pragma.c | 3 - src/box/sql/sqliteInt.h | 33 ++++- src/box/sql/status.c | 3 +- src/box/sql/vdbe.c | 176 ++++++++++++----------- src/box/sql/vdbeInt.h | 29 +--- src/box/sql/vdbeapi.c | 4 - src/box/sql/vdbeaux.c | 83 +++++------ src/box/txn.c | 18 ++- src/box/txn.h | 22 ++- test/box/misc.result | 1 + test/sql/gh-3313-savepoints-outside-txn.result | 32 +++++ test/sql/gh-3313-savepoints-outside-txn.test.lua | 18 +++ test/sql/gh-3379-release-savepoints.result | 40 ++++++ test/sql/gh-3379-release-savepoints.test.lua | 26 ++++ test/sql/transitive-transactions.result | 124 ++++++++++++++++ test/sql/transitive-transactions.test.lua | 67 +++++++++ 21 files changed, 555 insertions(+), 261 deletions(-) create mode 100644 test/sql/gh-3313-savepoints-outside-txn.result create mode 100644 test/sql/gh-3313-savepoints-outside-txn.test.lua create mode 100644 test/sql/gh-3379-release-savepoints.result create mode 100644 test/sql/gh-3379-release-savepoints.test.lua create mode 100644 test/sql/transitive-transactions.result create mode 100644 test/sql/transitive-transactions.test.lua -- 2.15.1