[PATCH v9 5/6] box: introduce offset_slot cache in key_part

Vladimir Davydov vdavydov.dev at gmail.com
Mon Feb 4 15:56:03 MSK 2019


On Sun, Feb 03, 2019 at 01:20:25PM +0300, Kirill Shcherbatov wrote:
> diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c
> index d9c408495..fc152cbbc 100644
> --- a/src/box/tuple_format.c
> +++ b/src/box/tuple_format.c
> @@ -41,6 +41,7 @@ struct tuple_format **tuple_formats;
>  static intptr_t recycled_format_ids = FORMAT_ID_NIL;
>  
>  static uint32_t formats_size = 0, formats_capacity = 0;
> +static uint64_t formats_epoch = 0;
>  
>  /**
>   * Find in format1::fields the field by format2_field's JSON path.
> @@ -623,6 +624,7 @@ tuple_format_alloc(struct key_def * const *keys, uint16_t key_count,
>  	format->index_field_count = index_field_count;
>  	format->exact_field_count = 0;
>  	format->min_field_count = 0;
> +	format->epoch = 0;
>  	return format;
>  error:
>  	tuple_format_destroy_fields(format);
> @@ -672,6 +674,7 @@ tuple_format_reuse(struct tuple_format **p_format)
>  		tuple_format_destroy(format);
>  		free(format);
>  		*p_format = *entry;
> +		(*p_format)->epoch = ++formats_epoch;

Why? Can I remove it?

>  		return true;
>  	}
>  	return false;
> @@ -740,6 +743,7 @@ tuple_format_new(struct tuple_format_vtab *vtab, void *engine,
>  		goto err;
>  	if (tuple_format_reuse(&format))
>  		return format;
> +	format->epoch = ++formats_epoch;

Can I move it above the call to tuple_format_create, where other
tuple_format fields are initialized?



More information about the Tarantool-patches mailing list