From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@freelists.org, Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] Re: [PATCH v2 1/7] sql: refactor sql_alloc_src_list to set diag Date: Thu, 7 Mar 2019 20:34:18 +0300 [thread overview] Message-ID: <1aa67789-567f-4e38-0d7d-db45f302c6d4@tarantool.org> (raw) In-Reply-To: <9bc544e742ad88f4fd6a3738fb4993d789832bc6.1551265819.git.kshcherbatov@tarantool.org> Hi! Thanks for the patch! On 27/02/2019 14:13, Kirill Shcherbatov wrote: > Refactored sql_alloc_src_list routine to use diag_set in case of > memory allocation error. This will ensure that the > sqlSrcListAppend function throws an error using diag in > subsequent patches. The issue was about normalization error, but here I do not see a word about it. Only an obfuscated necessity to refactor sqlSrcListAppend. Why do you needed it? How it makes you closer to the name normalization? I spent significant time to recover the whole tree of functions, using name normalization, in order to learn what sqlSrcListAppend has to do with it. Please, write more accurate and elaborated comments to each commit in the patchset. Also, as I see, you decided to go from the bottom and firstly refactor some helper functions, after which you fixed the functions who use normalization. But the thing is that this commit and some of the others do not work because you set diag, but diag error never reaches a user. 1) In this commit you refactored sql_alloc_str_list, its usage in sqlSrcListAppend remained to be non-tarantool. It means, that if sql_alloc_str_list fails in sqlSrcListAppend and sets a diag, it is never thrown to a user. 2) About commit 'sql: rework sql_src_list_enlarge to set diag': if sql_src_list_enlarge fails in sqlSrcListAppend or in src_list_append_unique, the diag will never be thrown. 3) About commit 'sql: refactor sql_name_from_token to set diag': if sql_name_from_token fails in sql_id_list_append or sqlSrcListIndexedBy - the diag error is lost. I do not see a way how to gracefully split the patch into multiple preparation patches, and keep diag working, so I ask you to just write a comment in the commit messages, listed above, that they are not self-sufficient. > > Needed for #3931 > --- > src/box/sql/build.c | 30 +++++++++++++++++------------- > src/box/sql/sqlInt.h | 12 ++++++++++-- > 2 files changed, 27 insertions(+), 15 deletions(-) > > diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h > index dbfdbc6f5..ce29dc0b1 100644 > --- a/src/box/sql/sqlInt.h > +++ b/src/box/sql/sqlInt.h > @@ -3427,8 +3427,16 @@ void *sqlArrayAllocate(sql *, void *, int, int *, int *); > IdList *sqlIdListAppend(sql *, IdList *, Token *); > int sqlIdListIndex(IdList *, const char *); > SrcList *sqlSrcListEnlarge(sql *, SrcList *, int, int); > -SrcList * > -sql_alloc_src_list(sql *db); > + > +/** > + * Allocate a new empty SrcList object. > + * @param db The database connection. > + * @retval not NULL list pointer on success. > + * @retval NULL otherwise. As I've already said - please, use capital letters at the beginning of a sentence. Also, it is worth mentioning that it sets diag, and db->mallocFailed means nothing. The same about all other refactored functions in scope of this patchset. > + */ > +struct SrcList * > +sql_alloc_src_list(struct sql *db); > + > SrcList *sqlSrcListAppend(sql *, SrcList *, Token *); > SrcList *sqlSrcListAppendFromTerm(Parse *, SrcList *, Token *, > Token *, Select *, Expr *, IdList *); > -- > 2.20.1 > >
next prev parent reply other threads:[~2019-03-07 17:34 UTC|newest] Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-02-27 11:13 [tarantool-patches] [PATCH v2 0/7] sql: store regular identifiers in case-normal form Kirill Shcherbatov 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 1/7] sql: refactor sql_alloc_src_list to set diag Kirill Shcherbatov 2019-03-07 17:34 ` Vladislav Shpilevoy [this message] 2019-03-11 15:04 ` [tarantool-patches] " Kirill Shcherbatov 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 2/7] sql: rework sql_src_list_enlarge " Kirill Shcherbatov 2019-03-07 17:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-03-11 15:04 ` Kirill Shcherbatov 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 3/7] sql: refactor sql_src_list_append " Kirill Shcherbatov 2019-03-07 17:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-03-11 15:04 ` Kirill Shcherbatov 2019-03-18 19:33 ` Vladislav Shpilevoy 2019-03-20 11:02 ` Kirill Shcherbatov 2019-03-26 17:08 ` Vladislav Shpilevoy 2019-03-26 18:07 ` Vladislav Shpilevoy 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 4/7] sql: refactor sql_name_from_token " Kirill Shcherbatov 2019-03-07 17:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-03-11 15:04 ` Kirill Shcherbatov 2019-03-18 19:33 ` Vladislav Shpilevoy 2019-03-20 11:02 ` Kirill Shcherbatov 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 5/7] sql: refactor sql_trigger_step_allocate " Kirill Shcherbatov 2019-03-07 17:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-03-11 15:04 ` Kirill Shcherbatov 2019-03-18 19:33 ` Vladislav Shpilevoy 2019-03-20 11:02 ` Kirill Shcherbatov 2019-03-26 17:08 ` Vladislav Shpilevoy 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 6/7] sql: refactor sql_expr_create " Kirill Shcherbatov 2019-03-07 17:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-03-11 15:04 ` Kirill Shcherbatov 2019-03-18 19:33 ` Vladislav Shpilevoy 2019-03-20 11:02 ` Kirill Shcherbatov 2019-03-26 17:08 ` Vladislav Shpilevoy 2019-02-27 11:13 ` [tarantool-patches] [PATCH v2 7/7] sql: store regular identifiers in case-normal form Kirill Shcherbatov 2019-03-07 17:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-03-11 15:04 ` Kirill Shcherbatov 2019-03-18 19:33 ` Vladislav Shpilevoy 2019-03-20 11:02 ` Kirill Shcherbatov 2019-03-26 17:08 ` Vladislav Shpilevoy 2019-03-18 19:33 ` [tarantool-patches] Re: [PATCH v2 0/7] " Vladislav Shpilevoy 2019-03-20 11:02 ` Kirill Shcherbatov 2019-03-26 17:09 ` Vladislav Shpilevoy 2019-03-27 14:06 ` 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=1aa67789-567f-4e38-0d7d-db45f302c6d4@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=kshcherbatov@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='[tarantool-patches] Re: [PATCH v2 1/7] sql: refactor sql_alloc_src_list to set diag' \ /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