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 E386125CCC for ; Wed, 20 Jun 2018 02:58:34 -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 2zdBUEm4gZG2 for ; Wed, 20 Jun 2018 02:58:34 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 A1FE625CC2 for ; Wed, 20 Jun 2018 02:58:34 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: drop useless legacy Cursor hints References: <1528580490.331665582@f480.i.mail.ru> <44295e51-aabe-27f9-8331-6d30387a3551@tarantool.org> <871fb50b-d725-f8b6-10b6-8c8513473a24@tarantool.org> <7e2820f7-694f-a4ee-4d99-905c57866928@tarantool.org> <5ACBFD26-D27D-4D01-959A-0D861ECA600A@tarantool.org> <295e3ffa-2b83-916a-9741-9156c2108ece@tarantool.org> <0C053368-F010-48B0-9505-D57B9E7ABCA4@tarantool.org> From: Kirill Shcherbatov Message-ID: <125f7541-10cf-6ee5-a70a-140fed45fd27@tarantool.org> Date: Wed, 20 Jun 2018 09:58:32 +0300 MIME-Version: 1.0 In-Reply-To: <0C053368-F010-48B0-9505-D57B9E7ABCA4@tarantool.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit 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: tarantool-patches@freelists.org Cc: Nikita Pettik >> Deleted BTREE_BULKLOAD and OPFLAG_BULKCSR as there become > > Typo: there —> they. Ok, fixed. > Except for your removals, I also suggest you to remove: > > SQLITE_CursorHints macros; > sqlite3CursorHintFlags() function — it is used only once and can be inlined; > sqlite3CursorHasHint() function — it is used only once and can be inlined; Thank you for suggestion, diff --git a/src/box/sql/cursor.c b/src/box/sql/cursor.c index 9dd2b02..b096691 100644 --- a/src/box/sql/cursor.c +++ b/src/box/sql/cursor.c @@ -48,16 +48,6 @@ sql_cursor_cleanup(struct BtCursor *cursor) } /* - * Provide flag hints to the cursor. - */ -void -sqlite3CursorHintFlags(BtCursor * pCur, unsigned x) -{ - assert(x == OPFLAG_SEEKEQ || x == 0); - pCur->hints = x; -} - -/* * Initialize memory that will be converted into a BtCursor object. */ void @@ -185,13 +175,3 @@ sqlite3CursorPrevious(BtCursor *pCur, int *pRes) *pRes = 0; return tarantoolSqlite3Previous(pCur, pRes); } - -/* - * Return true if the cursor has a hint specified. This routine is - * only used from within assert() statements - */ -int -sqlite3CursorHasHint(BtCursor *pCsr, unsigned int mask) -{ - return (pCsr->hints & mask) != 0; -} diff --git a/src/box/sql/cursor.h b/src/box/sql/cursor.h index 252aaac..da711a7 100644 --- a/src/box/sql/cursor.h +++ b/src/box/sql/cursor.h @@ -54,7 +54,6 @@ struct BtCursor { }; void sqlite3CursorZero(BtCursor *); -void sqlite3CursorHintFlags(BtCursor *, unsigned); /** * Close a cursor and invalidate its state. In case of @@ -76,7 +75,6 @@ int sqlite3CursorPayload(BtCursor *, u32 offset, u32 amt, void *); */ void sql_cursor_cleanup(struct BtCursor *cursor); -int sqlite3CursorHasHint(BtCursor *, unsigned int mask); #ifndef NDEBUG int sqlite3CursorIsValid(BtCursor *); diff --git a/src/box/sql/sqliteInt.h b/src/box/sql/sqliteInt.h index 272d95e..956d6fc 100644 --- a/src/box/sql/sqliteInt.h +++ b/src/box/sql/sqliteInt.h @@ -1696,7 +1696,6 @@ struct sqlite3 { #define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */ #define SQLITE_Transitive 0x0200 /* Transitive constraints */ #define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */ -#define SQLITE_CursorHints 0x2000 /* Add OP_CursorHint opcodes */ #define SQLITE_AllOpts 0xffff /* All optimizations */ /* diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 3139933..e1265f4 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -3206,7 +3206,7 @@ case OP_OpenWrite: pCur->key_def = index->def->key_def; open_cursor_set_hints: - sqlite3CursorHintFlags(pCur->uc.pCursor, pOp->p5 & OPFLAG_SEEKEQ); + pCur->uc.pCursor->hints = pOp->p5 & OPFLAG_SEEKEQ; if (rc) goto abort_due_to_error; break; } @@ -3526,7 +3526,7 @@ case OP_SeekGT: { /* jump, in3 */ * must be immediately followed by an OP_IdxGT or * OP_IdxLT opcode, respectively, with the same key. */ - if (sqlite3CursorHasHint(pC->uc.pCursor, OPFLAG_SEEKEQ) != 0) { + if ((pC->uc.pCursor->hints & OPFLAG_SEEKEQ) != 0) { eqOnly = 1; assert(pOp->opcode==OP_SeekGE || pOp->opcode==OP_SeekLE); assert(pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT);