From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 2E49822B9F for ; Sat, 29 Dec 2018 05:54:03 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9wCW8QbNxvQT for ; Sat, 29 Dec 2018 05:54:03 -0500 (EST) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E051F22835 for ; Sat, 29 Dec 2018 05:54:02 -0500 (EST) Subject: [tarantool-patches] Re: [PATCH v2 1/1] sql: do not analyze incorrect statistics References: <1b43714d03ae2a2f7042415aed3d60e1a41034f0.1545848549.git.imeevma@gmail.com> From: Vladislav Shpilevoy Message-ID: Date: Sat, 29 Dec 2018 13:53:59 +0300 MIME-Version: 1.0 In-Reply-To: <1b43714d03ae2a2f7042415aed3d60e1a41034f0.1545848549.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: imeevma@tarantool.org, tarantool-patches@freelists.org Cc: korablev@tarantool.org 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 >>> Date: Wed Dec 19 21:12:17 2018 +0300 >>> >> Now it looks pretty good. LGTM. >> > > commit 9a564cdf194685401f6b57d69408282d6326b856 > Author: Mergen Imeev > 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]));