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/6] Remove SQL string from index opts Date: Mon, 10 Dec 2018 00:30:26 +0300 [thread overview] Message-ID: <2574e71b463f1dcdc836c108a2e7d7e048a5d34b.1544387419.git.korablev@tarantool.org> (raw) In-Reply-To: <cover.1544387419.git.korablev@tarantool.org> In-Reply-To: <cover.1544387419.git.korablev@tarantool.org> Closes #2647 --- src/box/alter.cc | 9 --------- src/box/index_def.c | 20 -------------------- src/box/index_def.h | 9 --------- src/box/sql/analyze.c | 3 +-- src/box/sql/where.c | 1 - 5 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/box/alter.cc b/src/box/alter.cc index 029da029e..c6ee025f2 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -187,15 +187,6 @@ index_opts_decode(struct index_opts *opts, const char *map, BOX_INDEX_FIELD_OPTS, "distance must be either "\ "'euclid' or 'manhattan'"); } - if (opts->sql != NULL) { - char *sql = strdup(opts->sql); - if (sql == NULL) { - opts->sql = NULL; - tnt_raise(OutOfMemory, strlen(opts->sql) + 1, "strdup", - "sql"); - } - opts->sql = sql; - } if (opts->range_size <= 0) { tnt_raise(ClientError, ER_WRONG_INDEX_OPTIONS, BOX_INDEX_FIELD_OPTS, diff --git a/src/box/index_def.c b/src/box/index_def.c index 45c74d9ec..2ba57ee9d 100644 --- a/src/box/index_def.c +++ b/src/box/index_def.c @@ -46,7 +46,6 @@ const struct index_opts index_opts_default = { /* .run_size_ratio = */ 3.5, /* .bloom_fpr = */ 0.05, /* .lsn = */ 0, - /* .sql = */ NULL, /* .stat = */ NULL, }; @@ -61,7 +60,6 @@ const struct opt_def index_opts_reg[] = { OPT_DEF("run_size_ratio", OPT_FLOAT, struct index_opts, run_size_ratio), OPT_DEF("bloom_fpr", OPT_FLOAT, struct index_opts, bloom_fpr), OPT_DEF("lsn", OPT_INT64, struct index_opts, lsn), - OPT_DEF("sql", OPT_STRPTR, struct index_opts, sql), OPT_END, }; @@ -109,15 +107,6 @@ index_def_new(uint32_t space_id, uint32_t iid, const char *name, def->space_id = space_id; def->iid = iid; def->opts = *opts; - if (opts->sql != NULL) { - def->opts.sql = strdup(opts->sql); - if (def->opts.sql == NULL) { - diag_set(OutOfMemory, strlen(opts->sql) + 1, "strdup", - "def->opts.sql"); - index_def_delete(def); - return NULL; - } - } /* Statistics are initialized separately. */ assert(opts->stat == NULL); return def; @@ -148,15 +137,6 @@ index_def_dup(const struct index_def *def) } rlist_create(&dup->link); dup->opts = def->opts; - if (def->opts.sql != NULL) { - dup->opts.sql = strdup(def->opts.sql); - if (dup->opts.sql == NULL) { - diag_set(OutOfMemory, strlen(def->opts.sql) + 1, - "strdup", "dup->opts.sql"); - index_def_delete(dup); - return NULL; - } - } if (def->opts.stat != NULL) { dup->opts.stat = index_stat_dup(def->opts.stat); if (dup->opts.stat == NULL) { diff --git a/src/box/index_def.h b/src/box/index_def.h index 273b8cb53..7717ecd64 100644 --- a/src/box/index_def.h +++ b/src/box/index_def.h @@ -157,10 +157,6 @@ struct index_opts { * LSN from the time of index creation. */ int64_t lsn; - /** - * SQL statement that produced this index. - */ - char *sql; /** * SQL specific statistics concerning tuples * distribution for query planer. It is automatically @@ -187,7 +183,6 @@ index_opts_create(struct index_opts *opts) static inline void index_opts_destroy(struct index_opts *opts) { - free(opts->sql); free(opts->stat); TRASH(opts); } @@ -212,10 +207,6 @@ index_opts_cmp(const struct index_opts *o1, const struct index_opts *o2) return o1->run_size_ratio < o2->run_size_ratio ? -1 : 1; if (o1->bloom_fpr != o2->bloom_fpr) return o1->bloom_fpr < o2->bloom_fpr ? -1 : 1; - if ((o1->sql == NULL) != (o2->sql == NULL)) - return 1; - if (o1->sql != NULL) - return strcmp(o1->sql, o2->sql); return 0; } diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c index 8f8b6eb5d..51c63fa7a 100644 --- a/src/box/sql/analyze.c +++ b/src/box/sql/analyze.c @@ -1606,8 +1606,7 @@ index_field_tuple_est(const struct index_def *idx_def, uint32_t field) { assert(idx_def != NULL); struct space *space = space_by_id(idx_def->space_id); - if (space == NULL || (idx_def->opts.sql != NULL && - strcmp(idx_def->opts.sql, "fake_autoindex") == 0)) + if (space == NULL || strcmp(idx_def->name, "fake_autoindex") == 0) return idx_def->opts.stat->tuple_log_est[field]; assert(field <= idx_def->key_def->part_count); /* Statistics is held only in real indexes. */ diff --git a/src/box/sql/where.c b/src/box/sql/where.c index 9c3462bc0..571b5af78 100644 --- a/src/box/sql/where.c +++ b/src/box/sql/where.c @@ -2818,7 +2818,6 @@ tnt_error: struct index_opts opts; index_opts_create(&opts); - opts.sql = "fake_autoindex"; fake_index = index_def_new(pTab->def->id, 0,"fake_autoindex", sizeof("fake_autoindex") - 1, TREE, &opts, key_def, NULL); -- 2.15.1
next prev parent reply other threads:[~2018-12-09 21:30 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-12-09 21:30 [tarantool-patches] [PATCH 0/6] Remove string of SQL statement from opts Nikita Pettik 2018-12-09 21:30 ` [tarantool-patches] [PATCH 1/6] sql: avoid calling sql_encode_table_opts() during trigger creation Nikita Pettik 2018-12-10 14:17 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-11 18:29 ` n.pettik 2018-12-09 21:30 ` [tarantool-patches] [PATCH 2/6] sql: don't update SQL string during renaming Nikita Pettik 2018-12-10 14:16 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-11 18:29 ` n.pettik 2018-12-12 12:36 ` Vladislav Shpilevoy 2018-12-13 12:42 ` n.pettik 2018-12-09 21:30 ` [tarantool-patches] [PATCH 3/6] test: fix sqltester methods to drop all tables/views Nikita Pettik 2018-12-10 14:16 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-11 18:29 ` n.pettik 2018-12-09 21:30 ` [tarantool-patches] [PATCH 4/6] sql: don't add string of 'CREATE TABLE...' to space opts Nikita Pettik 2018-12-10 14:17 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-11 18:29 ` n.pettik 2018-12-09 21:30 ` [tarantool-patches] [PATCH 5/6] sql: don't add string of 'CREATE INDEX ...' to index opts Nikita Pettik 2018-12-10 14:18 ` [tarantool-patches] " Vladislav Shpilevoy 2018-12-11 18:29 ` n.pettik 2018-12-09 21:30 ` Nikita Pettik [this message] 2018-12-25 13:45 ` [tarantool-patches] Re: [PATCH 0/6] Remove string of SQL statement from opts 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=2574e71b463f1dcdc836c108a2e7d7e048a5d34b.1544387419.git.korablev@tarantool.org \ --to=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [tarantool-patches] [PATCH 6/6] Remove SQL string from index opts' \ /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