From bfa6db38cdbfcae5f7b59b3d7455407636d2740a Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Nov 2019 09:31:47 +0400 Subject: [PATCH] MENT-510 Failing test(s): perfschema.threads_insert_delayed. The thread_id of the INSERT DELAYED thread should not be set to 0. --- mysql-test/suite/plugins/r/server_audit.result | 2 +- mysql-test/suite/plugins/t/server_audit.test | 2 +- sql/sql_insert.cc | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 0d6d87c3b28..fcfa5dd2582 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -221,7 +221,7 @@ connection cn1; create table t1(id int) engine=myisam; insert delayed into t1 values (1), (2); connection default; -# Waiting until ALTER TABLE is blocked. +# Waiting until INSERT DELAYED thread does the insert. drop table t1; disconnect cn1; drop user user1@localhost; diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 1f4d336a01f..abba7d2b74f 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -148,7 +148,7 @@ connection cn1; create table t1(id int) engine=myisam; insert delayed into t1 values (1), (2); connection default; ---echo # Waiting until ALTER TABLE is blocked. +--echo # Waiting until INSERT DELAYED thread does the insert. let $wait_condition= SELECT COUNT(*) = 2 FROM t1; --source include/wait_condition.inc drop table t1; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9dca28ce48f..ec0ab9cb174 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2076,13 +2076,14 @@ public: passed from connection thread to the handler thread. */ MDL_request grl_protection; + my_thread_id orig_thread_id; void set_default_user() { thd.security_ctx->user=(char*) delayed_user; thd.security_ctx->host=(char*) my_localhost; thd.security_ctx->ip= NULL; thd.query_id= 0; - thd.thread_id= 0; + thd.thread_id= orig_thread_id; } void set_user_from_row(const delayed_row *r)