Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Mergen Imeev <imeevma@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: specify field types in ephemeral space format
Date: Fri, 10 Apr 2020 21:16:28 +0200	[thread overview]
Message-ID: <f67a8d34-885f-8893-06c1-d835378694f1@tarantool.org> (raw)
In-Reply-To: <20200410000445.GA14187@tarantool.org>

Hi! Thanks for the fixes!

See 2 comments below.

> diff --git a/src/box/sql.c b/src/box/sql.c
> index 27089bd..288c4fa 100644
> --- a/src/box/sql.c
> +++ b/src/box/sql.c
> @@ -337,14 +337,15 @@ sql_ephemeral_space_create(uint32_t field_count, struct sql_key_info *key_info)
>  	 * length of each name is no more than strlen("_COLUMN_")
>  	 * + 5.
>  	 */
> -	assert(SQL_MAX_COLUMN < 9999);
> +	assert(SQL_MAX_COLUMN <= 2000);
>  	uint32_t name_len = sizeof("_COLUMN_") + 5;

1. sizeof("_COLUMN_") != strlen("_COLUMN_"). The latter is 8,
the former is 9. Better use strlen().

>  	uint32_t size = field_count * (sizeof(struct field_def) + name_len +
>  				       sizeof(struct key_part_def));
>  	struct field_def *fields = region_alloc(region, size);
> -	struct key_part_def *parts = (void *)fields +
> +	struct key_part_def *ephemer_key_parts = (void *)fields +
>  				     field_count * sizeof(struct field_def);
> -	char *names = (char *)parts + field_count * sizeof(struct key_part_def);
> +	char *names = (char *)ephemer_key_parts +
> +		      field_count * sizeof(struct key_part_def);
>  	for (uint32_t i = 0; i < field_count; ++i) {
>  		struct field_def *field = &fields[i];
>  		field->name = names;

2. It is worth extending the commit message with more details, how
is it needed for 4256 and 4692, with all what we discussed in private.

Please, do the things above and send to Nikita.

Also, in case it will be pushed in this form to master, I propose you to
create a ticket on ephemeral_space API rework. As you fairly noticed, we
have issues with using sql_key_info as, in fact, a format definition.
We basically *can't* index fields not added to the format.

  reply	other threads:[~2020-04-10 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-02 10:41 imeevma
2020-04-03 13:00 ` Nikita Pettik
2020-04-04 18:34 ` Vladislav Shpilevoy
2020-04-10  0:04   ` Mergen Imeev
2020-04-10 19:16     ` Vladislav Shpilevoy [this message]
2020-04-10 21:52       ` Mergen Imeev
2020-04-10 21:54 imeevma

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=f67a8d34-885f-8893-06c1-d835378694f1@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/1] sql: specify field types in ephemeral space format' \
    /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