From 8c389393695f052990610f8d4fe6935e5cb94c66 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 16 Sep 2022 11:20:41 +1000 Subject: MDEV-29540 Incorrect sequence values in INSERT SELECT The population of default values in INSERT SELECT was being performed twice. With sequences, this resulted in every second sequence value being used. With SELECT INSERT we remove the second invokation of table->update_default_fields(). This was already performed in store_values() invoking fill_record_n_invoke_before_triggers() which invoked update_default_fields() previously. We do need to return an error on duplicate values, so the ::store_values is extended to take the ignore option. --- sql/sql_class.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sql/sql_class.h') diff --git a/sql/sql_class.h b/sql/sql_class.h index 4d1f5b40db5..9ac973dc640 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5455,7 +5455,7 @@ class select_insert :public select_result_interceptor { int prepare(List &list, SELECT_LEX_UNIT *u); virtual int prepare2(JOIN *join); virtual int send_data(List &items); - virtual void store_values(List &values); + virtual bool store_values(List &values, bool ignore_errors); virtual bool can_rollback_data() { return 0; } bool prepare_eof(); bool send_ok_packet(); @@ -5497,7 +5497,7 @@ public: int prepare(List &list, SELECT_LEX_UNIT *u); int binlog_show_create_table(TABLE **tables, uint count); - void store_values(List &values); + bool store_values(List &values, bool ignore_errors); bool send_eof(); virtual void abort_result_set(); virtual bool can_rollback_data() { return 1; } -- cgit v1.2.1 From b7fe6179e82d89da55b48f6fb3061f5f4066535b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 25 Oct 2022 08:53:56 +0200 Subject: MDEV-29843 Do not use asynchronous log_write_upto() for system THDs Non-blocking log_write_upto (MDEV-24341) was only designed for the client connections. Fix, so it is not be triggered for any system THD. Previously, an incomplete solution only excluded Innodb purge THDs, but not the slave for example. The hang in MDEV still remains somewhat a mystery though, it is not immediately clear how exactly condition variable can become corrupted. But it is clear that it can be avoided. --- sql/sql_class.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'sql/sql_class.h') diff --git a/sql/sql_class.h b/sql/sql_class.h index 6c0a4b9f5ed..e07d91edf75 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2586,9 +2586,6 @@ struct thd_async_state } }; -extern "C" void thd_increment_pending_ops(MYSQL_THD); -extern "C" void thd_decrement_pending_ops(MYSQL_THD); - /** @class THD -- cgit v1.2.1