From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 06AEB45C305 for ; Thu, 17 Dec 2020 02:10:15 +0300 (MSK) From: Leonid Vasiliev Date: Thu, 17 Dec 2020 02:09:07 +0300 Message-Id: <6cfd03daba88f817af007598141a84bace2d2a83.1608159414.git.lvasiliev@tarantool.org> In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH v3 2/2] sql: add panic() call in sql_execute() on complete failure List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org, imeevma@tarantool.org, korablev@tarantool.org, sergos@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