Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: drop useless legacy Cursor hints
Date: Wed, 20 Jun 2018 09:58:32 +0300	[thread overview]
Message-ID: <125f7541-10cf-6ee5-a70a-140fed45fd27@tarantool.org> (raw)
In-Reply-To: <0C053368-F010-48B0-9505-D57B9E7ABCA4@tarantool.org>

>> 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);

  reply	other threads:[~2018-06-20  6:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-09 13:09 [tarantool-patches] " Kirill Shcherbatov
2018-06-09 21:41 ` [tarantool-patches] " Vladislav Shpilevoy
2018-06-13  6:43   ` [tarantool-patches] " Kirill Shcherbatov
2018-06-13  8:48     ` Vladislav Shpilevoy
2018-06-19  9:41       ` Kirill Shcherbatov
2018-06-19 14:03         ` n.pettik
2018-06-19 14:31           ` Kirill Shcherbatov
2018-06-19 18:31             ` n.pettik
2018-06-20  6:58               ` Kirill Shcherbatov [this message]
2018-06-20  9:05                 ` n.pettik
2018-06-22 12:11                   ` 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=125f7541-10cf-6ee5-a70a-140fed45fd27@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: drop useless legacy Cursor hints' \
    /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