Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Yukhin <kyukhin@tarantool.org>
To: v.shpilevoy@tarantool.org
Cc: tarantool-patches@freelists.org, Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def
Date: Thu, 17 May 2018 16:41:49 +0300	[thread overview]
Message-ID: <98d8572affd09ca99e92f29e90165ca29f664847.1526564450.git.kyukhin@tarantool.org> (raw)

It is possible to extract key_def from iterator directly
in SQL FE. So, no need in any temporary API hacks anymore.
The patch removes this API function and replaces its calls
w/ direct field access in SQL FE.

Closes #2425
---
 src/box/index.cc | 6 ------
 src/box/index.h  | 6 ------
 src/box/sql.c    | 8 ++++----
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/box/index.cc b/src/box/index.cc
index fcdc32b..4e6c6ef 100644
--- a/src/box/index.cc
+++ b/src/box/index.cc
@@ -186,12 +186,6 @@ check_index(uint32_t space_id, uint32_t index_id,
 
 /* {{{ Public API */
 
-const box_key_def_t *
-box_iterator_key_def(box_iterator_t *iterator)
-{
-	return iterator->index->def->key_def;
-}
-
 ssize_t
 box_index_len(uint32_t space_id, uint32_t index_id)
 {
diff --git a/src/box/index.h b/src/box/index.h
index 1803a63..0aa96ad 100644
--- a/src/box/index.h
+++ b/src/box/index.h
@@ -89,12 +89,6 @@ box_iterator_next(box_iterator_t *iterator, box_tuple_t **result);
 void
 box_iterator_free(box_iterator_t *iterator);
 
-/**
- * @todo: delete, a hack added by @mejedi for sql
- */
-const box_key_def_t *
-box_iterator_key_def(box_iterator_t *iterator);
-
 /**
  * Return the number of element in the index.
  *
diff --git a/src/box/sql.c b/src/box/sql.c
index 6104a6d..195fdfb 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -493,7 +493,7 @@ int tarantoolSqlite3EphemeralDelete(BtCursor *pCur)
 	char *key;
 	uint32_t key_size;
 	key = tuple_extract_key(pCur->last_tuple,
-				box_iterator_key_def(pCur->iter),
+				pCur->iter->index->def->key_def,
 				&key_size);
 	if (key == NULL)
 		return SQL_TARANTOOL_DELETE_FAIL;
@@ -519,7 +519,7 @@ int tarantoolSqlite3Delete(BtCursor *pCur, u8 flags)
 	int rc;
 
 	key = tuple_extract_key(pCur->last_tuple,
-				box_iterator_key_def(pCur->iter),
+				pCur->iter->index->def->key_def,
 				&key_size);
 	if (key == NULL)
 		return SQL_TARANTOOL_DELETE_FAIL;
@@ -580,7 +580,7 @@ int tarantoolSqlite3EphemeralClearTable(BtCursor *pCur)
 	uint32_t  key_size;
 
 	while (iterator_next(it, &tuple) == 0 && tuple != NULL) {
-		key = tuple_extract_key(tuple, box_iterator_key_def(it),
+		key = tuple_extract_key(tuple, it->index->def->key_def,
 					&key_size);
 		if (space_ephemeral_delete(pCur->space, key) != 0) {
 			iterator_delete(it);
@@ -952,7 +952,7 @@ tarantoolSqlite3IdxKeyCompare(struct BtCursor *cursor,
 	uint32_t key_size;
 #endif
 
-	key_def = box_iterator_key_def(cursor->iter);
+	key_def = cursor->iter->index->def->key_def;
 	n = MIN(unpacked->nField, key_def->part_count);
 	tuple = cursor->last_tuple;
 	base = tuple_data(tuple);
-- 
2.16.2

             reply	other threads:[~2018-05-17 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17 13:41 Kirill Yukhin [this message]
2018-05-17 15:05 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-17 16:03   ` 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=98d8572affd09ca99e92f29e90165ca29f664847.1526564450.git.kyukhin@tarantool.org \
    --to=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def' \
    /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