From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id A7BCD268D1 for ; Fri, 13 Apr 2018 04:50:41 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bMwSf54Fhrnu for ; Fri, 13 Apr 2018 04:50:41 -0400 (EDT) Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [94.100.177.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 6A71F25B86 for ; Fri, 13 Apr 2018 04:50:40 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH 2/2] sql: statistics removal after dropping an index From: "n.pettik" In-Reply-To: Date: Fri, 13 Apr 2018 11:50:30 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <51BFB6B0-C9CE-4380-8758-7F991512A752@tarantool.org> References: <1522791436-8221-1-git-send-email-hollow653@gmail.com> <926E041C-FCCB-46B0-B49B-21292CB70813@tarantool.org> <4E93854E-25F3-45F7-8590-5CD96991E365@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: "N. Tatunov" Cc: tarantool-patches@freelists.org Hello. I still notice several codestyle violations. This patch can=E2=80=99t be pushed until all of them are fixed. Please, consider them. > On 12 Apr 2018, at 09:06, Hollow111 wrote: >=20 > Hello. Here's the diff for the changes: >=20 > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index 92f3cb6..0287183 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -2129,18 +2129,32 @@ sqliteViewResetAll(sqlite3 * db) > * Remove entries from the _sql_stat1 and _sql_stat4 > * system spaces after a DROP INDEX or DROP TABLE command. > * > - * @param pParse Parsing context. > - * @param zType Type of entry to be deleted: > - * 'idx' or 'tbl' string literal. > - * @param zName Name of index or table. > + * @param parse The parsing context. > + * @param table_name The table to be dropped or > + * the table that contains index to be dropped. > + * @param idx_name Index to be dropped. > */ > static void > -sql_clear_stat_spaces(Parse * pParse, const char *zType, const char = *zName) > +sql_clear_stat_spaces(Parse *parse, const char *table_name, > + const char *idx_name) Arguments which you carry to the next line, should start right below = previous: void f(x int, =E2=80=A6. y char, =E2=80=A6. z double =E2=80=A6); > { > - sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat1\" WHERE = \"%s\"=3D%Q", > - zType, zName); > - sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat4\" WHERE = \"%s\"=3D%Q", > - zType, zName); > + if (idx_name !=3D NULL) { > + sqlite3NestedParse(parse, Wrong indentation. > + "DELETE FROM \"_sql_stat1\" = WHERE (\"idx\"=3D%Q AND " > + "\"tbl\"=3D%Q)", > + idx_name, table_name); > + sqlite3NestedParse(parse, > + "DELETE FROM \"_sql_stat4\" = WHERE (\"idx\"=3D%Q AND =E2=80=9C Arguments which you carry to the next line, should start right below = previous. > + "\"tbl\"=3D%Q)", > + idx_name, table_name); > + } else { > + sqlite3NestedParse(parse, > + "DELETE FROM \"_sql_stat1\" = WHERE \"tbl\"=3D%Q=E2=80=9D, Arguments which you carry to the next line, should start right below = previous. > + table_name); > + sqlite3NestedParse(parse, > + "DELETE FROM \"_sql_stat4\" WHERE \"tbl\"=3D%Q", > + table_name); > + } Wrong indentation. > } > =20 > /** > @@ -2325,7 +2339,7 @@ sql_drop_table(struct Parse *parse_context, = struct SrcList *table_name_list, > * tuple with corresponding space_id from _space. > */ > =20 > - sql_clear_stat_spaces(parse_context, "tbl", space_name); > + sql_clear_stat_spaces(parse_context, space_name, NULL); > struct Table *tab =3D sqlite3HashFind(&db->pSchema->tblHash, = space_name); > sqlite3FkDropTable(parse_context, table_name_list, tab); > sql_code_drop_table(parse_context, space, is_view); > @@ -3328,7 +3342,7 @@ sql_drop_index(struct Parse *parse_context, = struct SrcList *index_name_list, > * But firstly, delete statistics since schema > * changes after DDL. > */ > - sql_clear_stat_spaces(parse_context, "idx", index->def->name); > + sql_clear_stat_spaces(parse_context, table_name, = index->def->name); > int record_reg =3D ++parse_context->nMem; > int space_id_reg =3D ++parse_context->nMem; > sqlite3VdbeAddOp2(v, OP_Integer, space_id, space_id_reg);