Skip to content

Commit 2aab7f2

Browse files
committed
MDEV-26597 post-fix: cannot add new error messages in 10.4
followup for e8acec8
1 parent d0c4526 commit 2aab7f2

File tree

7 files changed

+15
-31
lines changed

7 files changed

+15
-31
lines changed

mysql-test/suite/galera/r/MDEV-26597.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB;
1111
ERROR HY000: Maximum writeset size exceeded
1212
SHOW WARNINGS;
1313
Level Code Message
14-
Error 4160 Maximum writeset size exceeded
14+
Error 1105 Maximum writeset size exceeded
1515
connection node_2;
1616
SET SESSION wsrep_sync_wait = 0;
1717
Killing server ...

mysql-test/suite/galera/t/MDEV-26597.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ CREATE TABLE t3 (c1 INTEGER NOT NULL PRIMARY KEY, c2 FLOAT(3,2));
1010
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
1111
SET @@autocommit=0;
1212
INSERT INTO t3 VALUES (1000,0.00),(1001,0.25),(1002,0.50),(1003,0.75),(1008,1.00),(1009,1.25),(1010,1.50),(1011,1.75);
13-
--error ER_TOO_BIG_WRITESET
13+
--error ER_UNKNOWN_ERROR
1414
CREATE TABLE t1 ( pk int primary key) ENGINE=INNODB;
1515
SHOW WARNINGS;
1616

mysql-test/suite/galera/t/galera_repl_max_ws_size.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CREATE TABLE t1 (f1 VARCHAR(512)) ENGINE=InnoDB;
1212

1313
SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=512';
1414

15-
--error ER_TOO_BIG_WRITESET
15+
--error ER_UNKNOWN_ERROR
1616
INSERT INTO t1 VALUES (REPEAT('a', 512));
1717

1818
SELECT COUNT(*) = 0 FROM t1;

mysql-test/suite/galera/t/galera_var_max_ws_size.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 VARCHAR(1024)) Engine
1212
--let $wsrep_max_ws_size_orig = `SELECT @@wsrep_max_ws_size`
1313
SET GLOBAL wsrep_max_ws_size = 1024;
1414

15-
--error ER_TOO_BIG_WRITESET
15+
--error ER_UNKNOWN_ERROR
1616
INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024));
1717
SELECT COUNT(*) = 0 FROM t1;
1818

sql/share/errmsg-utf8.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9090,5 +9090,3 @@ ER_PERIOD_CONSTRAINT_DROP
90909090
ER_TOO_LONG_KEYPART 42000 S1009
90919091
chi "指定的索引部分太长;最大索引部分长度为 %u 个字节"
90929092
eng "Specified key part was too long; max key part length is %u bytes"
9093-
ER_TOO_BIG_WRITESET
9094-
eng "Maximum writeset size exceeded"

sql/wsrep_mysqld.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
21542154
ret,
21552155
(thd->db.str ? thd->db.str : "(null)"),
21562156
wsrep_thd_query(thd));
2157-
my_error(ER_TOO_BIG_WRITESET, MYF(0));
2157+
my_error(ER_UNKNOWN_ERROR, MYF(0), "Maximum writeset size exceeded");
21582158
break;
21592159
case wsrep::e_deadlock_error:
21602160
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "

sql/wsrep_thd.h

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void wsrep_reset_threadvars(THD *);
182182
so don't override those by default
183183
*/
184184

185-
static inline void wsrep_override_error(THD *thd, uint error)
185+
static inline void wsrep_override_error(THD *thd, uint error, const char *format= 0, ...)
186186
{
187187
DBUG_ASSERT(error != ER_ERROR_DURING_COMMIT);
188188
Diagnostics_area *da= thd->get_stmt_da();
@@ -195,25 +195,11 @@ static inline void wsrep_override_error(THD *thd, uint error)
195195
da->sql_errno() != ER_LOCK_DEADLOCK))
196196
{
197197
da->reset_diagnostics_area();
198-
my_error(error, MYF(0));
199-
}
200-
}
201-
202-
/**
203-
Override error with additional wsrep status.
204-
*/
205-
static inline void wsrep_override_error(THD *thd, uint error,
206-
enum wsrep::provider::status status)
207-
{
208-
Diagnostics_area *da= thd->get_stmt_da();
209-
if (da->is_ok() ||
210-
!da->is_set() ||
211-
(da->is_error() &&
212-
da->sql_errno() != error &&
213-
da->sql_errno() != ER_LOCK_DEADLOCK))
214-
{
215-
da->reset_diagnostics_area();
216-
my_error(error, MYF(0), status);
198+
va_list args;
199+
va_start(args, format);
200+
if (!format) format= ER_THD(thd, error);
201+
my_printv_error(error, format, MYF(0), args);
202+
va_end(args);
217203
}
218204
}
219205

@@ -226,9 +212,9 @@ static inline void wsrep_override_error(THD* thd,
226212
{
227213
case wsrep::e_error_during_commit:
228214
if (status == wsrep::provider::error_size_exceeded)
229-
wsrep_override_error(thd, ER_TOO_BIG_WRITESET);
215+
wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded");
230216
else
231-
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
217+
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
232218
break;
233219
case wsrep::e_deadlock_error:
234220
wsrep_override_error(thd, ER_LOCK_DEADLOCK);
@@ -237,11 +223,11 @@ static inline void wsrep_override_error(THD* thd,
237223
wsrep_override_error(thd, ER_QUERY_INTERRUPTED);
238224
break;
239225
case wsrep::e_size_exceeded_error:
240-
wsrep_override_error(thd, ER_TOO_BIG_WRITESET);
226+
wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded");
241227
break;
242228
case wsrep::e_append_fragment_error:
243229
/* TODO: Figure out better error number */
244-
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, status);
230+
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
245231
break;
246232
case wsrep::e_not_supported_error:
247233
wsrep_override_error(thd, ER_NOT_SUPPORTED_YET);

0 commit comments

Comments
 (0)