Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def
@ 2018-05-17 13:41 Kirill Yukhin
  2018-05-17 15:05 ` [tarantool-patches] " Vladislav Shpilevoy
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill Yukhin @ 2018-05-17 13:41 UTC (permalink / raw)
  To: v.shpilevoy; +Cc: tarantool-patches, 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

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

* [tarantool-patches] Re: [PATCH] sql: remove temporary box_iterator_key_def
  2018-05-17 13:41 [tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def Kirill Yukhin
@ 2018-05-17 15:05 ` Vladislav Shpilevoy
  2018-05-17 16:03   ` Kirill Yukhin
  0 siblings, 1 reply; 3+ messages in thread
From: Vladislav Shpilevoy @ 2018-05-17 15:05 UTC (permalink / raw)
  To: tarantool-patches, Kirill Yukhin

Hello. Thanks for the patch!

On 17/05/2018 16:41, Kirill Yukhin wrote:
> 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
> ---

1. Please, post branch and issue links here.

2. I can not find any branch with 2425 in name.

The patch LGTM.

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

* [tarantool-patches] Re: [PATCH] sql: remove temporary box_iterator_key_def
  2018-05-17 15:05 ` [tarantool-patches] " Vladislav Shpilevoy
@ 2018-05-17 16:03   ` Kirill Yukhin
  0 siblings, 0 replies; 3+ messages in thread
From: Kirill Yukhin @ 2018-05-17 16:03 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

Hello Vlad,
On 17 мая 18:05, Vladislav Shpilevoy wrote:
> Hello. Thanks for the patch!
> 
> On 17/05/2018 16:41, Kirill Yukhin wrote:
> > 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
> > ---
> 
> 1. Please, post branch and issue links here.
Branch: https://github.com/tarantool/tarantool/tree/kyukhin/gh-2425-remove-box_iterator_key_def
Issue: https://github.com/tarantool/tarantool/issues/2425
 
> 2. I can not find any branch with 2425 in name.
I forgot to push it to GH. Done.

> The patch LGTM.
I'll commit it to 2.0 branch, thanks!

--
Regards, Kirill Yukhin

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

end of thread, other threads:[~2018-05-17 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17 13:41 [tarantool-patches] [PATCH] sql: remove temporary box_iterator_key_def Kirill Yukhin
2018-05-17 15:05 ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-17 16:03   ` Kirill Yukhin

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