summaryrefslogtreecommitdiff
path: root/sql/wsrep_trans_observer.h
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2022-10-04 14:08:36 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2022-10-09 10:09:47 +0300
commite8acec89741777ebaf46b499fdfe191ad88c3a95 (patch)
tree39439ea1b3b29ed34e86d9c4f63ebdda047c7958 /sql/wsrep_trans_observer.h
parentab3ec013c41db1b9943c5e34d3d44a35fa7538fb (diff)
downloadmariadb-git-e8acec89741777ebaf46b499fdfe191ad88c3a95.tar.gz
MDEV-26597 : Assertion `!wsrep_has_changes(thd) || (thd->lex->sql_command == SQLCOM_CREATE_TABLE && !thd->is_current_stmt_binlog_format_row())' failed.
If repl.max_ws_size is set too low following CREATE TABLE could fail during commit. In this case wsrep_commit_empty should allow rolling it back if provider state is s_aborted. Furhermore, original ER_ERROR_DURING_COMMIT does not really tell anything clear for user. Therefore, this commit adds a new error ER_TOO_BIG_WRITESET. This will change some test cases output.
Diffstat (limited to 'sql/wsrep_trans_observer.h')
-rw-r--r--sql/wsrep_trans_observer.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index cde8163cf4f..f1d0eebf6dd 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -1,4 +1,4 @@
-/* Copyright 2016-2019 Codership Oy <http://www.codership.com>
+/* Copyright 2016-2022 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -531,18 +531,28 @@ wsrep_current_error_status(THD* thd)
static inline void wsrep_commit_empty(THD* thd, bool all)
{
DBUG_ENTER("wsrep_commit_empty");
- WSREP_DEBUG("wsrep_commit_empty(%llu)", thd->thread_id);
+ WSREP_DEBUG("wsrep_commit_empty for %llu client_state %s client_mode"
+ " %s trans_state %s sql %s",
+ thd_get_thread_id(thd),
+ wsrep::to_c_string(thd->wsrep_cs().state()),
+ wsrep::to_c_string(thd->wsrep_cs().mode()),
+ wsrep::to_c_string(thd->wsrep_cs().transaction().state()),
+ wsrep_thd_query(thd));
+
if (wsrep_is_real(thd, all) &&
wsrep_thd_is_local(thd) &&
thd->wsrep_trx().active() &&
thd->wsrep_trx().state() != wsrep::transaction::s_committed)
{
- /* @todo CTAS with STATEMENT binlog format and empty result set
- seems to be committing empty. Figure out why and try to fix
- elsewhere. */
+ /* Here transaction is either empty (i.e. no changes) or
+ it was CREATE TABLE with no row binlog format or
+ we have already aborted transaction e.g. because max writeset size
+ has been reached. */
DBUG_ASSERT(!wsrep_has_changes(thd) ||
(thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
- !thd->is_current_stmt_binlog_format_row()));
+ !thd->is_current_stmt_binlog_format_row()) ||
+ thd->wsrep_cs().transaction().state() == wsrep::transaction::s_aborted);
+
bool have_error= wsrep_current_error(thd);
int ret= wsrep_before_rollback(thd, all) ||
wsrep_after_rollback(thd, all) ||