[tarantool-patches] Re: [PATCH v2 1/6] Add space address to index_replace

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Jul 17 13:18:57 MSK 2018


Hello! Thanks for the patch! See 3 comments below.

1. Please, on the commit title specify a subsystem name which
the patch affected. Here it is 'bos: ' I think.

On 17/07/2018 12:23, imeevma at tarantool.org wrote:
> On error in some cases index_replace
> looking for space using space_id that
> is saved in index. It is wrong as
> function that calls index_replace
> already have that space. Also in case
> of ephemeral spaces space_cache_find
> doesn't work right as all ephemeral
> space have id == 0.
> 
> Part of #3375.
> ---
> Branch: https://github.com/tarantool/tarantool/compare/imeevma/gh-3375-lua-expose-ephemeral-spaces
> Issue: https://github.com/tarantool/tarantool/issues/3375
> 
>   src/box/index.cc       | 16 +++++++++-------
>   src/box/index.h        | 30 +++++++++++++++++-------------
>   src/box/memtx_bitset.c |  7 ++++---
>   src/box/memtx_engine.c |  6 +++---
>   src/box/memtx_hash.c   | 12 +++++-------
>   src/box/memtx_rtree.c  |  7 ++++---
>   src/box/memtx_space.c  | 13 +++++++------
>   src/box/memtx_tree.c   | 16 ++++++++--------
>   8 files changed, 57 insertions(+), 50 deletions(-)
> 
> diff --git a/src/box/memtx_hash.c b/src/box/memtx_hash.c
> index eae07e8..76fe35f 100644
> --- a/src/box/memtx_hash.c
> +++ b/src/box/memtx_hash.c
> @@ -244,9 +244,9 @@ memtx_hash_index_get(struct index *base, const char *key,
>   }
>   
>   static int
> -memtx_hash_index_replace(struct index *base, struct tuple *old_tuple,
> -			 struct tuple *new_tuple, enum dup_replace_mode mode,
> -			 struct tuple **result)
> +memtx_hash_index_replace(struct index *base, struct space *space,
> +			 struct tuple *old_tuple, struct tuple *new_tuple,
> +			 enum dup_replace_mode mode, struct tuple **result)
>   {
>   	struct memtx_hash_index *index = (struct memtx_hash_index *)base;
>   	struct light_index_core *hash_table = &index->hash_table;
> @@ -281,10 +281,8 @@ memtx_hash_index_replace(struct index *base, struct tuple *old_tuple,
>   					      "recover of int hash_table");
>   				}
>   			}
> -			struct space *sp = space_cache_find(base->def->space_id);

2. Now you can remove schema.h dependency.

> -			if (sp != NULL)
> -				diag_set(ClientError, errcode, base->def->name,
> -					 space_name(sp));
> +			diag_set(ClientError, errcode, base->def->name,
> +				 space_name(space));
>   			return -1;
>   		}
>   
> diff --git a/src/box/memtx_tree.c b/src/box/memtx_tree.c
> index f851fb8..3da52b3 100644
> --- a/src/box/memtx_tree.c
> +++ b/src/box/memtx_tree.c

3. Same.




More information about the Tarantool-patches mailing list