Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: v.shpilevoy@tarantool.org, Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] [PATCH] sql: remove nKey from struct BtCursor
Date: Fri, 26 Oct 2018 17:59:26 +0300	[thread overview]
Message-ID: <20181026145926.15345-1-korablev@tarantool.org> (raw)

nKey member (indicating number of parts in key) now is used only for
COUNT routine. On the other hand, it is always equal to 0 (as well as
key is really NULL). Hence, nothing prevents us from removing this
field at all.
---
https://github.com/tarantool/tarantool/tree/np/remove-nkey-from-cursor

 src/box/sql.c        | 7 ++-----
 src/box/sql/cursor.h | 1 -
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/box/sql.c b/src/box/sql.c
index c7b87e57a..9d58b8fcf 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -340,8 +340,7 @@ int tarantoolSqlite3EphemeralCount(struct BtCursor *pCur, i64 *pnEntry)
 	assert(pCur->curFlags & BTCF_TEphemCursor);
 
 	struct index *primary_index = space_index(pCur->space, 0 /* PK */);
-	*pnEntry = index_count(primary_index, pCur->iter_type, pCur->key,
-			       pCur->nKey);
+	*pnEntry = index_count(primary_index, pCur->iter_type, 0, 0);
 	return SQLITE_OK;
 }
 
@@ -349,8 +348,7 @@ int tarantoolSqlite3Count(BtCursor *pCur, i64 *pnEntry)
 {
 	assert(pCur->curFlags & BTCF_TaCursor);
 
-	*pnEntry = index_count(pCur->index, pCur->iter_type, pCur->key,
-			       pCur->nKey);
+	*pnEntry = index_count(pCur->index, pCur->iter_type, 0, 0);
 	return SQLITE_OK;
 }
 
@@ -1031,7 +1029,6 @@ key_alloc(BtCursor *cur, size_t key_size)
 		}
 		cur->key = new_key;
 	}
-	cur->nKey = key_size;
 	return 0;
 }
 
diff --git a/src/box/sql/cursor.h b/src/box/sql/cursor.h
index da711a7de..d40ca87c8 100644
--- a/src/box/sql/cursor.h
+++ b/src/box/sql/cursor.h
@@ -41,7 +41,6 @@ typedef struct BtCursor BtCursor;
  * for ordinary space, or to TEphemCursor for ephemeral space.
  */
 struct BtCursor {
-	i64 nKey;		/* Size of pKey, or last integer key */
 	u8 curFlags;		/* zero or more BTCF_* flags defined below */
 	u8 eState;		/* One of the CURSOR_XXX constants (see below) */
 	u8 hints;		/* As configured by CursorSetHints() */
-- 
2.15.1

             reply	other threads:[~2018-10-26 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 14:59 Nikita Pettik [this message]
2018-10-29 10:27 ` [tarantool-patches] " Vladislav Shpilevoy
2018-10-29 12:25   ` n.pettik
2018-10-29 12:39     ` Vladislav Shpilevoy
2018-11-01 14:50 ` 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=20181026145926.15345-1-korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH] sql: remove nKey from struct BtCursor' \
    /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