From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 7A21A24EB1 for ; Thu, 17 May 2018 09:41:57 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RQsaHfX9vACc for ; Thu, 17 May 2018 09:41:57 -0400 (EDT) Received: from smtp3.mail.ru (smtp3.mail.ru [94.100.179.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 3965124EAD for ; Thu, 17 May 2018 09:41:56 -0400 (EDT) From: Kirill Yukhin Subject: [tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def Date: Thu, 17 May 2018 16:41:49 +0300 Message-Id: <98d8572affd09ca99e92f29e90165ca29f664847.1526564450.git.kyukhin@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: v.shpilevoy@tarantool.org Cc: tarantool-patches@freelists.org, Kirill Yukhin 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