From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v1 1/2] sql: get rid off sqlite3NestedParse in clean stats Date: Thu, 5 Jul 2018 19:11:35 +0300 [thread overview] Message-ID: <355d8c55-abc7-a088-8dba-6fb3bff32b51@tarantool.org> (raw) In-Reply-To: <bd8d0b6358200f3c3656a4c365bfe0d484b09071.1530724375.git.kshcherbatov@tarantool.org> Hello. Thanks for the patch! I have pushed my review fixes on the branch. Please, squash, if you agree, and debug if the tests fail. Below you may find 3 comments that I fixed. Style violations I did not mentioned here. Just fixed on the branch. Also I have found that vdbe_emit_open_cursor() has the second parameter named 'index_id', but in some places the function takes real index_id, in other places it takes tnum, and in vdbe it is interpreted as tnum. Please, fix this mess in a separate commit. I think, we should always pass index_id. On 04/07/2018 20:17, Kirill Shcherbatov wrote: > Now we manually generate AST structures to drop outdated > stats from _sql_stat1 and _sql_stat4 spaces instead of > starting sqlite3NestedParse. This function become totally > useless and could be removed. > > Part of #3496. > --- > src/box/sql/analyze.c | 39 +++++++++++------------ > src/box/sql/build.c | 82 ++++++++++++++++++++++++++++++++++++------------- > src/box/sql/sqliteInt.h | 13 ++++++++ > 3 files changed, 94 insertions(+), 40 deletions(-) > > diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c > index 5f73f02..e08c151 100644 > --- a/src/box/sql/analyze.c > +++ b/src/box/sql/analyze.c > @@ -116,7 +116,7 @@ > #include "tarantoolInt.h" > #include "vdbeInt.h" > > -/* > +/** > * This routine generates code that opens the sql_statN tables. > * The _sql_stat1 table is always relevant. _sql_stat4 is only opened when > * appropriate compile-time options are provided. > @@ -160,10 +163,9 @@ openStatTable(Parse * pParse, /* Parsing context */ > assert(pStat != NULL); > aRoot[i] = pStat->tnum; > aCreateTbl[i] = 0; 1. Unused array. 2. You do not need to lookup pStat for tnum in non-debug build since you know stat tables id from schema_def.h. This HashFind is useful for debug assertion only. > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index 0072f84..ac53906 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -2050,6 +2050,63 @@ sql_store_select(struct Parse *parse_context, struct Select *select) > } > > /** > + * Create expression record of with struct ID EQ STRING. > + * > + * @param parse The parsing context. > + * @param col_type_name Name of column. > + * @param col_name Name of row. > + * @retval not NULL on success. > + * @retval NULL on failure. > + */ > +static struct Expr * > +sql_id_eq_str_expr(struct Parse *parse, const char *col_type_name, > + const char *col_name) > +{ > + struct sqlite3 *db = parse->db; > + > + struct Expr *col_type_expr = > + sqlite3Expr(db, TK_ID, col_type_name); > + struct Expr *col_name_expr = > + sqlite3Expr(db, TK_STRING, col_name); > + struct Expr *col_eq_expr = > + sqlite3PExpr(parse, TK_EQ, col_type_expr, col_name_expr); > + if (col_type_expr == NULL || col_name_expr == NULL) { 3. If col_eq_expr == NULL here, then col_type/name_expr leak. > + sql_expr_delete(db, col_eq_expr, false); > + col_eq_expr = NULL; > + } > + return col_eq_expr; > +} > +
next prev parent reply other threads:[~2018-07-05 16:11 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-04 17:17 [tarantool-patches] [PATCH v1 0/2] sql: get rid off sqlite3NestedParse Kirill Shcherbatov 2018-07-04 17:17 ` [tarantool-patches] [PATCH v1 1/2] sql: get rid off sqlite3NestedParse in clean stats Kirill Shcherbatov 2018-07-05 16:11 ` Vladislav Shpilevoy [this message] 2018-07-06 18:13 ` [tarantool-patches] " Kirill Shcherbatov 2018-07-09 10:20 ` Vladislav Shpilevoy 2018-07-04 17:17 ` [tarantool-patches] [PATCH v1 2/2] sql: remove usless sqlite3NestedParse function Kirill Shcherbatov 2018-07-05 16:11 ` [tarantool-patches] " Vladislav Shpilevoy 2018-07-06 18:13 ` Kirill Shcherbatov 2018-07-09 10:20 ` [tarantool-patches] Re: [PATCH v1 0/2] sql: get rid off sqlite3NestedParse Vladislav Shpilevoy
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=355d8c55-abc7-a088-8dba-6fb3bff32b51@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v1 1/2] sql: get rid off sqlite3NestedParse in clean stats' \ /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