Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: korablev@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 1/1] temporary: locate missing diag
Date: Wed, 25 Nov 2020 13:14:15 +0300	[thread overview]
Message-ID: <f01d894f11f19cbceda4e3e22619e69621eb414d.1606299220.git.imeevma@gmail.com> (raw)

---
https://github.com/tarantool/tarantool/issues/5537
https://github.com/tarantool/tarantool/tree/imeevma/gh-5537-find-missing-diag

 src/box/errcode.h     | 1 +
 src/box/execute.c     | 9 ++++++++-
 test/box/error.result | 1 +
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/box/errcode.h b/src/box/errcode.h
index 938d41153..7d1703580 100644
--- a/src/box/errcode.h
+++ b/src/box/errcode.h
@@ -267,6 +267,7 @@ struct errcode_record {
 	/*212 */_(ER_SEQUENCE_NOT_STARTED,		"Sequence '%s' is not started") \
 	/*213 */_(ER_NO_SUCH_SESSION_SETTING,	"Session setting %s doesn't exist") \
 	/*214 */_(ER_TUPLE_METADATA_IS_TOO_BIG,	"Can't create tuple: metadata size %u is too big") \
+	/*215 */_(ER_DIAG_NOT_SET,		"Diag is not set: %s") \
 
 /*
  * !IMPORTANT! Please follow instructions at start of the file
diff --git a/src/box/execute.c b/src/box/execute.c
index 66eac9814..97fae1e42 100644
--- a/src/box/execute.c
+++ b/src/box/execute.c
@@ -724,6 +724,8 @@ sql_execute_prepared(uint32_t stmt_id, const struct sql_bind *bind,
 	if (sql_execute(stmt, port, region) != 0) {
 		port_destroy(port);
 		sql_stmt_reset(stmt);
+		if (diag_last_error(&fiber()->diag) == NULL)
+			diag_set(ClientError, ER_DIAG_NOT_SET, "VDBE");
 		return -1;
 	}
 	sql_stmt_reset(stmt);
@@ -737,8 +739,11 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind,
 			struct region *region)
 {
 	struct sql_stmt *stmt;
-	if (sql_stmt_compile(sql, len, NULL, &stmt, NULL) != 0)
+	if (sql_stmt_compile(sql, len, NULL, &stmt, NULL) != 0) {
+		if (diag_last_error(&fiber()->diag) == NULL)
+			diag_set(ClientError, ER_DIAG_NOT_SET, "Parser");
 		return -1;
+	}
 	assert(stmt != NULL);
 	enum sql_serialization_format format = sql_column_count(stmt) > 0 ?
 					   DQL_EXECUTE : DML_EXECUTE;
@@ -747,5 +752,7 @@ sql_prepare_and_execute(const char *sql, int len, const struct sql_bind *bind,
 	    sql_execute(stmt, port, region) == 0)
 		return 0;
 	port_destroy(port);
+	if (diag_last_error(&fiber()->diag) == NULL)
+		diag_set(ClientError, ER_DIAG_NOT_SET, "VDBE");
 	return -1;
 }
diff --git a/test/box/error.result b/test/box/error.result
index a16682438..d05e66776 100644
--- a/test/box/error.result
+++ b/test/box/error.result
@@ -433,6 +433,7 @@ t;
  |   212: box.error.SEQUENCE_NOT_STARTED
  |   213: box.error.NO_SUCH_SESSION_SETTING
  |   214: box.error.TUPLE_METADATA_IS_TOO_BIG
+ |   215: box.error.DIAG_NOT_SET
  | ...
 
 test_run:cmd("setopt delimiter ''");
-- 
2.25.1

                 reply	other threads:[~2020-11-25 10:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=f01d894f11f19cbceda4e3e22619e69621eb414d.1606299220.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/1] temporary: locate missing 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