Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] sql: remove nKey from struct BtCursor
@ 2018-10-26 14:59 Nikita Pettik
  2018-10-29 10:27 ` [tarantool-patches] " Vladislav Shpilevoy
  2018-11-01 14:50 ` Kirill Yukhin
  0 siblings, 2 replies; 5+ messages in thread
From: Nikita Pettik @ 2018-10-26 14:59 UTC (permalink / raw)
  To: tarantool-patches; +Cc: v.shpilevoy, Nikita Pettik

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-11-01 14:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 14:59 [tarantool-patches] [PATCH] sql: remove nKey from struct BtCursor Nikita Pettik
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox