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 E9FA12B5E8 for ; Tue, 3 Apr 2018 13:55:00 -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 b22mVfBfwO6q for ; Tue, 3 Apr 2018 13:55:00 -0400 (EDT) Received: from smtp63.i.mail.ru (smtp63.i.mail.ru [217.69.128.43]) (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 300862B489 for ; Tue, 3 Apr 2018 13:54:59 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 1/2] sql: remove obsolete SQLite routine References: <0e28c9181b19643504f335a164f8d098fdab6614.1522769126.git.korablev@tarantool.org> From: Vladislav Shpilevoy Message-ID: <7a18a3e7-9076-087e-df93-dde6955adc70@tarantool.org> Date: Tue, 3 Apr 2018 20:54:56 +0300 MIME-Version: 1.0 In-Reply-To: <0e28c9181b19643504f335a164f8d098fdab6614.1522769126.git.korablev@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-US 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: Nikita Pettik , tarantool-patches@freelists.org Hello. See 7 comments below. 03.04.2018 19:14, Nikita Pettik пишет: > Some of legacy functions seem to be useless, since they serve as > wrappers around others; the rest rely on capabilities which are no > longer relevant. This patch provides slight refactoring of such > functions. > > Removed entities: > - sqlite3LocateTableItem() - replaced with sqlite3LocateTable(); > - sqlite3FindTable() - replaced with sqlite3HashFind(); > - sqlite3ColumnOfIndex() - in Tarantool order of columns always the same; > - sqlite3FindIndex() - replaced with sqlite3LocateIndex(); > - sqlite3CodeVerifySchema(); > - sqlite3SchemaToIndex(); > - sqlite3MultiWrite(); > - Parse->cookieMast; > - Vdbe->usesStmtJournal; > --- > src/box/sql/alter.c | 13 ++- > src/box/sql/analyze.c | 25 +++--- > src/box/sql/build.c | 213 ++++++++++-------------------------------------- > src/box/sql/delete.c | 5 +- > src/box/sql/expr.c | 9 +- > src/box/sql/fkey.c | 3 +- > src/box/sql/insert.c | 10 +-- > src/box/sql/pragma.c | 18 ++-- > src/box/sql/prepare.c | 29 ------- > src/box/sql/select.c | 4 +- > src/box/sql/sqliteInt.h | 11 +-- > src/box/sql/trigger.c | 7 +- > src/box/sql/update.c | 2 +- > src/box/sql/vdbe.c | 1 - > src/box/sql/vdbeInt.h | 1 - > src/box/sql/vdbeaux.c | 1 - > src/box/sql/where.c | 2 - > src/box/sql/wherecode.c | 7 +- > 18 files changed, 83 insertions(+), 278 deletions(-) > > diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c > index 054c0856c..a19324ed2 100644 > --- a/src/box/sql/alter.c > +++ b/src/box/sql/alter.c > @@ -122,7 +121,7 @@ sqlite3AlterRenameTable(Parse * pParse, /* Parser context. */ > if (v == 0) { > goto exit_rename_table; > } > - sqlite3BeginWriteOperation(pParse, false); > + sql_set_multi_write(pParse, false); 1. Can you please alongside with this patch make sql_set_multi_write take boolean as the last argument? Now it sometimes gets true/false, sometimes 1/0. It is strange. > > /* Drop and reload the internal table schema. */ > reloadTableSchema(pParse, pTab, zName); > > diff --git a/src/box/sql/build.c b/src/box/sql/build.c > index 5e3ed0f39..61194e06b 100644 > --- a/src/box/sql/build.c > +++ b/src/box/sql/build.c > @@ -93,23 +93,16 @@ sqlite3FinishCoding(Parse * pParse) > * transaction on each used database and to verify the schema cookie > * on each used database. > */ > - if (db->mallocFailed == 0 > - && (DbMaskNonZero(pParse->cookieMask) || pParse->pConstExpr) > - ) { > + if (db->mallocFailed == 0 || pParse->pConstExpr) { 2. Please, together with cookie mask checking remove or refactor a comment above. > @@ -2240,7 +2164,6 @@ sqlite3CodeDropTable(Parse * pParse, Table * pTab, int isView) > > v = sqlite3GetVdbe(pParse); > assert(v != 0); > - sqlite3BeginWriteOperation(pParse, 1); 3. Why did you delete it with no replacement by sql_set_multi_write(false) ? > @@ -2376,15 +2299,12 @@ sqlite3DropTable(Parse * pParse, SrcList * pName, int isView, int noErr) > if (noErr) > db->suppressErr++; > assert(isView == 0 || isView == LOCATE_VIEW); > - pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); > + pTab = sqlite3LocateTable(pParse, isView, pName->a[0].zName); > if (noErr) > db->suppressErr--; > > - if (pTab == 0) { > - if (noErr) > - sqlite3CodeVerifySchema(pParse); > + if (pTab == 0) 4. Lets use ==/!= NULL in all new code. Same about checking sqlite3HashFind results. And if it is possible with not huge diff, can you please rename sqlite3HashFind to sql_hash_find ? 5. sqlite3MultiWrite in commit message is listed among deleted functions, but its declaration still exists. 6. cookieMast - typo in commit message. And how about do not list deleted functions in a commit body? I can not imagine, that somebody except me will search for any of these functions. And the list is deprecated - for example, sqlite3BeginWriteOperation is deleted too, but does not presence in the list. 7. How about remove DbMaskTest, DbMaskZero and other dbmask shit?