Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH 2/4] Set is_temporary flag for formats of ephemeral spaces
Date: Wed, 23 Jan 2019 11:00:01 +0300	[thread overview]
Message-ID: <20190123080001.c7tlwx3npjea3nju@esperanza> (raw)
In-Reply-To: <648713a318a3ac1181db921b0894881e25cf810c.1548165435.git.kyukhin@tarantool.org>

On Tue, Jan 22, 2019 at 05:07:18PM +0300, Kirill Yukhin wrote:
> diff --git a/src/box/space_def.c b/src/box/space_def.c
> index 3516bdd..1d2bfcb 100644
> --- a/src/box/space_def.c
> +++ b/src/box/space_def.c
> @@ -257,6 +257,19 @@ space_def_new(uint32_t id, uint32_t uid, uint32_t exact_field_count,
>  	return def;
>  }
>  
> +struct space_def*
> +space_def_new_ephemeral(uint32_t field_count)
> +{
> +	struct space_def *space_def = space_def_new(0, 0 , field_count,
> +						    "ephemeral",
> +						    strlen("ephemeral"),
> +						    "memtx", strlen("memtx"),
> +						    &space_opts_default,
> +						    &field_def_default, 0);
> +	space_def->opts.is_temporary = true;

Nit: I'd rather you didn't override is_temporary of a newly created
space:

	struct space_opts opts = space_opts_default;
	opts.is_temporary = true;
	space_def_new(opts);

> +	return space_def;
> +}
> +
>  /** Free a default value's syntax trees of @a defs. */
>  void
>  space_def_destroy_fields(struct field_def *fields, uint32_t field_count,
> diff --git a/src/box/space_def.h b/src/box/space_def.h
> index 8044f88..e8d46c5 100644
> --- a/src/box/space_def.h
> +++ b/src/box/space_def.h
> @@ -169,6 +169,15 @@ space_def_new(uint32_t id, uint32_t uid, uint32_t exact_field_count,
>  	      const struct space_opts *opts, const struct field_def *fields,
>  	      uint32_t field_count);
>  
> +/**
> + * Create a new ephemeral space.

Nit: space definition, not space.

> + * @param field_count Number of fields in the space.
> + *
> + * @retval Space definition.
> + */
> +struct space_def *
> +space_def_new_ephemeral(uint32_t field_count);
> +
>  /**
>   * Size of the space_def.
>   * @param name_len Length of the space name.
> diff --git a/src/box/sql.c b/src/box/sql.c
> index 081a038..387da7b 100644
> --- a/src/box/sql.c
> +++ b/src/box/sql.c
> @@ -408,11 +408,7 @@ sql_ephemeral_space_create(uint32_t field_count, struct sql_key_info *key_info)
>  	rlist_add_entry(&key_list, ephemer_index_def, link);
>  
>  	struct space_def *ephemer_space_def =
> -		space_def_new(0 /* space id */, 0 /* user id */, field_count,
> -			      "ephemeral", strlen("ephemeral"),
> -			      "memtx", strlen("memtx"),
> -			      &space_opts_default, &field_def_default,
> -			      0 /* length of field_def */);
> +		space_def_new_ephemeral(field_count);
>  	if (ephemer_space_def == NULL) {
>  		index_def_delete(ephemer_index_def);
>  		return NULL;

This patch should also replace

	space->def->opts.is_temporary = true;

with the corresponding assertion in space_new_ephemeral().

  reply	other threads:[~2019-01-23  8:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 14:07 [PATCH 0/4] Reuse tuple formats for " Kirill Yukhin
2019-01-22 14:07 ` Kirill Yukhin
2019-01-22 14:07   ` [PATCH 1/4] Pass necessary fields to tuple_format contructor Kirill Yukhin
2019-01-23  7:53     ` Vladimir Davydov
2019-01-24  8:13       ` Kirill Yukhin
2019-01-22 14:07   ` [PATCH 2/4] Set is_temporary flag for formats of ephemeral spaces Kirill Yukhin
2019-01-23  8:00     ` Vladimir Davydov [this message]
2019-01-24  8:53       ` Kirill Yukhin
2019-01-22 14:07   ` [PATCH 3/4] sql: set error type in case of ephemral space creation failure Kirill Yukhin
2019-01-23  8:00     ` Vladimir Davydov
2019-01-22 14:07   ` [PATCH 4/4] Allow to reuse tuple_formats for ephemeral spaces Kirill Yukhin
2019-01-23  8:38     ` Vladimir Davydov
2019-01-24 12:39       ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190123080001.c7tlwx3npjea3nju@esperanza \
    --to=vdavydov.dev@gmail.com \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH 2/4] Set is_temporary flag for formats of ephemeral spaces' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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