From: Leonid Vasiliev <lvasiliev@tarantool.org> To: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org, imeevma@tarantool.org, korablev@tarantool.org, sergos@tarantool.org Subject: [Tarantool-patches] [PATCH v3 2/2] sql: add panic() call in sql_execute() on complete failure Date: Thu, 17 Dec 2020 02:09:07 +0300 [thread overview] Message-ID: <6cfd03daba88f817af007598141a84bace2d2a83.1608159414.git.lvasiliev@tarantool.org> (raw) In-Reply-To: <cover.1608159414.git.lvasiliev@tarantool.org> In-Reply-To: <cover.1608159414.git.lvasiliev@tarantool.org> In SQL, on failure sometimes an error sets to the diag, sometimes not. And this can dived to situation as in #5537(SEGFAULT). So, let's call `panic()` in that case, because something is very wrong, and it is not safe to continue execution. Follow-up #5537 --- src/box/execute.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/box/execute.c b/src/box/execute.c index e14da20..a424349 100644 --- a/src/box/execute.c +++ b/src/box/execute.c @@ -687,8 +687,18 @@ sql_execute(struct sql_stmt *stmt, struct port *port, struct region *region) rc = sql_step(stmt); assert(rc != SQL_ROW && rc != 0); } - if (rc != SQL_DONE) + if (rc != SQL_DONE) { + /* + * In SQL, on failure sometimes an error sets to the diag, + * sometimes not. So, let's call `panic()` in that case, because + * something is very wrong, and it is not safe to continue + * execution. + */ + if (diag_is_empty(diag_get())) + panic("failed to execute SQL statement"); + return -1; + } return 0; } -- 2.7.4
next prev parent reply other threads:[~2020-12-16 23:10 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-16 23:09 [Tarantool-patches] [PATCH v3 0/2] Fix working with VDBE Leonid Vasiliev 2020-12-16 23:09 ` [Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c Leonid Vasiliev 2020-12-20 16:02 ` Vladislav Shpilevoy 2020-12-23 23:27 ` Leonid Vasiliev 2020-12-24 16:00 ` Vladislav Shpilevoy 2020-12-24 16:59 ` Nikita Pettik 2020-12-16 23:09 ` Leonid Vasiliev [this message] 2020-12-20 16:02 ` [Tarantool-patches] [PATCH v3 2/2] sql: add panic() call in sql_execute() on complete failure Vladislav Shpilevoy 2020-12-23 22:38 ` Leonid Vasiliev
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=6cfd03daba88f817af007598141a84bace2d2a83.1608159414.git.lvasiliev@tarantool.org \ --to=lvasiliev@tarantool.org \ --cc=imeevma@tarantool.org \ --cc=korablev@tarantool.org \ --cc=sergos@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v3 2/2] sql: add panic() call in sql_execute() on complete failure' \ /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