diff options
author | Daniele Sciascia <daniele.sciascia@galeracluster.com> | 2021-09-07 15:04:39 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-09-14 11:38:03 +0300 |
commit | 5527fc58617d5e1f39e035ff7a10e6b7d739e742 (patch) | |
tree | 3ab9ab136287c2f8a3132b407c4a5885102bfc68 /sql/wsrep_schema.cc | |
parent | 74368a1df876f84a75a74d67989a02097f3d149b (diff) | |
download | mariadb-git-5527fc58617d5e1f39e035ff7a10e6b7d739e742.tar.gz |
MDEV-21613 Failed to open table mysql.wsrep_streaming_log for writingbb-10.4-MDEV-21613
Fix sporadic failure for MTR test galera_sr.GCF-1018B. The test
sometimes fails due to an error that is logged to the error log
unnecessarily.
A deterministic test case (included in this patch) shows that the
error is loggen when a transaction is BF aborted right before it
opens the streaming log table to perform fragment removal. When that
happens, the attempt to open the table fails and consequently an error
is logged. There is no need to log this error, as an ER_LOCK_DEADLOCK
error is returned to the client.
Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
Diffstat (limited to 'sql/wsrep_schema.cc')
-rw-r--r-- | sql/wsrep_schema.cc | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 5ee6468e9c1..06f0f7840ab 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -251,13 +251,7 @@ static int open_table(THD* thd, thd->lex->query_tables_own_last= 0; if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags)) { - if (thd->is_error()) { - WSREP_WARN("Can't lock table %s.%s : %d (%s)", - schema_name->str, table_name->str, - thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message()); - } close_thread_tables(thd); - my_error(ER_NO_SUCH_TABLE, MYF(0), schema_name->str, table_name->str); DBUG_RETURN(1); } @@ -273,8 +267,15 @@ static int open_for_write(THD* thd, const char* table_name, TABLE** table) { LEX_CSTRING table_str= { table_name, strlen(table_name) }; if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_WRITE, table)) { - WSREP_ERROR("Failed to open table %s.%s for writing", - schema_str.str, table_name); + // No need to log an error if the query was bf aborted, + // thd client will get ER_LOCK_DEADLOCK in the end. + const bool interrupted= thd->killed || + (thd->is_error() && + (thd->get_stmt_da()->sql_errno() == ER_QUERY_INTERRUPTED)); + if (!interrupted) { + WSREP_ERROR("Failed to open table %s.%s for writing", + schema_str.str, table_name); + } return 1; } empty_record(*table); |