From: Mergen Imeev <imeevma@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Cc: tarantool-patches@freelists.org Subject: [tarantool-patches] Re: [PATCH v1 9/9] sql: set errors in VDBE using diag_set() Date: Mon, 3 Jun 2019 15:10:10 +0300 [thread overview] Message-ID: <20190603121010.GC24317@tarantool.org> (raw) In-Reply-To: <2fb295d4-473a-eb96-1f32-c12b2a0e96aa@tarantool.org> On Sun, Jun 02, 2019 at 06:34:12PM +0200, Vladislav Shpilevoy wrote: > > > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > > index 43d7329..5bf5e6e 100644 > > --- a/src/box/sql/vdbe.c > > +++ b/src/box/sql/vdbe.c > > @@ -3903,7 +3852,8 @@ case OP_SorterCompare: { > > pIn3 = &aMem[pOp->p3]; > > nKeyCol = pOp->p4.i; > > res = 0; > > - rc = sqlVdbeSorterCompare(pC, pIn3, nKeyCol, &res); > > + if (sqlVdbeSorterCompare(pC, pIn3, nKeyCol, &res) != 0) > > + rc = SQL_TARANTOOL_ERROR; > > In all the similar places you remove SQL_TARANTOOL_ERROR, > but here you added it. Why? > I thought the next command was doing something useful and should be executed in any case. Now I see that I was wrong. > > VdbeBranchTaken(res!=0,2); > > if (rc) goto abort_due_to_error; > > if (res) goto jump_to_p2; > > @@ -4137,15 +4085,18 @@ case OP_Rewind: { /* jump */ > > pC->seekOp = OP_Rewind; > > #endif > > if (isSorter(pC)) { > > - rc = sqlVdbeSorterRewind(pC, &res); > > + if (sqlVdbeSorterRewind(pC, &res) != SQL_OK) > > + goto abort_due_to_error; > > } else { > > assert(pC->eCurType==CURTYPE_TARANTOOL); > > pCrsr = pC->uc.pCursor; > > assert(pCrsr); > > - rc = tarantoolsqlFirst(pCrsr, &res); > > + if (tarantoolsqlFirst(pCrsr, &res) != SQL_OK) > > + rc = SQL_TARANTOOL_ERROR; > > The same. > As in the previous case, I thought that pC->cacheStatus should be set, but now I see that it is checked only in OP_Column, and in case of an error, it will not be checked at all. > Consider my review fixes on the branch and below. They are motivated > by several points: > > 1) in the original code there were places comparing 'rc' with 0, but > you replaced them with 'rc ==/!= SQL_OK'. I rolled back such changes, > because we move towards removal of SQL_OK. So when you need to choose > between 0 and SQL_OK - use 0. > > 2) there were places using SQL_OK, but very easy to fix and compare > with 0. I did it. > > 3) in a couple of places you kept 'rc = SQL_TARANTOOL_ERROR'. I don't > know why, but I dropped it, and the tests passed. If I was wrong, tell > me, please. > Thank you, I squashed your patch. Actually, all of SQL errcodes are removed in the follow-up patch-set.
next prev parent reply other threads:[~2019-06-03 12:10 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-28 11:39 [tarantool-patches] [PATCH v1 0/9] " imeevma 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 1/9] sql: remove mayAbort field from struct Parse imeevma 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 2/9] sql: remove error codes SQL_TARANTOOL_*_FAIL imeevma 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 3/9] sql: remove error ER_SQL imeevma 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 4/9] sql: rework diag_set() in OP_Halt imeevma 2019-06-02 16:35 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-03 8:41 ` Imeev Mergen 2019-06-04 19:34 ` Vladislav Shpilevoy 2019-06-08 12:11 ` Mergen Imeev 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 5/9] sql: make SQL_TARANTOOL_ERROR the only errcode of OP_Halt imeevma 2019-06-02 16:35 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-03 11:53 ` Mergen Imeev 2019-06-04 19:34 ` Vladislav Shpilevoy 2019-06-08 12:15 ` Mergen Imeev 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 6/9] sql: remove error SQL_INTERRUPT imeevma 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 7/9] sql: remove error SQL_MISMATCH imeevma 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 8/9] sql: use diag_set() to set an error in SQL functions imeevma 2019-06-02 16:35 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-03 11:54 ` Mergen Imeev 2019-05-28 11:39 ` [tarantool-patches] [PATCH v1 9/9] sql: set errors in VDBE using diag_set() imeevma 2019-06-02 16:34 ` [tarantool-patches] " Vladislav Shpilevoy 2019-06-03 12:10 ` Mergen Imeev [this message] 2019-06-03 12:20 ` Mergen Imeev 2019-06-09 17:14 ` [tarantool-patches] Re: [PATCH v1 0/9] " Vladislav Shpilevoy 2019-06-13 9:44 ` 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=20190603121010.GC24317@tarantool.org \ --to=imeevma@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=v.shpilevoy@tarantool.org \ --subject='[tarantool-patches] Re: [PATCH v1 9/9] sql: set errors in VDBE using diag_set()' \ /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