From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] [PATCH 6/7] sql: don't add system spaces to Table hash
Date: Fri, 24 Aug 2018 01:55:52 +0300 [thread overview]
Message-ID: <b449ef840392ee36d16eacfa184bd81052708cda.1535064700.git.korablev@tarantool.org> (raw)
In-Reply-To: <cover.1535063199.git.korablev@tarantool.org>
In-Reply-To: <cover.1535064700.git.korablev@tarantool.org>
Part of #3561
---
src/box/sql.c | 105 ---------------------------------------------
src/box/sql/prepare.c | 13 ------
src/box/sql/tarantoolInt.h | 20 ---------
3 files changed, 138 deletions(-)
diff --git a/src/box/sql.c b/src/box/sql.c
index 61c766540..bec74bf29 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -1066,111 +1066,6 @@ cursor_advance(BtCursor *pCur, int *pRes)
return SQLITE_OK;
}
-/*********************************************************************
- * Schema support.
- */
-
-static int
-space_foreach_put_cb(struct space *space, void *udata)
-{
- if (space->def->opts.sql == NULL)
- return 0; /* Not SQL space. */
- sql_init_callback((struct init_data *) udata, space->def->name,
- space->def->id, 0, space->def->opts.sql);
- for (uint32_t i = 0; i < space->index_count; ++i) {
- struct index_def *def = space_index_def(space, i);
- if (def->opts.sql != NULL) {
- sql_init_callback((struct init_data *) udata, def->name,
- def->space_id, def->iid, def->opts.sql);
- }
- }
- return 0;
-}
-
-/* Load database schema from Tarantool. */
-void tarantoolSqlite3LoadSchema(struct init_data *init)
-{
- sql_init_callback(
- init, TARANTOOL_SYS_SCHEMA_NAME,
- BOX_SCHEMA_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_SCHEMA_NAME
- "\" (\"key\" TEXT PRIMARY KEY, \"value\")"
- );
-
- sql_init_callback(
- init, TARANTOOL_SYS_SPACE_NAME,
- BOX_SPACE_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_SPACE_NAME
- "\" (\"id\" INT PRIMARY KEY, \"owner\" INT, \"name\" TEXT, "
- "\"engine\" TEXT, \"field_count\" INT, \"opts\", \"format\")"
- );
-
- sql_init_callback(
- init, TARANTOOL_SYS_INDEX_NAME,
- BOX_INDEX_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_INDEX_NAME"\" "
- "(\"id\" INT, \"iid\" INT, \"name\" TEXT, \"type\" TEXT,"
- "\"opts\", \"parts\", PRIMARY KEY (\"id\", \"iid\"))"
- );
-
- sql_init_callback(
- init, TARANTOOL_SYS_TRIGGER_NAME,
- BOX_TRIGGER_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_TRIGGER_NAME"\" ("
- "\"name\" TEXT PRIMARY KEY, \"space_id\" INT, \"opts\")"
- );
-
- sql_init_callback(
- init, TARANTOOL_SYS_TRUNCATE_NAME,
- BOX_TRUNCATE_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_TRUNCATE_NAME
- "\" (\"id\" INT PRIMARY KEY, \"count\" INT NOT NULL)"
- );
-
- sql_init_callback(init, TARANTOOL_SYS_SEQUENCE_NAME, BOX_SEQUENCE_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_SEQUENCE_NAME
- "\" (\"id\" INT PRIMARY KEY, \"uid\" INT, \"name\" TEXT, \"step\" INT, "
- "\"max\" INT, \"min\" INT, \"start\" INT, \"cache\" INT, \"cycle\" INT)");
-
- sql_init_callback(init, TARANTOOL_SYS_SPACE_SEQUENCE_NAME,
- BOX_SPACE_SEQUENCE_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_SPACE_SEQUENCE_NAME
- "\" (\"space_id\" INT PRIMARY KEY, \"sequence_id\" INT, \"flag\" INT)");
-
- sql_init_callback(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_init_callback(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\"))");
-
- sql_init_callback(init, TARANTOOL_SYS_FK_CONSTRAINT_NAME,
- BOX_FK_CONSTRAINT_ID, 0,
- "CREATE TABLE \""TARANTOOL_SYS_FK_CONSTRAINT_NAME
- "\"(\"name\" TEXT, \"parent_id\" INT, \"child_id\" INT,"
- "\"deferred\" INT, \"match\" TEXT, \"on_delete\" TEXT,"
- "\"on_update\" TEXT, \"child_cols\", \"parent_cols\","
- "PRIMARY KEY(\"name\", \"child_id\"))");
-
- /* Read _space */
- if (space_foreach(space_foreach_put_cb, init) != 0) {
- init->rc = SQL_TARANTOOL_ERROR;
- return;
- }
-}
-
/*********************************************************************
* Metainformation about available spaces and indices is stored in
* _space and _index system spaces respectively.
diff --git a/src/box/sql/prepare.c b/src/box/sql/prepare.c
index bea9dc583..a59e70dd0 100644
--- a/src/box/sql/prepare.c
+++ b/src/box/sql/prepare.c
@@ -140,14 +140,6 @@ sqlite3InitDatabase(sqlite3 * db)
memset(&init, 0, sizeof(init));
init.db = db;
-
- /* Load schema from Tarantool - into the primary db only. */
- tarantoolSqlite3LoadSchema(&init);
-
- if (init.rc) {
- rc = init.rc;
- goto error_out;
- }
/* Read the schema information out of the schema tables
*/
assert(db->init.busy);
@@ -160,11 +152,6 @@ sqlite3InitDatabase(sqlite3 * db)
rc = SQLITE_NOMEM_BKPT;
sqlite3ResetAllSchemasOfConnection(db);
}
-
- error_out:
- if (rc == SQLITE_NOMEM || rc == SQLITE_IOERR_NOMEM) {
- sqlite3OomFault(db);
- }
return rc;
}
diff --git a/src/box/sql/tarantoolInt.h b/src/box/sql/tarantoolInt.h
index 69af6e723..9334de52d 100644
--- a/src/box/sql/tarantoolInt.h
+++ b/src/box/sql/tarantoolInt.h
@@ -10,30 +10,10 @@
struct fkey_def;
-/*
- * Tarantool system spaces.
- */
-#define TARANTOOL_SYS_SEQUENCE_NAME "_sequence"
-#define TARANTOOL_SYS_SPACE_SEQUENCE_NAME "_space_sequence"
-#define TARANTOOL_SYS_SCHEMA_NAME "_schema"
-#define TARANTOOL_SYS_SPACE_NAME "_space"
-#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"
-#define TARANTOOL_SYS_FK_CONSTRAINT_NAME "_fk_constraint"
-
-/* Max space id seen so far. */
-#define TARANTOOL_SYS_SCHEMA_MAXID_KEY "max_id"
-
/* Insert or replace operation types - necessary for vdbe */
#define TARANTOOL_INDEX_INSERT 1
#define TARANTOOL_INDEX_REPLACE 2
-/* Load database schema from Tarantool. */
-void tarantoolSqlite3LoadSchema(struct init_data *init);
-
/* Misc */
const char *tarantoolErrorMessage();
--
2.15.1
next prev parent reply other threads:[~2018-08-23 22:56 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-23 22:55 [tarantool-patches] [PATCH 0/7] Finish SQL DD integration Nikita Pettik
[not found] ` <cover.1535064700.git.korablev@tarantool.org>
2018-08-23 22:55 ` [tarantool-patches] [PATCH 1/7] sql: remove struct schema from struct Table Nikita Pettik
2018-08-29 0:58 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-02 23:51 ` n.pettik
2018-09-16 19:32 ` Vladislav Shpilevoy
2018-09-19 10:58 ` n.pettik
2018-08-23 22:55 ` [tarantool-patches] [PATCH 2/7] sql: remove SQLite original struct Index Nikita Pettik
2018-08-29 0:58 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-02 23:51 ` n.pettik
2018-09-06 19:54 ` Vladislav Shpilevoy
2018-09-16 19:04 ` n.pettik
2018-08-23 22:55 ` [tarantool-patches] [PATCH 3/7] sql: remove struct Table from analyze routine Nikita Pettik
2018-08-29 0:58 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-02 23:52 ` n.pettik
2018-08-23 22:55 ` [tarantool-patches] [PATCH 4/7] sql: refactor ALTER RENAME code generation Nikita Pettik
2018-08-29 0:58 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-02 23:52 ` n.pettik
2018-08-23 22:55 ` [tarantool-patches] [PATCH 5/7] sql: remove lookups in Table hash Nikita Pettik
2018-08-29 0:58 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-02 23:52 ` n.pettik
2018-08-23 22:55 ` Nikita Pettik [this message]
2018-08-29 0:58 ` [tarantool-patches] Re: [PATCH 6/7] sql: don't add system spaces to " Vladislav Shpilevoy
2018-09-02 23:52 ` n.pettik
2018-09-06 19:54 ` Vladislav Shpilevoy
2018-09-16 19:04 ` n.pettik
2018-08-23 22:55 ` [tarantool-patches] [PATCH 7/7] sql: finish DD integration Nikita Pettik
2018-08-29 0:58 ` [tarantool-patches] " Vladislav Shpilevoy
2018-09-20 14:45 ` 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=b449ef840392ee36d16eacfa184bd81052708cda.1535064700.git.korablev@tarantool.org \
--to=korablev@tarantool.org \
--cc=tarantool-patches@freelists.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [tarantool-patches] [PATCH 6/7] sql: don'\''t add system spaces to Table hash' \
/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