* [tarantool-patches] [PATCH v2 1/3] sql: introduce pragma sql_default_engine
2018-06-28 16:19 [tarantool-patches] [PATCH v2 0/3] sql: default engine pragma Kirill Shcherbatov
@ 2018-06-28 16:19 ` Kirill Shcherbatov
2018-06-29 14:00 ` [tarantool-patches] " n.pettik
2018-06-28 16:19 ` [tarantool-patches] [PATCH v2 2/3] sql: fix SQL Count for vinyl engine Kirill Shcherbatov
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: Kirill Shcherbatov @ 2018-06-28 16:19 UTC (permalink / raw)
To: tarantool-patches; +Cc: korablev, Kirill Shcherbatov
Part of #2199.
@TarantoolBot document
Title: new pragma sql_default_engine
Now it is allowed to create vinyl spaces using special pragma
setting default engine for SQL requests.
This config is stored in user_session() and affect *only*
tables been created with SQL.
Example:
\set language sql
pragma sql_default_engine='vinyl';
CREATE TABLE t3(a primary key,b,c);
---
src/box/schema_def.c | 5 +++++
src/box/schema_def.h | 9 +++++++++
src/box/session.cc | 1 +
src/box/session.h | 2 ++
src/box/sql/build.c | 6 +++++-
src/box/sql/pragma.c | 28 ++++++++++++++++++++++++++++
src/box/sql/pragma.h | 6 ++++++
test/sql-tap/gh-2367-pragma.test.lua | 29 ++++++++++++++++++++++++++++-
8 files changed, 84 insertions(+), 2 deletions(-)
diff --git a/src/box/schema_def.c b/src/box/schema_def.c
index 97c074a..cbfad47 100644
--- a/src/box/schema_def.c
+++ b/src/box/schema_def.c
@@ -30,6 +30,11 @@
*/
#include "schema_def.h"
+const char *sql_storage_engine_strs[] = {
+ [SQL_STORAGE_ENGINE_MEMTX] = "memtx",
+ [SQL_STORAGE_ENGINE_VINYL] = "vinyl",
+};
+
static const char *object_type_strs[] = {
/* [SC_UKNNOWN] = */ "unknown",
/* [SC_UNIVERSE] = */ "universe",
diff --git a/src/box/schema_def.h b/src/box/schema_def.h
index b9a5fa5..5ab4bb0 100644
--- a/src/box/schema_def.h
+++ b/src/box/schema_def.h
@@ -243,6 +243,15 @@ enum schema_object_type {
schema_object_type_MAX = 8
};
+/** SQL Storage engine. */
+enum sql_storage_engine {
+ SQL_STORAGE_ENGINE_MEMTX = 0,
+ SQL_STORAGE_ENGINE_VINYL = 1,
+ sql_storage_engine_MAX = 2
+};
+
+extern const char *sql_storage_engine_strs[];
+
enum schema_object_type
schema_object_type(const char *name);
diff --git a/src/box/session.cc b/src/box/session.cc
index e487280..64714cd 100644
--- a/src/box/session.cc
+++ b/src/box/session.cc
@@ -107,6 +107,7 @@ session_create(enum session_type type)
memset(&session->meta, 0, sizeof(session->meta));
session->type = type;
session->sql_flags = default_flags;
+ session->sql_default_engine = SQL_STORAGE_ENGINE_MEMTX;
/* For on_connect triggers. */
credentials_init(&session->credentials, guest_user->auth_token,
diff --git a/src/box/session.h b/src/box/session.h
index 515c30a..df1dcbc 100644
--- a/src/box/session.h
+++ b/src/box/session.h
@@ -92,6 +92,8 @@ union session_meta {
struct session {
/** Session id. */
uint64_t id;
+ /** SQL Tarantool Default storage engine. */
+ uint8_t sql_default_engine;
/** SQL Connection flag for current user session */
uint32_t sql_flags;
enum session_type type;
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index af90070..8c82503 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -510,6 +510,9 @@ sql_table_new(Parse *parser, char *name)
if (table == NULL)
return NULL;
+ strcpy(table->def->engine_name,
+ sql_storage_engine_strs[current_session()->sql_default_engine]);
+
table->iPKey = -1;
table->iAutoIncPKey = -1;
table->pSchema = db->pSchema;
@@ -1602,7 +1605,8 @@ createSpace(Parse * pParse, int iSpaceId, char *zStmt)
sqlite3VdbeAddOp4(v, OP_String8, 0, iFirstCol + 2 /* name */ , 0,
sqlite3DbStrDup(pParse->db, p->def->name), P4_DYNAMIC);
sqlite3VdbeAddOp4(v, OP_String8, 0, iFirstCol + 3 /* engine */ , 0,
- "memtx", P4_STATIC);
+ sqlite3DbStrDup(pParse->db, p->def->engine_name),
+ P4_DYNAMIC);
sqlite3VdbeAddOp2(v, OP_Integer, p->def->field_count,
iFirstCol + 4 /* field_count */ );
sqlite3VdbeAddOp4(v, OP_Blob, zOptsSz, iFirstCol + 5, MSGPACK_SUBTYPE,
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index be6a01c..7a25db6 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -235,6 +235,26 @@ printActivePragmas(struct session *user_session)
}
}
+/**
+ * Set tarantool backend default engine for SQL interface.
+ * @param engine_name to set default.
+ * @retval -1 on error.
+ * @retval 0 on success.
+ */
+static int
+sql_default_engine_set(const char *engine_name)
+{
+ enum sql_storage_engine engine =
+ STR2ENUM(sql_storage_engine, engine_name);
+ if (engine == sql_storage_engine_MAX) {
+ diag_set(ClientError, ER_NO_SUCH_ENGINE, engine_name);
+ return -1;
+ }
+ current_session()->sql_default_engine = engine;
+ return 0;
+}
+
+
/*
* Process a pragma statement.
*
@@ -868,6 +888,14 @@ sqlite3Pragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
}
break;
}
+ case PragTyp_DEFAULT_ENGINE: {
+ if (sql_default_engine_set(zRight) != 0) {
+ pParse->rc = SQL_TARANTOOL_ERROR;
+ pParse->nErr++;
+ goto pragma_out;
+ }
+ break;
+ }
/* * PRAGMA busy_timeout * PRAGMA busy_timeout = N *
*
diff --git a/src/box/sql/pragma.h b/src/box/sql/pragma.h
index 06b7eea..795c98c 100644
--- a/src/box/sql/pragma.h
+++ b/src/box/sql/pragma.h
@@ -17,6 +17,7 @@
#define PragTyp_STATS 15
#define PragTyp_TABLE_INFO 17
#define PragTyp_PARSER_TRACE 24
+#define PragTyp_DEFAULT_ENGINE 25
/* Property flags associated with various pragma. */
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
@@ -247,6 +248,11 @@ static const PragmaName aPragmaName[] = {
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_ShortColNames},
#endif
+ { /* zName: */ "sql_default_engine",
+ /* ePragTyp: */ PragTyp_DEFAULT_ENGINE,
+ /* ePragFlg: */ PragFlg_Result0 | PragFlg_NoColumns1,
+ /* ColNames: */ 0, 0,
+ /* iArg: */ 0},
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
#if defined(SQLITE_DEBUG)
{ /* zName: */ "sql_trace",
diff --git a/test/sql-tap/gh-2367-pragma.test.lua b/test/sql-tap/gh-2367-pragma.test.lua
index a41a026..6d2e73d 100755
--- a/test/sql-tap/gh-2367-pragma.test.lua
+++ b/test/sql-tap/gh-2367-pragma.test.lua
@@ -1,7 +1,7 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(1)
+test:plan(4)
test:do_catchsql_test(
"pragma-1.3",
@@ -11,4 +11,31 @@ test:do_catchsql_test(
1, "no such pragma: KEK"
})
+---
+--- gh-2199: SQL default engine pragma
+---
+test:do_catchsql_test(
+ "pragma-2.1",
+ [[
+ pragma sql_default_engine='creepy';
+ ]], {
+ 1, "Space engine 'creepy' does not exist"
+})
+
+test:do_catchsql_test(
+ "pragma-2.2",
+ [[
+ pragma sql_default_engine='vinyl';
+ ]], {
+ 0
+})
+
+test:do_catchsql_test(
+ "pragma-2.3",
+ [[
+ pragma sql_default_engine='memtx';
+ ]], {
+ 0
+})
+
test:finish_test()
--
2.7.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [tarantool-patches] [PATCH v2 3/3] sql: enable multi-engine tests for SQL
2018-06-28 16:19 [tarantool-patches] [PATCH v2 0/3] sql: default engine pragma Kirill Shcherbatov
2018-06-28 16:19 ` [tarantool-patches] [PATCH v2 1/3] sql: introduce pragma sql_default_engine Kirill Shcherbatov
2018-06-28 16:19 ` [tarantool-patches] [PATCH v2 2/3] sql: fix SQL Count for vinyl engine Kirill Shcherbatov
@ 2018-06-28 16:19 ` Kirill Shcherbatov
2018-06-29 14:14 ` [tarantool-patches] " n.pettik
2018-07-03 8:04 ` [tarantool-patches] Re: [PATCH v2 0/3] sql: default engine pragma Kirill Yukhin
3 siblings, 1 reply; 10+ messages in thread
From: Kirill Shcherbatov @ 2018-06-28 16:19 UTC (permalink / raw)
To: tarantool-patches; +Cc: korablev, Kirill Shcherbatov
Configured sql tests to set 'pragma sql_engine_default' on start.
This allows to test both vinyl and memtx engines for SQL.
Resolves #2199.
---
test/sql-tap/analyze9.test.lua | 2 ++
test/sql-tap/engine.cfg | 6 ++++
test/sql-tap/lua/sqltester.lua | 9 ++++-
test/sql-tap/suite.ini | 1 +
test/sql/app.lua | 3 +-
test/sql/check-clear-ephemeral.result | 6 ++++
test/sql/check-clear-ephemeral.test.lua | 3 +-
test/sql/checks.result | 6 ++++
test/sql/checks.test.lua | 2 ++
test/sql/clear.result | 6 ++++
test/sql/clear.test.lua | 2 ++
test/sql/collation.result | 9 +++++
test/sql/collation.test.lua | 3 ++
test/sql/delete-multiple-idx.result | 6 ++++
test/sql/delete-multiple-idx.test.lua | 2 ++
test/sql/delete.result | 6 ++++
test/sql/delete.test.lua | 2 ++
test/sql/drop-index.result | 6 ++++
test/sql/drop-index.test.lua | 2 ++
test/sql/drop-table.result | 6 ++++
test/sql/drop-table.test.lua | 2 ++
test/sql/engine.cfg | 6 ++++
test/sql/engine.result | 42 ++++++++++++++++++++++
test/sql/engine.test.lua | 17 +++++++++
test/sql/errinj.result | 9 +++++
test/sql/errinj.test.lua | 3 ++
test/sql/gh-2929-primary-key.result | 9 +++++
test/sql/gh-2929-primary-key.test.lua | 4 +++
test/sql/gh-2981-check-autoinc.result | 9 +++++
test/sql/gh-2981-check-autoinc.test.lua | 4 +++
test/sql/gh-3199-no-mem-leaks.result | 6 ++++
test/sql/gh-3199-no-mem-leaks.test.lua | 2 ++
test/sql/gh2141-delete-trigger-drop-table.result | 6 ++++
test/sql/gh2141-delete-trigger-drop-table.test.lua | 2 ++
test/sql/gh2251-multiple-update.result | 6 ++++
test/sql/gh2251-multiple-update.test.lua | 2 ++
test/sql/gh2483-remote-persistency-check.result | 6 ++++
test/sql/gh2483-remote-persistency-check.test.lua | 2 ++
.../gh2808-inline-unique-persistency-check.result | 6 ++++
...gh2808-inline-unique-persistency-check.test.lua | 2 ++
test/sql/icu-upper-lower.result | 6 ++++
test/sql/icu-upper-lower.test.lua | 2 ++
test/sql/insert-unique.result | 6 ++++
test/sql/insert-unique.test.lua | 2 ++
test/sql/iproto.result | 9 +++++
test/sql/iproto.test.lua | 3 ++
test/sql/max-on-index.result | 6 ++++
test/sql/max-on-index.test.lua | 2 ++
test/sql/message-func-indexes.result | 6 ++++
test/sql/message-func-indexes.test.lua | 2 ++
test/sql/misc.result | 9 +++++
test/sql/misc.test.lua | 4 +++
test/sql/on-conflict.result | 6 ++++
test/sql/on-conflict.test.lua | 2 ++
test/sql/persistency.result | 6 ++++
test/sql/persistency.test.lua | 2 ++
test/sql/savepoints.result | 6 ++++
test/sql/savepoints.test.lua | 2 ++
test/sql/select-null.result | 6 ++++
test/sql/select-null.test.lua | 2 ++
test/sql/sql-statN-index-drop.result | 6 ++++
test/sql/sql-statN-index-drop.test.lua | 2 ++
test/sql/suite.ini | 1 +
test/sql/tokenizer.result | 6 ++++
test/sql/tokenizer.test.lua | 2 ++
test/sql/transition.result | 9 +++++
test/sql/transition.test.lua | 4 +++
test/sql/transitive-transactions.result | 7 ++++
test/sql/transitive-transactions.test.lua | 3 ++
test/sql/triggers.result | 6 ++++
test/sql/triggers.test.lua | 2 ++
test/sql/update-with-nested-select.result | 6 ++++
test/sql/update-with-nested-select.test.lua | 2 ++
test/sql/upgrade.result | 6 ++++
test/sql/upgrade.test.lua | 2 ++
test/sql/view.result | 6 ++++
test/sql/view.test.lua | 2 ++
test/sql/view_delayed_wal.result | 6 ++++
test/sql/view_delayed_wal.test.lua | 2 ++
79 files changed, 399 insertions(+), 3 deletions(-)
create mode 100644 test/sql-tap/engine.cfg
create mode 100644 test/sql/engine.cfg
create mode 100644 test/sql/engine.result
create mode 100644 test/sql/engine.test.lua
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 3b3d52f..2034fa2 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -20,9 +20,11 @@ testprefix = "analyze9"
-- functionality is working.
--
+-- SQL Analyze is working correctly only with memtx now.
test:do_execsql_test(
1.0,
[[
+ pragma sql_default_engine='memtx';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a TEXT PRIMARY KEY, b TEXT);
INSERT INTO t1 VALUES('(0)', '(0)');
diff --git a/test/sql-tap/engine.cfg b/test/sql-tap/engine.cfg
new file mode 100644
index 0000000..0007d8d
--- /dev/null
+++ b/test/sql-tap/engine.cfg
@@ -0,0 +1,6 @@
+{
+ "*": {
+ "memtx": {"engine": "memtx"},
+ "vinyl": {"engine": "vinyl"}
+ }
+}
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 97c79f5..0413815 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -411,11 +411,18 @@ test.do_eqp_test = function (self, label, sql, result)
end
setmetatable(_G, nil)
-os.execute("rm -f *.snap *.xlog*")
+os.execute("rm -rf $(ls -d */)")
+os.execute("rm -f *.snap *.xlog* *.vylog* *.run*")
-- start the database
box.cfg{
memtx_max_tuple_size=4996109;
+ vinyl_max_tuple_size=4996109;
log="tarantool.log";
}
+
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+
return test
diff --git a/test/sql-tap/suite.ini b/test/sql-tap/suite.ini
index e259be2..16aaf5a 100644
--- a/test/sql-tap/suite.ini
+++ b/test/sql-tap/suite.ini
@@ -5,3 +5,4 @@ disabled =
reindex.test.lua ; This test is banned in scope of #2174
lua_libs = lua/sqltester.lua ../sql/lua/sql_tokenizer.lua ../box/lua/identifier.lua
is_parallel = True
+config = engine.cfg
\ No newline at end of file
diff --git a/test/sql/app.lua b/test/sql/app.lua
index 96bb590..8dbed1c 100644
--- a/test/sql/app.lua
+++ b/test/sql/app.lua
@@ -3,7 +3,8 @@
box.cfg{
listen = os.getenv("LISTEN"),
pid_file = "tarantool.pid",
- memtx_max_tuple_size = 5 * 1024 * 1024
+ memtx_max_tuple_size = 5 * 1024 * 1024,
+ vinyl_max_tuple_size = 5 * 1024 * 1024,
}
require('console').listen(os.getenv('ADMIN'))
diff --git a/test/sql/check-clear-ephemeral.result b/test/sql/check-clear-ephemeral.result
index 156e06a..4ab1fe1 100644
--- a/test/sql/check-clear-ephemeral.result
+++ b/test/sql/check-clear-ephemeral.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE t1(a,b,c,PRIMARY KEY(b,c));")
diff --git a/test/sql/check-clear-ephemeral.test.lua b/test/sql/check-clear-ephemeral.test.lua
index 8a5787b..c7ea733 100644
--- a/test/sql/check-clear-ephemeral.test.lua
+++ b/test/sql/check-clear-ephemeral.test.lua
@@ -1,5 +1,6 @@
test_run = require('test_run').new()
-
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
-- create space
diff --git a/test/sql/checks.result b/test/sql/checks.result
index 21ce210..2a31b01 100644
--- a/test/sql/checks.result
+++ b/test/sql/checks.result
@@ -8,6 +8,12 @@ test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
---
- true
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
--
-- gh-3272: Move SQL CHECK into server
--
diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua
index bb76b0c..7ff78fe 100644
--- a/test/sql/checks.test.lua
+++ b/test/sql/checks.test.lua
@@ -1,6 +1,8 @@
env = require('test_run')
test_run = env.new()
test_run:cmd("push filter ".."'\\.lua.*:[0-9]+: ' to '.lua...\"]:<line>: '")
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
--
-- gh-3272: Move SQL CHECK into server
diff --git a/test/sql/clear.result b/test/sql/clear.result
index d267245..c75e134 100644
--- a/test/sql/clear.result
+++ b/test/sql/clear.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE zoobar (c1, c2 PRIMARY KEY, c3, c4)")
diff --git a/test/sql/clear.test.lua b/test/sql/clear.test.lua
index 068a7c1..142cda8 100644
--- a/test/sql/clear.test.lua
+++ b/test/sql/clear.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/collation.result b/test/sql/collation.result
index 3a4f81f..7fec96d 100644
--- a/test/sql/collation.result
+++ b/test/sql/collation.result
@@ -1,6 +1,15 @@
remote = require('net.box')
---
...
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- gh-3010: COLLATE after LIMIT should throw an error
-- All of these tests should throw error "near "COLLATE": syntax error"
box.sql.execute("SELECT 1 LIMIT 1 COLLATE BINARY;")
diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
index fe8c1ba..ff2c5b2 100644
--- a/test/sql/collation.test.lua
+++ b/test/sql/collation.test.lua
@@ -1,4 +1,7 @@
remote = require('net.box')
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- gh-3010: COLLATE after LIMIT should throw an error
diff --git a/test/sql/delete-multiple-idx.result b/test/sql/delete-multiple-idx.result
index 000dad2..a163cf1 100644
--- a/test/sql/delete-multiple-idx.result
+++ b/test/sql/delete-multiple-idx.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- Create space.
box.sql.execute("CREATE TABLE t3(id primary key,x,y);");
diff --git a/test/sql/delete-multiple-idx.test.lua b/test/sql/delete-multiple-idx.test.lua
index 26c19a0..e187355 100644
--- a/test/sql/delete-multiple-idx.test.lua
+++ b/test/sql/delete-multiple-idx.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/delete.result b/test/sql/delete.result
index b7dc588..c454c60 100644
--- a/test/sql/delete.result
+++ b/test/sql/delete.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE t1(a, b, PRIMARY KEY(a, b));");
diff --git a/test/sql/delete.test.lua b/test/sql/delete.test.lua
index 69d8ff9..2f6b625 100644
--- a/test/sql/delete.test.lua
+++ b/test/sql/delete.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/drop-index.result b/test/sql/drop-index.result
index 9fa8b8b..2aaddac 100644
--- a/test/sql/drop-index.result
+++ b/test/sql/drop-index.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE zzoobar (c1, c2 PRIMARY KEY, c3, c4)")
diff --git a/test/sql/drop-index.test.lua b/test/sql/drop-index.test.lua
index d39d33b..8bb51e1 100644
--- a/test/sql/drop-index.test.lua
+++ b/test/sql/drop-index.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/drop-table.result b/test/sql/drop-table.result
index e891764..08f2496 100644
--- a/test/sql/drop-table.result
+++ b/test/sql/drop-table.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE zzzoobar (c1, c2 PRIMARY KEY, c3, c4)")
diff --git a/test/sql/drop-table.test.lua b/test/sql/drop-table.test.lua
index a721563..9663074 100644
--- a/test/sql/drop-table.test.lua
+++ b/test/sql/drop-table.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/engine.cfg b/test/sql/engine.cfg
new file mode 100644
index 0000000..0007d8d
--- /dev/null
+++ b/test/sql/engine.cfg
@@ -0,0 +1,6 @@
+{
+ "*": {
+ "memtx": {"engine": "memtx"},
+ "vinyl": {"engine": "vinyl"}
+ }
+}
diff --git a/test/sql/engine.result b/test/sql/engine.result
new file mode 100644
index 0000000..1b31e2f
--- /dev/null
+++ b/test/sql/engine.result
@@ -0,0 +1,42 @@
+env = require('test_run')
+---
+...
+test_run = env.new()
+---
+...
+box.sql.execute("pragma sql_default_engine='vinyl'")
+---
+...
+box.sql.execute("CREATE TABLE t1_vinyl(a primary key,b,c);")
+---
+...
+box.sql.execute("CREATE TABLE t2_vinyl(a primary key,b,c);")
+---
+...
+box.sql.execute("pragma sql_default_engine='memtx'")
+---
+...
+box.sql.execute("CREATE TABLE t3_memtx(a primary key,b,c);")
+---
+...
+assert(box.space.T1_VINYL.engine == 'vinyl')
+---
+- true
+...
+assert(box.space.T2_VINYL.engine == 'vinyl')
+---
+- true
+...
+assert(box.space.T3_MEMTX.engine == 'memtx')
+---
+- true
+...
+box.sql.execute("DROP TABLE t1_vinyl;")
+---
+...
+box.sql.execute("DROP TABLE t2_vinyl;")
+---
+...
+box.sql.execute("DROP TABLE t3_memtx;")
+---
+...
diff --git a/test/sql/engine.test.lua b/test/sql/engine.test.lua
new file mode 100644
index 0000000..2a07c71
--- /dev/null
+++ b/test/sql/engine.test.lua
@@ -0,0 +1,17 @@
+env = require('test_run')
+test_run = env.new()
+
+box.sql.execute("pragma sql_default_engine='vinyl'")
+box.sql.execute("CREATE TABLE t1_vinyl(a primary key,b,c);")
+box.sql.execute("CREATE TABLE t2_vinyl(a primary key,b,c);")
+
+box.sql.execute("pragma sql_default_engine='memtx'")
+box.sql.execute("CREATE TABLE t3_memtx(a primary key,b,c);")
+
+assert(box.space.T1_VINYL.engine == 'vinyl')
+assert(box.space.T2_VINYL.engine == 'vinyl')
+assert(box.space.T3_MEMTX.engine == 'memtx')
+
+box.sql.execute("DROP TABLE t1_vinyl;")
+box.sql.execute("DROP TABLE t2_vinyl;")
+box.sql.execute("DROP TABLE t3_memtx;")
diff --git a/test/sql/errinj.result b/test/sql/errinj.result
index 1451ea1..b491d46 100644
--- a/test/sql/errinj.result
+++ b/test/sql/errinj.result
@@ -1,6 +1,15 @@
remote = require('net.box')
---
...
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
errinj = box.error.injection
---
...
diff --git a/test/sql/errinj.test.lua b/test/sql/errinj.test.lua
index 5663a83..da25b03 100644
--- a/test/sql/errinj.test.lua
+++ b/test/sql/errinj.test.lua
@@ -1,4 +1,7 @@
remote = require('net.box')
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
errinj = box.error.injection
fiber = require('fiber')
diff --git a/test/sql/gh-2929-primary-key.result b/test/sql/gh-2929-primary-key.result
index 53896fc..c238ed7 100644
--- a/test/sql/gh-2929-primary-key.result
+++ b/test/sql/gh-2929-primary-key.result
@@ -1,3 +1,12 @@
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- All tables in SQL are now WITHOUT ROW ID, so if user
-- tries to create table without a primary key, an appropriate error message
-- should be raised. This tests checks it.
diff --git a/test/sql/gh-2929-primary-key.test.lua b/test/sql/gh-2929-primary-key.test.lua
index 27338a6..0a9395c 100644
--- a/test/sql/gh-2929-primary-key.test.lua
+++ b/test/sql/gh-2929-primary-key.test.lua
@@ -1,3 +1,7 @@
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+
-- All tables in SQL are now WITHOUT ROW ID, so if user
-- tries to create table without a primary key, an appropriate error message
-- should be raised. This tests checks it.
diff --git a/test/sql/gh-2981-check-autoinc.result b/test/sql/gh-2981-check-autoinc.result
index aaa0785..b0f55e6 100644
--- a/test/sql/gh-2981-check-autoinc.result
+++ b/test/sql/gh-2981-check-autoinc.result
@@ -1,3 +1,12 @@
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
box.cfg{}
---
...
diff --git a/test/sql/gh-2981-check-autoinc.test.lua b/test/sql/gh-2981-check-autoinc.test.lua
index f136505..98a5fb4 100644
--- a/test/sql/gh-2981-check-autoinc.test.lua
+++ b/test/sql/gh-2981-check-autoinc.test.lua
@@ -1,3 +1,7 @@
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+
box.cfg{}
box.sql.execute("CREATE TABLE t1 (s1 INTEGER PRIMARY KEY AUTOINCREMENT, s2 INTEGER, CHECK (s1 <> 19));");
diff --git a/test/sql/gh-3199-no-mem-leaks.result b/test/sql/gh-3199-no-mem-leaks.result
index 682ca62..9d715e8 100644
--- a/test/sql/gh-3199-no-mem-leaks.result
+++ b/test/sql/gh-3199-no-mem-leaks.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
fiber = require('fiber')
---
...
diff --git a/test/sql/gh-3199-no-mem-leaks.test.lua b/test/sql/gh-3199-no-mem-leaks.test.lua
index d61d474..138166b 100644
--- a/test/sql/gh-3199-no-mem-leaks.test.lua
+++ b/test/sql/gh-3199-no-mem-leaks.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
fiber = require('fiber')
-- This test checks that no leaks of region memory happens during
diff --git a/test/sql/gh2141-delete-trigger-drop-table.result b/test/sql/gh2141-delete-trigger-drop-table.result
index ec5a380..d8ba2af 100644
--- a/test/sql/gh2141-delete-trigger-drop-table.result
+++ b/test/sql/gh2141-delete-trigger-drop-table.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- create space
box.sql.execute("CREATE TABLE t(id PRIMARY KEY)")
---
diff --git a/test/sql/gh2141-delete-trigger-drop-table.test.lua b/test/sql/gh2141-delete-trigger-drop-table.test.lua
index 87110a4..19d3188 100644
--- a/test/sql/gh2141-delete-trigger-drop-table.test.lua
+++ b/test/sql/gh2141-delete-trigger-drop-table.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- create space
box.sql.execute("CREATE TABLE t(id PRIMARY KEY)")
diff --git a/test/sql/gh2251-multiple-update.result b/test/sql/gh2251-multiple-update.result
index 5372cfc..5e137ee 100644
--- a/test/sql/gh2251-multiple-update.result
+++ b/test/sql/gh2251-multiple-update.result
@@ -2,6 +2,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
box.sql.execute("CREATE TABLE t1(a integer primary key, b UNIQUE, e);")
---
diff --git a/test/sql/gh2251-multiple-update.test.lua b/test/sql/gh2251-multiple-update.test.lua
index 15795f1..0166a17 100644
--- a/test/sql/gh2251-multiple-update.test.lua
+++ b/test/sql/gh2251-multiple-update.test.lua
@@ -1,5 +1,7 @@
-- Regression test for #2251
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/gh2483-remote-persistency-check.result b/test/sql/gh2483-remote-persistency-check.result
index 5cb6db3..50e65f2 100644
--- a/test/sql/gh2483-remote-persistency-check.result
+++ b/test/sql/gh2483-remote-persistency-check.result
@@ -5,6 +5,12 @@ env = require('test_run')
test_run = env.new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
box.schema.user.grant('guest', 'read,write,execute', 'universe')
---
...
diff --git a/test/sql/gh2483-remote-persistency-check.test.lua b/test/sql/gh2483-remote-persistency-check.test.lua
index da13e4e..b952f6b 100644
--- a/test/sql/gh2483-remote-persistency-check.test.lua
+++ b/test/sql/gh2483-remote-persistency-check.test.lua
@@ -1,6 +1,8 @@
-- Regression test for gh-2483
env = require('test_run')
test_run = env.new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
box.schema.user.grant('guest', 'read,write,execute', 'universe')
diff --git a/test/sql/gh2808-inline-unique-persistency-check.result b/test/sql/gh2808-inline-unique-persistency-check.result
index e171f7a..fdd000f 100644
--- a/test/sql/gh2808-inline-unique-persistency-check.result
+++ b/test/sql/gh2808-inline-unique-persistency-check.result
@@ -5,6 +5,12 @@ env = require('test_run')
test_run = env.new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Create a table and insert a datum
box.sql.execute([[CREATE TABLE t1(a PRIMARY KEY, b, UNIQUE(b));]])
---
diff --git a/test/sql/gh2808-inline-unique-persistency-check.test.lua b/test/sql/gh2808-inline-unique-persistency-check.test.lua
index 19ae877..eb4e051 100644
--- a/test/sql/gh2808-inline-unique-persistency-check.test.lua
+++ b/test/sql/gh2808-inline-unique-persistency-check.test.lua
@@ -1,6 +1,8 @@
-- Regression test for gh-2483
env = require('test_run')
test_run = env.new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- Create a table and insert a datum
box.sql.execute([[CREATE TABLE t1(a PRIMARY KEY, b, UNIQUE(b));]])
diff --git a/test/sql/icu-upper-lower.result b/test/sql/icu-upper-lower.result
index 9989ed2..6ca44b9 100644
--- a/test/sql/icu-upper-lower.result
+++ b/test/sql/icu-upper-lower.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
test_run:cmd("setopt delimiter ';'")
---
- true
diff --git a/test/sql/icu-upper-lower.test.lua b/test/sql/icu-upper-lower.test.lua
index bb1a518..6629a74 100644
--- a/test/sql/icu-upper-lower.test.lua
+++ b/test/sql/icu-upper-lower.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
test_run:cmd("setopt delimiter ';'")
diff --git a/test/sql/insert-unique.result b/test/sql/insert-unique.result
index 7e564ec..048d628 100644
--- a/test/sql/insert-unique.result
+++ b/test/sql/insert-unique.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE zoobar (c1, c2 PRIMARY KEY, c3, c4)")
diff --git a/test/sql/insert-unique.test.lua b/test/sql/insert-unique.test.lua
index dfdaa30..a004c57 100644
--- a/test/sql/insert-unique.test.lua
+++ b/test/sql/insert-unique.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/iproto.result b/test/sql/iproto.result
index 3b7574a..4cf7901 100644
--- a/test/sql/iproto.result
+++ b/test/sql/iproto.result
@@ -1,6 +1,15 @@
remote = require('net.box')
---
...
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
box.sql.execute('create table test (id primary key, a float, b text)')
---
...
diff --git a/test/sql/iproto.test.lua b/test/sql/iproto.test.lua
index 159a839..220331b 100644
--- a/test/sql/iproto.test.lua
+++ b/test/sql/iproto.test.lua
@@ -1,4 +1,7 @@
remote = require('net.box')
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
box.sql.execute('create table test (id primary key, a float, b text)')
space = box.space.TEST
diff --git a/test/sql/max-on-index.result b/test/sql/max-on-index.result
index afd4362..b107633 100644
--- a/test/sql/max-on-index.result
+++ b/test/sql/max-on-index.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
-- scalar affinity
diff --git a/test/sql/max-on-index.test.lua b/test/sql/max-on-index.test.lua
index 5ce6cd7..b879e38 100644
--- a/test/sql/max-on-index.test.lua
+++ b/test/sql/max-on-index.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/message-func-indexes.result b/test/sql/message-func-indexes.result
index 4bf1cab..37ed4ec 100644
--- a/test/sql/message-func-indexes.result
+++ b/test/sql/message-func-indexes.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Creating tables.
box.sql.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
---
diff --git a/test/sql/message-func-indexes.test.lua b/test/sql/message-func-indexes.test.lua
index 4597c9b..e0eae76 100644
--- a/test/sql/message-func-indexes.test.lua
+++ b/test/sql/message-func-indexes.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- Creating tables.
box.sql.execute("CREATE TABLE t1(id INTEGER PRIMARY KEY, a INTEGER)")
diff --git a/test/sql/misc.result b/test/sql/misc.result
index b1ddb89..93b383a 100644
--- a/test/sql/misc.result
+++ b/test/sql/misc.result
@@ -1,3 +1,12 @@
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Forbid multistatement queries.
box.sql.execute('select 1;')
---
diff --git a/test/sql/misc.test.lua b/test/sql/misc.test.lua
index 2c05fcd..1ed0198 100644
--- a/test/sql/misc.test.lua
+++ b/test/sql/misc.test.lua
@@ -1,3 +1,7 @@
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+
-- Forbid multistatement queries.
box.sql.execute('select 1;')
box.sql.execute('select 1; select 2;')
diff --git a/test/sql/on-conflict.result b/test/sql/on-conflict.result
index 9e15ec4..c0d0de0 100644
--- a/test/sql/on-conflict.result
+++ b/test/sql/on-conflict.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Create space
box.sql.execute("CREATE TABLE t (id INTEGER PRIMARY KEY, v INTEGER UNIQUE ON CONFLICT ABORT)")
---
diff --git a/test/sql/on-conflict.test.lua b/test/sql/on-conflict.test.lua
index a6aa3d6..b6d92f7 100644
--- a/test/sql/on-conflict.test.lua
+++ b/test/sql/on-conflict.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- Create space
box.sql.execute("CREATE TABLE t (id INTEGER PRIMARY KEY, v INTEGER UNIQUE ON CONFLICT ABORT)")
diff --git a/test/sql/persistency.result b/test/sql/persistency.result
index 8f89039..e31d0bc 100644
--- a/test/sql/persistency.result
+++ b/test/sql/persistency.result
@@ -4,6 +4,12 @@ env = require('test_run')
test_run = env.new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- create space
box.sql.execute("CREATE TABLE foobar (foo PRIMARY KEY, bar)")
---
diff --git a/test/sql/persistency.test.lua b/test/sql/persistency.test.lua
index e994a62..417d8c0 100644
--- a/test/sql/persistency.test.lua
+++ b/test/sql/persistency.test.lua
@@ -1,5 +1,7 @@
env = require('test_run')
test_run = env.new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- create space
box.sql.execute("CREATE TABLE foobar (foo PRIMARY KEY, bar)")
diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
index e32c9b3..8553dd8 100644
--- a/test/sql/savepoints.result
+++ b/test/sql/savepoints.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- These tests check that SQL savepoints properly work outside
-- transactions as well as inside transactions started in Lua.
-- gh-3313
diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
index 2d87b9e..a4ed061 100644
--- a/test/sql/savepoints.test.lua
+++ b/test/sql/savepoints.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- These tests check that SQL savepoints properly work outside
-- transactions as well as inside transactions started in Lua.
diff --git a/test/sql/select-null.result b/test/sql/select-null.result
index a229eb9..53bef1b 100644
--- a/test/sql/select-null.result
+++ b/test/sql/select-null.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE t3(id INT, a, b, PRIMARY KEY(id))")
diff --git a/test/sql/select-null.test.lua b/test/sql/select-null.test.lua
index a2c1266..3e9cb81 100644
--- a/test/sql/select-null.test.lua
+++ b/test/sql/select-null.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/sql-statN-index-drop.result b/test/sql/sql-statN-index-drop.result
index c7e476f..a751eca 100644
--- a/test/sql/sql-statN-index-drop.result
+++ b/test/sql/sql-statN-index-drop.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Initializing some things.
box.sql.execute("CREATE TABLE t1(id PRIMARY KEY, a);")
---
diff --git a/test/sql/sql-statN-index-drop.test.lua b/test/sql/sql-statN-index-drop.test.lua
index bf4a752..fe7e15b 100644
--- a/test/sql/sql-statN-index-drop.test.lua
+++ b/test/sql/sql-statN-index-drop.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- Initializing some things.
box.sql.execute("CREATE TABLE t1(id PRIMARY KEY, a);")
diff --git a/test/sql/suite.ini b/test/sql/suite.ini
index 5f28f23..4504731 100644
--- a/test/sql/suite.ini
+++ b/test/sql/suite.ini
@@ -3,6 +3,7 @@ core = tarantool
description = sql tests
script = app.lua
use_unix_sockets = True
+config = engine.cfg
is_parallel = True
lua_libs = lua/sql_tokenizer.lua
release_disabled = errinj.test.lua view_delayed_wal.test.lua
diff --git a/test/sql/tokenizer.result b/test/sql/tokenizer.result
index 3868f6b..9e50b87 100644
--- a/test/sql/tokenizer.result
+++ b/test/sql/tokenizer.result
@@ -4,6 +4,12 @@ env = require('test_run')
test_run = env.new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
sql_tokenizer = require('sql_tokenizer')
---
...
diff --git a/test/sql/tokenizer.test.lua b/test/sql/tokenizer.test.lua
index e368219..7a69d12 100644
--- a/test/sql/tokenizer.test.lua
+++ b/test/sql/tokenizer.test.lua
@@ -1,5 +1,7 @@
env = require('test_run')
test_run = env.new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
sql_tokenizer = require('sql_tokenizer')
diff --git a/test/sql/transition.result b/test/sql/transition.result
index 7c4a2c8..70fb2db 100644
--- a/test/sql/transition.result
+++ b/test/sql/transition.result
@@ -1,3 +1,12 @@
+test_run = require('test_run').new()
+---
+...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- create space
box.sql.execute("CREATE TABLE foobar (foo PRIMARY KEY, bar)")
---
diff --git a/test/sql/transition.test.lua b/test/sql/transition.test.lua
index 50ee7f5..cae45aa 100644
--- a/test/sql/transition.test.lua
+++ b/test/sql/transition.test.lua
@@ -1,3 +1,7 @@
+test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+
-- create space
box.sql.execute("CREATE TABLE foobar (foo PRIMARY KEY, bar)")
diff --git a/test/sql/transitive-transactions.result b/test/sql/transitive-transactions.result
index e617cf1..da618d2 100644
--- a/test/sql/transitive-transactions.result
+++ b/test/sql/transitive-transactions.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute("pragma sql_default_engine=\'"..engine.."\'")
+---
+...
test_run:cmd("setopt delimiter ';'")
---
- true
@@ -105,6 +111,7 @@ box.space.PARENT:select();
- - [1, 1]
...
box.sql.execute('PRAGMA defer_foreign_keys = 1;')
+box.rollback()
fk_defer();
---
...
diff --git a/test/sql/transitive-transactions.test.lua b/test/sql/transitive-transactions.test.lua
index 718f951..f663bf6 100644
--- a/test/sql/transitive-transactions.test.lua
+++ b/test/sql/transitive-transactions.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute("pragma sql_default_engine=\'"..engine.."\'")
test_run:cmd("setopt delimiter ';'")
-- These tests are aimed at checking transitive transactions
@@ -56,6 +58,7 @@ fk_defer();
box.space.CHILD:select();
box.space.PARENT:select();
box.sql.execute('PRAGMA defer_foreign_keys = 1;')
+box.rollback()
fk_defer();
box.space.CHILD:select();
box.space.PARENT:select();
diff --git a/test/sql/triggers.result b/test/sql/triggers.result
index 90aa8a9..dc0a2e5 100644
--- a/test/sql/triggers.result
+++ b/test/sql/triggers.result
@@ -4,6 +4,12 @@ env = require('test_run')
test_run = env.new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Get invariant part of the tuple; name and opts don't change.
function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
---
diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
index 4c88137..e019c00 100644
--- a/test/sql/triggers.test.lua
+++ b/test/sql/triggers.test.lua
@@ -1,5 +1,7 @@
env = require('test_run')
test_run = env.new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- Get invariant part of the tuple; name and opts don't change.
function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
diff --git a/test/sql/update-with-nested-select.result b/test/sql/update-with-nested-select.result
index 419cebb..51825a2 100644
--- a/test/sql/update-with-nested-select.result
+++ b/test/sql/update-with-nested-select.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- box.cfg()
-- create space
box.sql.execute("CREATE TABLE t1(a integer primary key, b UNIQUE, e);");
diff --git a/test/sql/update-with-nested-select.test.lua b/test/sql/update-with-nested-select.test.lua
index 7b90968..f9f9b7a 100644
--- a/test/sql/update-with-nested-select.test.lua
+++ b/test/sql/update-with-nested-select.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- box.cfg()
diff --git a/test/sql/upgrade.result b/test/sql/upgrade.result
index 6f7b115..5e7d851 100644
--- a/test/sql/upgrade.result
+++ b/test/sql/upgrade.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
work_dir = 'sql/upgrade/1.10/'
---
...
diff --git a/test/sql/upgrade.test.lua b/test/sql/upgrade.test.lua
index 1619795..cd4dd3c 100644
--- a/test/sql/upgrade.test.lua
+++ b/test/sql/upgrade.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
work_dir = 'sql/upgrade/1.10/'
test_run:cmd('create server upgrade with script="sql/upgrade/upgrade.lua", workdir="' .. work_dir .. '"')
diff --git a/test/sql/view.result b/test/sql/view.result
index b033f19..62fbcee 100644
--- a/test/sql/view.result
+++ b/test/sql/view.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
-- Verify that constraints on 'view' option are working.
-- box.cfg()
-- Create space and view.
diff --git a/test/sql/view.test.lua b/test/sql/view.test.lua
index 27f449f..1d73133 100644
--- a/test/sql/view.test.lua
+++ b/test/sql/view.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
-- Verify that constraints on 'view' option are working.
diff --git a/test/sql/view_delayed_wal.result b/test/sql/view_delayed_wal.result
index 3b68eda..2e1047a 100644
--- a/test/sql/view_delayed_wal.result
+++ b/test/sql/view_delayed_wal.result
@@ -1,6 +1,12 @@
test_run = require('test_run').new()
---
...
+engine = test_run:get_cfg('engine')
+---
+...
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
+---
+...
fiber = require('fiber')
---
...
diff --git a/test/sql/view_delayed_wal.test.lua b/test/sql/view_delayed_wal.test.lua
index cca75ad..62ab7d7 100644
--- a/test/sql/view_delayed_wal.test.lua
+++ b/test/sql/view_delayed_wal.test.lua
@@ -1,4 +1,6 @@
test_run = require('test_run').new()
+engine = test_run:get_cfg('engine')
+box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
fiber = require('fiber')
-- View reference counters are incremented before firing
--
2.7.4
^ permalink raw reply [flat|nested] 10+ messages in thread