Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: imeevma@tarantool.org, tarantool-patches@freelists.org
Cc: korablev@tarantool.org
Subject: [tarantool-patches] Re: [PATCH v2 1/1] sql: do not analyze incorrect statistics
Date: Sat, 29 Dec 2018 13:53:59 +0300	[thread overview]
Message-ID: <adc7919a-779f-fae7-09a5-5bdff298c837@tarantool.org> (raw)
In-Reply-To: <1b43714d03ae2a2f7042415aed3d60e1a41034f0.1545848549.git.imeevma@gmail.com>

Hi! Thanks for the patch! See 1 comment below.

On 26/12/2018 22:01, imeevma@tarantool.org wrote:
> Vlad, please, do second review. I rebased it to newest 2.1.
> 
> https://github.com/tarantool/tarantool/issues/3866
> https://github.com/tarantool/tarantool/tree/imeevma/gh-3866-ignore-wrong-data-in-_sql_stat
> 
> 
> On 12/24/18 5:15 PM, n.pettik wrote:
>>
>>> New version:
>>>
>>> commit 1b43714d03ae2a2f7042415aed3d60e1a41034f0
>>> Author: Mergen Imeev <imeevma@gmail.com>
>>> Date:   Wed Dec 19 21:12:17 2018 +0300
>>>
>> Now it looks pretty good. LGTM.
>>
> 
> commit 9a564cdf194685401f6b57d69408282d6326b856
> Author: Mergen Imeev <imeevma@gmail.com>
> Date:   Wed Dec 19 21:12:17 2018 +0300
> 
>      sql: do not analyze incorrect statistics
>      
>      Some errors that occurred during the analysis were processed
>      without an error message. However, these errors should not be
>      processed, as they show that something is wrong with the data
>      received. After this patch, entries in _sql_stat* with the wrong
>      space or index name will be ignored.
>      
>      Closes #3866
> 
> diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c
> index 51c63fa..d1fa4ec 100644
> --- a/src/box/sql/analyze.c
> +++ b/src/box/sql/analyze.c

Analyze.c actively uses decode_stat_string() which assumes that
each stat record contains a valid list of white-space separated
unsigned integers. But what if I insert a non-integer? A char? A
negative integer? They are not ignored, but weirdly interpreted. I
think, such rows should not be accounted at all. Just like when a
space/index are not found.

The patch is OK except this thing.

> @@ -1224,10 +1224,10 @@ analysis_loader(void *data, int argc, char **argv, char **unused)
>   		return 0;
>   	struct analysis_index_info *info = (struct analysis_index_info *) data;
>   	assert(info->stats != NULL);
> -	struct index_stat *stat = &info->stats[info->index_count++];
> +	struct index_stat *stat = &info->stats[info->index_count];
>   	struct space *space = space_by_name(argv[0]);
>   	if (space == NULL)
> -		return -1;
> +		return 0;
>   	struct index *index;
>   	uint32_t iid = box_index_id_by_name(space->def->id, argv[1],
>   					    strlen(argv[1]));

  reply	other threads:[~2018-12-29 10:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-26 19:01 [tarantool-patches] " imeevma
2018-12-29 10:53 ` Vladislav Shpilevoy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-12-19 19:13 imeevma
2018-12-24 14:15 ` [tarantool-patches] " n.pettik

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=adc7919a-779f-fae7-09a5-5bdff298c837@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2 1/1] sql: do not analyze incorrect statistics' \
    /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