[Tarantool-patches] [PATCH v3 2/2] sql: add panic() call in sql_execute() on complete failure
Leonid Vasiliev
lvasiliev at tarantool.org
Thu Dec 17 02:09:07 MSK 2020
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
More information about the Tarantool-patches
mailing list