[patches] [PATCH] sql: make _sql_stat[14] to be a system spaces
AKhatskevich
avkhatskevich at tarantool.org
Mon Feb 5 20:02:30 MSK 2018
From: khatskevich <avkhatskevich at gmail.com>
Making `stat[14]` a system spaces enables us to allow users to create
spaces which starts with `_`, because it cannot affect internal state
anymore.
Since now the only constraints on table names is:
- consists of printable symbols only
- length < 65k
Closes #2126
---
src/box/bootstrap.snap | Bin 1531 -> 1661 bytes
src/box/lua/space.cc | 4 +++
src/box/lua/upgrade.lua | 31 +++++++++++++++++++
src/box/schema_def.h | 3 ++
src/box/sql.c | 29 ++++++++++++++++--
src/box/sql/analyze.c | 61 +++++++++++++------------------------
src/box/sql/tarantoolInt.h | 2 ++
test/app-tap/tarantoolctl.test.lua | 4 +--
test/box-py/bootstrap.result | 11 ++++++-
test/box/access_misc.result | 6 ++++
test/box/access_sysview.result | 6 ++--
test/box/alter.result | 7 +++--
test/sql-tap/analyze1.test.lua | 22 +------------
test/sql-tap/analyze9.test.lua | 20 ++----------
test/wal_off/alter.result | 2 +-
test/xlog/upgrade.result | 11 ++++++-
16 files changed, 127 insertions(+), 92 deletions(-)
diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap
index be43e72b620eff1937d1bdeb4e4bbc9d664ea561..64fc57b13a1f55e8190c086df6db8e09b5282165 100644
GIT binary patch
delta 1655
zcmV--28j9l3;hg`8GkZ1H7#d2W;J9mH92E53Q2BrbYX5|WjY`+Wi at 6pG&yE1WH&iB
zEi^bbIW0IgWH2o<F*7qVG&eP6GGR3eRzqxWV{1Afdoem7F*q}Q3JTS_3%bn({Q%D4
z_<R+m0000004TLD{Qyv<F92FWNDfKR7I6XqUp&AU4^j0%8h>311ITLhXp^M^7m!O?
z<lgopnIe%XsdAI~S!uspww%CFPj$v_Yymd_Gir()SvySyvSH>}Pt~1L3eNz=0NDUu
zYC{9ITTK$XWW1B(OvK+PrX;NI*E%B#z78|jWev<qczpDjI~K+9^Oo2a0S`p>F05yv
z&b#yUNm!rp^nV1YJKg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z#t?b0;mN5S_XDO%NKaGumfh*nSUlz
zb5)WH9@)&*rsH%Ke>zn%VtZ78Q7$nF1>%8_2t(D6%(s;gwtV3d&Z?!1%AyeUm04=q
zP-V8SclSgcGmINL5l<3;$U~tkjVx1G14-n?)v~@oqFDf8NjID=?nQ#jW+U!3YkQHQ
zRw!4IdTwdtyQbjAArWW!(I<<#1Al=}G911rU=0u}*TAxPE7d?*w4Gn0E0Fc%K#w5c
znGj--Hv}|fJYj=EN`azi0~#_A+6(NmA}m9;vKErX`-Ij5ZJO9I;B36u1?s6Ay_FE4
zT!K0Bi<IoYR|F>9hr^7XoX+V46EoNUIsZsJ8D=oDKIg#DKYB+EIes4``F}Kr5rpL*
zYawEMzCJi5;QBN+i7Ue(pY2N`=^8^d1!6R87rzwA!FCY$BK{|||GL#X=P$H9Fw)$m
zO$nwlL)@Svm+P8|h at T#10}PHV${%*r55<tYxSlrP51Fn-!7dI1Vgpd3VHYR#qKEf`
z`w>R_F=%9C=!wq(>MeM<B5fB_7C=%Mz)>V`nkJs&&{25EqfWQmt>~rybs0E|yq8~@
zAfp-bNIWdQNOZ+KsR~!=4+)=j?T#wIuX$Z!W<C!Ux7rgG&)y<XLyd61A36yK;c6h#
a|DkmsdDO6^>c|AX&exNqFv<bd5UuSXsMW>*
diff --git a/src/box/lua/space.cc b/src/box/lua/space.cc
index c38a4ea43..0e5bf1f6c 100644
--- a/src/box/lua/space.cc
+++ b/src/box/lua/space.cc
@@ -426,6 +426,10 @@ box_lua_space_init(struct lua_State *L)
lua_setfield(L, -2, "CLUSTER_ID");
lua_pushnumber(L, BOX_TRIGGER_ID);
lua_setfield(L, -2, "TRIGGER_ID");
+ lua_pushnumber(L, BOX_SQL_STAT1_ID);
+ lua_setfield(L, -2, "SQL_STAT1_ID");
+ lua_pushnumber(L, BOX_SQL_STAT4_ID);
+ lua_setfield(L, -2, "SQL_STAT4_ID");
lua_pushnumber(L, BOX_TRUNCATE_ID);
lua_setfield(L, -2, "TRUNCATE_ID");
lua_pushnumber(L, BOX_SEQUENCE_ID);
diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
index 80acfa1e6..84eec73b3 100644
--- a/src/box/lua/upgrade.lua
+++ b/src/box/lua/upgrade.lua
@@ -464,6 +464,36 @@ local function upgrade_to_1_8_2()
end
--------------------------------------------------------------------------------
+-- Tarantool 1.8.4
+--------------------------------------------------------------------------------
+
+local function upgrade_to_1_8_4()
+ local _space = box.space[box.schema.SPACE_ID]
+ local _index = box.space[box.schema.INDEX_ID]
+ local stat1_ft = {{name='tbl', type='string'},
+ {name='idx', type='string'},
+ {name='stat', type='scalar'}}
+ local stat4_ft = {{name='tbl', type='string'},
+ {name='idx', type='string'},
+ {name='neq', type='string', is_nullable=true},
+ {name='nlt', type='string', is_nullable=true},
+ {name='ndlt', type='string', is_nullable=true},
+ {name='sample', type='scalar'}}
+
+ log.info("create space _sql_stat1")
+ _space:insert{box.schema.SQL_STAT1_ID, ADMIN, '_sql_stat1', 'memtx', 0, setmap({}), stat1_ft}
+ log.info("create index primary on _stat1")
+ _index:insert{box.schema.SQL_STAT1_ID, 0, 'primary', 'tree', { unique = true },
+ {{0, 'string'}, {1, 'string'}}}
+ log.info("create space _sql_stat4")
+ _space:insert{box.schema.SQL_STAT4_ID, ADMIN, '_sql_stat4', 'memtx', 0, setmap({}), stat4_ft}
+ log.info("create index primary on _stat4")
+ _index:insert{box.schema.SQL_STAT4_ID, 0, 'primary', 'tree', { unique = true },
+ {{0, 'string'}, {1, 'string'}, {5, 'scalar'}}}
+end
+
+--------------------------------------------------------------------------------
+
local function get_version()
local version = box.space._schema:get{'version'}
@@ -491,6 +521,7 @@ local function upgrade(options)
{version = mkversion(1, 7, 6), func = upgrade_to_1_7_6, auto = true},
{version = mkversion(1, 7, 7), func = upgrade_to_1_7_7, auto = true},
{version = mkversion(1, 8, 2), func = upgrade_to_1_8_2, auto = true},
+ {version = mkversion(1, 8, 4), func = upgrade_to_1_8_4, auto = true},
}
for _, handler in ipairs(handlers) do
diff --git a/src/box/schema_def.h b/src/box/schema_def.h
index 7e471b382..f5a5344f4 100644
--- a/src/box/schema_def.h
+++ b/src/box/schema_def.h
@@ -102,6 +102,9 @@ enum {
BOX_TRUNCATE_ID = 330,
/** Space id of _space_sequence. */
BOX_SPACE_SEQUENCE_ID = 340,
+ /** Space ids for SQL statictics. */
+ BOX_SQL_STAT1_ID = 348,
+ BOX_SQL_STAT4_ID = 349,
/** End of the reserved range of system spaces. */
BOX_SYSTEM_ID_MAX = 511,
BOX_ID_NIL = 2147483647
diff --git a/src/box/sql.c b/src/box/sql.c
index 82cdcadef..0d9282001 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -660,14 +660,20 @@ int tarantoolSqlite3EphemeralClearTable(BtCursor *pCur)
}
/*
- * Removes all instances from table. If there is no active transaction,
- * then truncate is used. Otherwise, manually deletes one-by-one all tuples.
+ * Removes all instances from table.
*/
int tarantoolSqlite3ClearTable(int iTable)
{
int space_id = SQLITE_PAGENO_TO_SPACEID(iTable);
- if (box_txn()) {
+ /*
+ * There are two cases when we have to delete tuples one by one:
+ * 1. When we are inside of another transaction, we can not use
+ * truncate, because it is a ddl. (prohibited in transactions)
+ * 2. Truncate on system spaces is disallowed. (because of triggers)
+ * (main usecase is _sql_stat4 table editing)
+ */
+ if (box_txn() || space_id < BOX_SYSTEM_ID_MAX) {
int primary_index_id = 0;
char *key;
uint32_t key_size;
@@ -1444,6 +1450,23 @@ void tarantoolSqlite3LoadSchema(InitData *init)
"CREATE TABLE \""TARANTOOL_SYS_SPACE_SEQUENCE_NAME
"\" (\"space_id\" INT PRIMARY KEY, \"sequence_id\" INT, \"flag\" INT)");
+ sql_schema_put(init, TARANTOOL_SYS_SQL_STAT1_NAME, BOX_SQL_STAT1_ID, 0,
+ "CREATE TABLE \""TARANTOOL_SYS_SQL_STAT1_NAME
+ "\"(\"tbl\" text,"
+ "\"idx\" text,"
+ "\"stat\" not null,"
+ "PRIMARY KEY(\"tbl\", \"idx\"))");
+
+ sql_schema_put(init, TARANTOOL_SYS_SQL_STAT4_NAME, BOX_SQL_STAT4_ID, 0,
+ "CREATE TABLE \""TARANTOOL_SYS_SQL_STAT4_NAME
+ "\"(\"tbl\" text,"
+ "\"idx\" text,"
+ "\"neq\" text,"
+ "\"nlt\" text,"
+ "\"ndlt\" text,"
+ "\"sample\","
+ "PRIMARY KEY(\"tbl\", \"idx\", \"sample\"))");
+
/* Read _space */
if (space_foreach(space_foreach_put_cb, init) != 0) {
init->rc = SQLITE_TARANTOOL_ERROR;
diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c
index 8d442c5a8..1303fcc2a 100644
--- a/src/box/sql/analyze.c
+++ b/src/box/sql/analyze.c
@@ -135,15 +135,10 @@ openStatTable(Parse * pParse, /* Parsing context */
const char *zWhereType /* Either "tbl" or "idx" */
)
{
- static const struct {
- const char *zName;
- const char *zCols;
- } aTable[] = {
- {
- "_sql_stat1", "\"tbl\",\"idx\",\"stat\", PRIMARY KEY(\"tbl\", \"idx\")"},
- {
- "_sql_stat4", "\"tbl\",\"idx\",\"neq\",\"nlt\",\"ndlt\",\"sample\", PRIMARY KEY(\"tbl\", \"idx\", \"sample\")"}
- };
+ const char *aTable[] = {
+ "_sql_stat1",
+ "_sql_stat4",
+ NULL};
int i;
sqlite3 *db = pParse->db;
Vdbe *v = sqlite3GetVdbe(pParse);
@@ -157,42 +152,28 @@ openStatTable(Parse * pParse, /* Parsing context */
/* Create new statistic tables if they do not exist, or clear them
* if they do already exist.
*/
- for (i = 0; i < ArraySize(aTable); i++) {
- const char *zTab = aTable[i].zName;
+ for (i = 0; aTable[i]; i++) {
+ const char *zTab = aTable[i];
Table *pStat;
- if ((pStat = sqlite3FindTable(db, zTab)) == 0) {
- if (aTable[i].zCols) {
- /* The sql_statN table does not exist. Create it. Note that a
- * side-effect of the CREATE TABLE statement is to leave the rootpage
- * of the new table in register pParse->regRoot. This is important
- * because the OpenWrite opcode below will be needing it.
- */
- sqlite3NestedParse(pParse,
- "CREATE TABLE \"%s\"(%s)", zTab,
- aTable[i].zCols);
- aRoot[i] = pParse->regRoot;
- aCreateTbl[i] = OPFLAG_P2ISREG;
- }
+ /* The table already exists, because it is a system space */
+ pStat = sqlite3FindTable(db, zTab);
+ aRoot[i] = pStat->tnum;
+ aCreateTbl[i] = 0;
+ if (zWhere) {
+ sqlite3NestedParse(pParse,
+ "DELETE FROM \"%s\" WHERE \"%s\"=%Q",
+ zTab, zWhereType, zWhere);
} else {
- /* The table already exists. If zWhere is not NULL, delete all entries
- * associated with the table zWhere. If zWhere is NULL, delete the
- * entire contents of the table.
+ /*
+ * The sql_stat[134] table already exists.
+ * Delete all rows.
*/
- aRoot[i] = pStat->tnum;
- aCreateTbl[i] = 0;
- if (zWhere) {
- sqlite3NestedParse(pParse,
- "DELETE FROM \"%s\" WHERE \"%s\"=%Q",
- zTab, zWhereType, zWhere);
- } else {
- /* The sql_stat[14] table already exists. Delete all rows. */
- sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], 0);
- }
+ sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], 0);
}
}
- /* Open the sql_stat[14] tables for writing. */
- for (i = 0; i < ArraySize(aTable); i++) {
+ /* Open the sql_stat[134] tables for writing. */
+ for (i = 0; aTable[i]; i++) {
int addr;
addr =
sqlite3VdbeAddOp3(v, OP_OpenWrite, iStatCur + i, aRoot[i],
@@ -200,7 +181,7 @@ openStatTable(Parse * pParse, /* Parsing context */
v->aOp[addr].p4.pKeyInfo = 0;
v->aOp[addr].p4type = P4_KEYINFO;
sqlite3VdbeChangeP5(v, aCreateTbl[i]);
- VdbeComment((v, aTable[i].zName));
+ VdbeComment((v, aTable[i]));
}
}
diff --git a/src/box/sql/tarantoolInt.h b/src/box/sql/tarantoolInt.h
index 4781bf574..e8b864c1b 100644
--- a/src/box/sql/tarantoolInt.h
+++ b/src/box/sql/tarantoolInt.h
@@ -18,6 +18,8 @@
#define TARANTOOL_SYS_INDEX_NAME "_index"
#define TARANTOOL_SYS_TRIGGER_NAME "_trigger"
#define TARANTOOL_SYS_TRUNCATE_NAME "_truncate"
+#define TARANTOOL_SYS_SQL_STAT1_NAME "_sql_stat1"
+#define TARANTOOL_SYS_SQL_STAT4_NAME "_sql_stat4"
/* Max space id seen so far. */
#define TARANTOOL_SYS_SCHEMA_MAXID_KEY "max_id"
diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
index 2e1c97a2f..20bbe7556 100755
--- a/test/app-tap/tarantoolctl.test.lua
+++ b/test/app-tap/tarantoolctl.test.lua
@@ -338,8 +338,8 @@ do
check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 1", "\n", 3)
check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 1 --replica 2", "\n", 3)
check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 2", "\n", 0)
- check_ctlcat_snap(test_i, dir, "--space=280", "---\n", 18)
- check_ctlcat_snap(test_i, dir, "--space=288", "---\n", 41)
+ check_ctlcat_snap(test_i, dir, "--space=280", "---\n", 20)
+ check_ctlcat_snap(test_i, dir, "--space=288", "---\n", 43)
end)
end)
diff --git a/test/box-py/bootstrap.result b/test/box-py/bootstrap.result
index 2625000d3..4819eea6d 100644
--- a/test/box-py/bootstrap.result
+++ b/test/box-py/bootstrap.result
@@ -5,7 +5,7 @@ box.space._schema:select{}
---
- - ['cluster', '<cluster uuid>']
- ['max_id', 511]
- - ['version', 1, 8, 2]
+ - ['version', 1, 8, 4]
...
box.space._cluster:select{}
---
@@ -65,6 +65,12 @@ box.space._space:select{}
'type': 'unsigned'}]]
- [340, 1, '_space_sequence', 'memtx', 0, {}, [{'name': 'id', 'type': 'unsigned'},
{'name': 'sequence_id', 'type': 'unsigned'}, {'name': 'is_generated', 'type': 'boolean'}]]
+ - [348, 1, '_sql_stat1', 'memtx', 0, {}, [{'name': 'tbl', 'type': 'string'}, {'name': 'idx',
+ 'type': 'string'}, {'name': 'stat', 'type': 'scalar'}]]
+ - [349, 1, '_sql_stat4', 'memtx', 0, {}, [{'name': 'tbl', 'type': 'string'}, {'name': 'idx',
+ 'type': 'string'}, {'type': 'string', 'name': 'neq', 'is_nullable': true},
+ {'type': 'string', 'name': 'nlt', 'is_nullable': true}, {'type': 'string', 'name': 'ndlt',
+ 'is_nullable': true}, {'name': 'sample', 'type': 'scalar'}]]
...
box.space._index:select{}
---
@@ -111,6 +117,9 @@ box.space._index:select{}
- [330, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]]
- [340, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]]
- [340, 1, 'sequence', 'tree', {'unique': false}, [[1, 'unsigned']]]
+ - [348, 0, 'primary', 'tree', {'unique': true}, [[0, 'string'], [1, 'string']]]
+ - [349, 0, 'primary', 'tree', {'unique': true}, [[0, 'string'], [1, 'string'], [
+ 5, 'scalar']]]
...
box.space._user:select{}
---
diff --git a/test/box/access_misc.result b/test/box/access_misc.result
index 097b7135d..824b5b51f 100644
--- a/test/box/access_misc.result
+++ b/test/box/access_misc.result
@@ -785,6 +785,12 @@ box.space._space:select()
'type': 'unsigned'}]]
- [340, 1, '_space_sequence', 'memtx', 0, {}, [{'name': 'id', 'type': 'unsigned'},
{'name': 'sequence_id', 'type': 'unsigned'}, {'name': 'is_generated', 'type': 'boolean'}]]
+ - [348, 1, '_sql_stat1', 'memtx', 0, {}, [{'name': 'tbl', 'type': 'string'}, {'name': 'idx',
+ 'type': 'string'}, {'name': 'stat', 'type': 'scalar'}]]
+ - [349, 1, '_sql_stat4', 'memtx', 0, {}, [{'name': 'tbl', 'type': 'string'}, {'name': 'idx',
+ 'type': 'string'}, {'type': 'string', 'name': 'neq', 'is_nullable': true},
+ {'type': 'string', 'name': 'nlt', 'is_nullable': true}, {'type': 'string', 'name': 'ndlt',
+ 'is_nullable': true}, {'name': 'sample', 'type': 'scalar'}]]
...
box.space._func:select()
---
diff --git a/test/box/access_sysview.result b/test/box/access_sysview.result
index 58b2681c2..4635c76d4 100644
--- a/test/box/access_sysview.result
+++ b/test/box/access_sysview.result
@@ -226,11 +226,11 @@ box.session.su('guest')
...
#box.space._vspace:select{}
---
-- 19
+- 21
...
#box.space._vindex:select{}
---
-- 42
+- 44
...
#box.space._vuser:select{}
---
@@ -258,7 +258,7 @@ box.session.su('guest')
...
#box.space._vindex:select{}
---
-- 42
+- 44
...
#box.space._vuser:select{}
---
diff --git a/test/box/alter.result b/test/box/alter.result
index 926a756e4..83b220b38 100644
--- a/test/box/alter.result
+++ b/test/box/alter.result
@@ -107,7 +107,7 @@ space = box.space[t[1]]
...
space.id
---
-- 341
+- 350
...
space.field_count
---
@@ -152,7 +152,7 @@ space_deleted
...
space:replace{0}
---
-- error: Space '341' does not exist
+- error: Space '350' does not exist
...
_index:insert{_space.id, 0, 'primary', 'tree', {unique=true}, {{0, 'unsigned'}}}
---
@@ -224,6 +224,9 @@ _index:select{}
- [330, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]]
- [340, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]]
- [340, 1, 'sequence', 'tree', {'unique': false}, [[1, 'unsigned']]]
+ - [348, 0, 'primary', 'tree', {'unique': true}, [[0, 'string'], [1, 'string']]]
+ - [349, 0, 'primary', 'tree', {'unique': true}, [[0, 'string'], [1, 'string'], [
+ 5, 'scalar']]]
...
-- modify indexes of a system space
_index:delete{_index.id, 0}
diff --git a/test/sql-tap/analyze1.test.lua b/test/sql-tap/analyze1.test.lua
index b11f44400..5d91d963f 100755
--- a/test/sql-tap/analyze1.test.lua
+++ b/test/sql-tap/analyze1.test.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(36)
+test:plan(34)
--!./tcltestrunner.lua
-- 2005 July 22
@@ -30,26 +30,6 @@ test:do_catchsql_test(
-- </analyze-1.1>
})
-test:do_execsql_test(
- "analyze-1.2",
- [[
- SELECT count(*) FROM "_space" WHERE "name"='_sql_stat1'
- ]], {
- -- <analyze-1.2>
- 0
- -- </analyze-1.2>
- })
-
-test:do_catchsql_test(
- "analyze-1.5.1",
- [[
- ANALYZE
- ]], {
- -- <analyze-1.5.1>
- 0
- -- </analyze-1.5.1>
- })
-
test:do_execsql_test(
"analyze-1.6",
[[
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 30d5505b4..61cc4433a 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -1,6 +1,6 @@
#!/usr/bin/env tarantool
test = require("sqltester")
-test:plan(127)
+test:plan(125)
testprefix = "analyze9"
@@ -1036,7 +1036,7 @@ test:do_execsql_test(
test:do_execsql_test(
15.3,
[[
- INSERT INTO "_sql_stat4" VALUES(42, 42, 42, 42, 42, 42);
+ INSERT INTO "_sql_stat4" VALUES('42', '42', '42', '42', '42', 42);
]])
test:do_execsql_test(
@@ -1049,22 +1049,6 @@ test:do_execsql_test(
-- </15.4>
})
-test:do_execsql_test(
- 15.5,
- [[
- UPDATE "_sql_stat1" SET "stat" = NULL;
- ]])
-
-test:do_execsql_test(
- 15.6,
- [[
- SELECT * FROM x1;
- ]], {
- -- <15.6>
- 1, 2, 3, 4, 5, 6
- -- </15.6>
- })
-
test:do_execsql_test(
15.7,
[[
diff --git a/test/wal_off/alter.result b/test/wal_off/alter.result
index 3f15874be..4ae6c05a3 100644
--- a/test/wal_off/alter.result
+++ b/test/wal_off/alter.result
@@ -28,7 +28,7 @@ end;
...
#spaces;
---
-- 65514
+- 65512
...
-- cleanup
for k, v in pairs(spaces) do
diff --git a/test/xlog/upgrade.result b/test/xlog/upgrade.result
index bb5fba93c..408c142e7 100644
--- a/test/xlog/upgrade.result
+++ b/test/xlog/upgrade.result
@@ -36,7 +36,7 @@ box.space._schema:select()
---
- - ['cluster', '<server_uuid>']
- ['max_id', 513]
- - ['version', 1, 8, 2]
+ - ['version', 1, 8, 4]
...
box.space._space:select()
---
@@ -92,6 +92,12 @@ box.space._space:select()
'type': 'unsigned'}]]
- [340, 1, '_space_sequence', 'memtx', 0, {}, [{'name': 'id', 'type': 'unsigned'},
{'name': 'sequence_id', 'type': 'unsigned'}, {'name': 'is_generated', 'type': 'boolean'}]]
+ - [348, 1, '_sql_stat1', 'memtx', 0, {}, [{'name': 'tbl', 'type': 'string'}, {'name': 'idx',
+ 'type': 'string'}, {'name': 'stat', 'type': 'scalar'}]]
+ - [349, 1, '_sql_stat4', 'memtx', 0, {}, [{'name': 'tbl', 'type': 'string'}, {'name': 'idx',
+ 'type': 'string'}, {'type': 'string', 'name': 'neq', 'is_nullable': true},
+ {'type': 'string', 'name': 'nlt', 'is_nullable': true}, {'type': 'string', 'name': 'ndlt',
+ 'is_nullable': true}, {'name': 'sample', 'type': 'scalar'}]]
- [512, 1, 'distro', 'memtx', 0, {}, [{'name': 'os', 'type': 'str'}, {'name': 'dist',
'type': 'str'}, {'name': 'version', 'type': 'num'}, {'name': 'time', 'type': 'num'}]]
- [513, 1, 'temporary', 'memtx', 0, {'temporary': true}, []]
@@ -141,6 +147,9 @@ box.space._index:select()
- [330, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]]
- [340, 0, 'primary', 'tree', {'unique': true}, [[0, 'unsigned']]]
- [340, 1, 'sequence', 'tree', {'unique': false}, [[1, 'unsigned']]]
+ - [348, 0, 'primary', 'tree', {'unique': true}, [[0, 'string'], [1, 'string']]]
+ - [349, 0, 'primary', 'tree', {'unique': true}, [[0, 'string'], [1, 'string'], [
+ 5, 'scalar']]]
- [512, 0, 'primary', 'hash', {'unique': true}, [[0, 'string'], [1, 'string'], [
2, 'unsigned']]]
- [512, 1, 'codename', 'hash', {'unique': true}, [[1, 'string']]]
--
2.14.1
More information about the Tarantool-patches
mailing list