[tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def

Kirill Yukhin kyukhin at tarantool.org
Thu May 17 16:41:49 MSK 2018


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





More information about the Tarantool-patches mailing list