summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/share/errmsg-utf8.txt2
-rw-r--r--sql/wsrep_mysqld.cc4
-rw-r--r--sql/wsrep_thd.h10
-rw-r--r--sql/wsrep_trans_observer.h22
4 files changed, 26 insertions, 12 deletions
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index dde8337f01c..8d9bf5c6ebb 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -9090,3 +9090,5 @@ ER_PERIOD_CONSTRAINT_DROP
ER_TOO_LONG_KEYPART 42000 S1009
chi "指定的索引部分太长;最大索引部分长度为 %u 个字节"
eng "Specified key part was too long; max key part length is %u bytes"
+ER_TOO_BIG_WRITESET
+ eng "Maximum writeset size exceeded"
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index ccf191b2e21..d7cbc545161 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1,4 +1,4 @@
-/* Copyright 2008-2021 Codership Oy <http://www.codership.com>
+/* Copyright 2008-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
@@ -2153,7 +2153,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
ret,
(thd->db.str ? thd->db.str : "(null)"),
wsrep_thd_query(thd));
- my_error(ER_ERROR_DURING_COMMIT, MYF(0), WSREP_SIZE_EXCEEDED);
+ my_error(ER_TOO_BIG_WRITESET, MYF(0));
break;
case wsrep::e_deadlock_error:
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index 40e5ed98e9b..32663e9fc3b 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2013-2021 Codership Oy <info@codership.com>
+/* Copyright (C) 2013-2022 Codership Oy <info@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
@@ -210,7 +210,6 @@ static inline void wsrep_override_error(THD *thd, uint error,
!da->is_set() ||
(da->is_error() &&
da->sql_errno() != error &&
- da->sql_errno() != ER_ERROR_DURING_COMMIT &&
da->sql_errno() != ER_LOCK_DEADLOCK))
{
da->reset_diagnostics_area();
@@ -226,7 +225,10 @@ static inline void wsrep_override_error(THD* thd,
switch (ce)
{
case wsrep::e_error_during_commit:
- wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
+ if (status == wsrep::provider::error_size_exceeded)
+ wsrep_override_error(thd, ER_TOO_BIG_WRITESET);
+ else
+ wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
break;
case wsrep::e_deadlock_error:
wsrep_override_error(thd, ER_LOCK_DEADLOCK);
@@ -235,7 +237,7 @@ static inline void wsrep_override_error(THD* thd,
wsrep_override_error(thd, ER_QUERY_INTERRUPTED);
break;
case wsrep::e_size_exceeded_error:
- wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
+ wsrep_override_error(thd, ER_TOO_BIG_WRITESET);
break;
case wsrep::e_append_fragment_error:
/* TODO: Figure out better error number */
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) ||