[PATCH 1/4] Pass necessary fields to tuple_format contructor

Vladimir Davydov vdavydov.dev at gmail.com
Wed Jan 23 10:53:02 MSK 2019


On Tue, Jan 22, 2019 at 05:07:17PM +0300, Kirill Yukhin wrote:
> diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
> index e11b4e6..6edc0fb 100644
> --- a/src/box/tuple_format.c
> +++ b/src/box/tuple_format.c
> @@ -398,17 +398,20 @@ tuple_format_delete(struct tuple_format *format)
>  }
>  
>  struct tuple_format *
> -tuple_format_new(struct tuple_format_vtab *vtab, struct key_def * const *keys,
> -		 uint16_t key_count, const struct field_def *space_fields,
> -		 uint32_t space_field_count, struct tuple_dictionary *dict)
> +tuple_format_new(struct tuple_format_vtab *vtab, void *engine,
> +		 struct key_def * const *keys, uint16_t key_count,
> +		 const struct field_def *space_fields,
> +		 uint32_t space_field_count, struct tuple_dictionary *dict,
> +		 bool is_temporary, uint32_t exact_field_count)

Nit: I think we should rearrange the arguments a little:

  vtab, engine, keys, key_count,
  fields, field_count, exact_field_count,
  dict, is_temporary, is_ephemeral

> diff --git a/src/box/tuple_format.h b/src/box/tuple_format.h
> index 30b93b6..9778fda 100644
> --- a/src/box/tuple_format.h
> +++ b/src/box/tuple_format.h
> @@ -258,18 +258,23 @@ tuple_format_unref(struct tuple_format *format)
>  /**
>   * Allocate, construct and register a new in-memory tuple format.
>   * @param vtab Virtual function table for specific engines.
> + * @param engine Pointer to storage engine.
>   * @param keys Array of key_defs of a space.
>   * @param key_count The number of keys in @a keys array.
>   * @param space_fields Array of fields, defined in a space format.
>   * @param space_field_count Length of @a space_fields.
> + * @param is_temporary Set if format is temporary.

Nit: The format isn't temporary. The space that this format
is created for is.

> diff --git a/src/box/vinyl.c b/src/box/vinyl.c
> index d6117f4..abae076 100644
> --- a/src/box/vinyl.c
> +++ b/src/box/vinyl.c
> @@ -619,13 +619,14 @@ vinyl_engine_create_space(struct engine *engine, struct space_def *def,
>  		keys[key_count++] = index_def->key_def;
>  
>  	struct tuple_format *format =
> -		tuple_format_new(&vy_tuple_format_vtab, keys, key_count,
> -				 def->fields, def->field_count, def->dict);
> +		tuple_format_new(&vy_tuple_format_vtab, NULL, keys,
> +				 key_count,

Nit: This short line surrounded by long ones doesn't look good.

> +				 def->fields, def->field_count, def->dict,
> +				 false, def->exact_field_count);



More information about the Tarantool-patches mailing list