diff options
author | Monty <monty@mariadb.org> | 2018-01-04 16:21:18 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-01-04 16:24:09 +0200 |
commit | 5e0b13d1734942d860416ed1b51f7dd75760e020 (patch) | |
tree | c4af4ad467c87748e7aaba032902ef7d4f49eb9c | |
parent | c584a496d7000def48b8aad1f065c07f147998a3 (diff) | |
download | mariadb-git-5e0b13d1734942d860416ed1b51f7dd75760e020.tar.gz |
Fixed wrong arguments to printf and related functions
Other things, mainly to get
create_mysqld_error_find_printf_error tool to work:
- Added protection to not include mysqld_error.h twice
- Include "unireg.h" instead of "mysqld_error.h" in server
- Added protection if ER_XX messages are already defined
- Removed wrong calls to my_error(ER_OUTOFMEMORY) as
my_malloc() and my_alloc will do this automatically
- Added missing %s to ER_DUP_QUERY_NAME
- Removed old and wrong calls to my_strerror() when using
MY_ERROR_ON_RENAME (wrong merge)
- Fixed deadlock error message from Galera. Before the extra
information given to ER_LOCK_DEADLOCK was missing because
ER_LOCK_DEADLOCK doesn't provide any extra information.
I kept #ifdef mysqld_error_find_printf_error_used in sql_acl.h
to make it easy to do this kind of check again in the future
47 files changed, 91 insertions, 101 deletions
diff --git a/extra/comp_err.c b/extra/comp_err.c index cf6262f66e2..5e3cec676bc 100644 --- a/extra/comp_err.c +++ b/extra/comp_err.c @@ -267,6 +267,7 @@ static int create_header_files(struct errors *error_head) fprintf(sql_statef, "/* Autogenerated file, please don't edit */\n\n"); fprintf(er_namef, "/* Autogenerated file, please don't edit */\n\n"); + fprintf(er_definef, "#ifndef ER_ERROR_FIRST\n"); fprintf(er_definef, "#define ER_ERROR_FIRST %d\n", error_head->d_code); current_d_code= error_head->d_code -1; @@ -314,6 +315,7 @@ static int create_header_files(struct errors *error_head) } /* finishing off with mysqld_error.h */ fprintf(er_definef, "#define ER_ERROR_LAST %d\n", er_last); + fprintf(er_definef, "#endif /* ER_ERROR_FIRST */\n"); my_fclose(er_definef, MYF(0)); my_fclose(sql_statef, MYF(0)); my_fclose(er_namef, MYF(0)); diff --git a/include/my_time.h b/include/my_time.h index 90d19c8861a..02e8f32ee23 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -173,8 +173,10 @@ static inline my_bool validate_timestamp_range(const MYSQL_TIME *t) } /* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */ +#ifndef ER_WARN_DATA_OUT_OF_RANGE #define ER_WARN_DATA_OUT_OF_RANGE 1264 #define ER_WARN_INVALID_TIMESTAMP 1299 +#endif my_time_t my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code); diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index 5164c74a0bc..b1b41b1c5e7 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -705,7 +705,7 @@ ERROR 42S21: Duplicate column name 'f1' with t as (select * from t2 where c>3), t as (select a from t1 where a>2) select * from t,t1 where t1.a=t.c; -ERROR HY000: Duplicate query name in WITH clause +ERROR HY000: Duplicate query name in WITH clause 't' with t as (select a from s where a<5), s as (select a from t1 where b>='d') select * from t,s where t.a=s.a; diff --git a/mysql-test/suite/galera/r/galera_bf_abort.result b/mysql-test/suite/galera/r/galera_bf_abort.result index 2307c35361c..c2e89965fce 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort.result +++ b/mysql-test/suite/galera/r/galera_bf_abort.result @@ -9,7 +9,7 @@ INSERT INTO t1 VALUES (1,'node_1'); connection node_2a; connection node_2; INSERT INTO t1 VALUES (2, 'node_2'); -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction wsrep_local_aborts_increment 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result index ce3ac6ab2cb..8c6c7b7d7a4 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_get_lock.result @@ -10,7 +10,7 @@ SELECT GET_LOCK("foo", 1000);; connection node_1; INSERT INTO t1 VALUES (1); connection node_2; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction wsrep_local_aborts_increment 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result index f069198dff6..9cd6abad5a1 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_sleep.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_sleep.result @@ -6,7 +6,7 @@ SELECT SLEEP(1000);; connection node_1; INSERT INTO t1 VALUES (1); connection node_2; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction wsrep_local_aborts_increment 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_enum.result b/mysql-test/suite/galera/r/galera_enum.result index 1bac7dc9388..dcf31aa5948 100644 --- a/mysql-test/suite/galera/r/galera_enum.result +++ b/mysql-test/suite/galera/r/galera_enum.result @@ -38,7 +38,7 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction connection node_1; SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 'three'; COUNT(*) = 1 diff --git a/mysql-test/suite/galera/r/galera_fk_conflict.result b/mysql-test/suite/galera/r/galera_fk_conflict.result index d9919c0348b..a08aa30a82e 100644 --- a/mysql-test/suite/galera/r/galera_fk_conflict.result +++ b/mysql-test/suite/galera/r/galera_fk_conflict.result @@ -22,6 +22,6 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE child; DROP TABLE parent; diff --git a/mysql-test/suite/galera/r/galera_insert_multi.result b/mysql-test/suite/galera/r/galera_insert_multi.result index 38bb5c26d20..913dd42403a 100644 --- a/mysql-test/suite/galera/r/galera_insert_multi.result +++ b/mysql-test/suite/galera/r/galera_insert_multi.result @@ -51,7 +51,7 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction ROLLBACK; INSERT INTO t1 VALUES (1), (2); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' diff --git a/mysql-test/suite/galera/r/galera_many_indexes.result b/mysql-test/suite/galera/r/galera_many_indexes.result index 59d0194687f..5691eef4c00 100644 --- a/mysql-test/suite/galera/r/galera_many_indexes.result +++ b/mysql-test/suite/galera/r/galera_many_indexes.result @@ -129,5 +129,5 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_mdl_race.result b/mysql-test/suite/galera/r/galera_mdl_race.result index 0c83ead931e..048b2c46a67 100644 --- a/mysql-test/suite/galera/r/galera_mdl_race.result +++ b/mysql-test/suite/galera/r/galera_mdl_race.result @@ -28,7 +28,7 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_before_mdl_wait"; SET DEBUG_SYNC = "now SIGNAL signal.wsrep_after_BF_victim_lock"; UNLOCK TABLES; connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a'; COUNT(*) = 1 1 diff --git a/mysql-test/suite/galera/r/galera_nopk_bit.result b/mysql-test/suite/galera/r/galera_nopk_bit.result index 7662c15c672..21da039df09 100644 --- a/mysql-test/suite/galera/r/galera_nopk_bit.result +++ b/mysql-test/suite/galera/r/galera_nopk_bit.result @@ -28,6 +28,6 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_nopk_blob.result b/mysql-test/suite/galera/r/galera_nopk_blob.result index a7570c2cfee..53e04f72d1e 100644 --- a/mysql-test/suite/galera/r/galera_nopk_blob.result +++ b/mysql-test/suite/galera/r/galera_nopk_blob.result @@ -28,6 +28,6 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_nopk_large_varchar.result b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result index 08cffaa2bd1..a83cf7f2d91 100644 --- a/mysql-test/suite/galera/r/galera_nopk_large_varchar.result +++ b/mysql-test/suite/galera/r/galera_nopk_large_varchar.result @@ -31,6 +31,6 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_nopk_unicode.result b/mysql-test/suite/galera/r/galera_nopk_unicode.result index 882a91a29b5..b2a8bb63df9 100644 --- a/mysql-test/suite/galera/r/galera_nopk_unicode.result +++ b/mysql-test/suite/galera/r/galera_nopk_unicode.result @@ -19,7 +19,7 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction SELECT f1 = 'текст2' FROM t1; f1 = 'текст2' 1 diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result index 27bb3c50733..807ab62c548 100644 --- a/mysql-test/suite/galera/r/galera_pk_bigint_signed.result +++ b/mysql-test/suite/galera/r/galera_pk_bigint_signed.result @@ -27,6 +27,6 @@ COMMIT; SET AUTOCOMMIT=ON; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction SET AUTOCOMMIT=ON; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result index f586fe2f589..c94b7e2314a 100644 --- a/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result +++ b/mysql-test/suite/galera/r/galera_pk_bigint_unsigned.result @@ -24,6 +24,6 @@ COMMIT; SET AUTOCOMMIT=ON; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction SET AUTOCOMMIT=ON; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_serializable.result b/mysql-test/suite/galera/r/galera_serializable.result index e81c3911b7d..be3f93a081f 100644 --- a/mysql-test/suite/galera/r/galera_serializable.result +++ b/mysql-test/suite/galera/r/galera_serializable.result @@ -9,7 +9,7 @@ connection node_2; INSERT INTO t1 VALUES (1,1); connection node_1; SELECT * FROM t1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction ROLLBACK; DELETE FROM t1; connection node_1; @@ -22,7 +22,7 @@ connection node_2; UPDATE t1 SET f2 = 2; connection node_1; UPDATE t1 SET f2 = 3; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction ROLLBACK; DELETE FROM t1; connection node_1; @@ -33,5 +33,5 @@ connection node_2; INSERT INTO t1 VALUES (1,2); connection node_1; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result index 1f9b67eeff3..7c669e5516a 100644 --- a/mysql-test/suite/galera/r/galera_split_brain.result +++ b/mysql-test/suite/galera/r/galera_split_brain.result @@ -6,7 +6,7 @@ connection node_2; Killing server ... connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: WSREP replication failed. Check your wsrep connection state and retry the query. connection node_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; disconnect node_2; diff --git a/mysql-test/suite/galera/r/galera_toi_drop_database.result b/mysql-test/suite/galera/r/galera_toi_drop_database.result index c36d4d3eedd..6d88c8ea230 100644 --- a/mysql-test/suite/galera/r/galera_toi_drop_database.result +++ b/mysql-test/suite/galera/r/galera_toi_drop_database.result @@ -14,9 +14,9 @@ INSERT INTO t2 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, te connection node_2; DROP DATABASE database1;; connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction connection node_1a; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction connection node_2; connection node_1; SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1'; diff --git a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result index c13b689f82b..f5cc14ed0f1 100644 --- a/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result +++ b/mysql-test/suite/galera/r/galera_toi_lock_exclusive.result @@ -8,7 +8,7 @@ connection node_2a; ALTER TABLE t1 ADD COLUMN f2 INTEGER, LOCK=EXCLUSIVE; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction connection node_1; INSERT INTO t1 VALUES (2, 2); SELECT COUNT(*) = 2 FROM t1; diff --git a/mysql-test/suite/galera/r/galera_toi_truncate.result b/mysql-test/suite/galera/r/galera_toi_truncate.result index aa407ba7610..933379cade5 100644 --- a/mysql-test/suite/galera/r/galera_toi_truncate.result +++ b/mysql-test/suite/galera/r/galera_toi_truncate.result @@ -9,7 +9,7 @@ connection node_1; TRUNCATE TABLE t1;; connection node_1; connection node_2; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction connection node_2; SELECT COUNT(*) = 0 FROM t1; COUNT(*) = 0 diff --git a/mysql-test/suite/galera/r/galera_unicode_pk.result b/mysql-test/suite/galera/r/galera_unicode_pk.result index 2711e44b7cb..0e8965a76e3 100644 --- a/mysql-test/suite/galera/r/galera_unicode_pk.result +++ b/mysql-test/suite/galera/r/galera_unicode_pk.result @@ -18,7 +18,7 @@ connection node_1; COMMIT; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction SELECT f1 = 'текст2' FROM t1; f1 = 'текст2' 1 @@ -35,6 +35,6 @@ connection node_2; COMMIT; connection node_1; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction COMMIT; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result index 15bbe7c508a..ba117b4c2d5 100644 --- a/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result +++ b/mysql-test/suite/galera/r/galera_var_auto_inc_control_off.result @@ -59,7 +59,7 @@ connection node_1a; COMMIT; connection node_2a; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction connection node_1a; SELECT * FROM t1; f1 node diff --git a/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result index 18a857d4471..fa49d8c57c2 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result +++ b/mysql-test/suite/galera/r/galera_wsrep_log_conficts.result @@ -20,6 +20,6 @@ connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connection node_2a; connection node_2; COMMIT; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +ERROR 40001: Deadlock: wsrep aborted transaction include/assert_grep.inc [cluster conflict due to high priority abort for threads] DROP TABLE t1; diff --git a/sql/field.cc b/sql/field.cc index b4353e33df6..61045cdacc0 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9948,7 +9948,7 @@ bool Column_definition::check(THD *thd) if (decimals >= NOT_FIXED_DEC) { my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals), - field_name, static_cast<ulong>(NOT_FIXED_DEC - 1)); + field_name, static_cast<uint>(NOT_FIXED_DEC - 1)); DBUG_RETURN(TRUE); } my_decimal_trim(&length, &decimals); @@ -10006,7 +10006,7 @@ bool Column_definition::check(THD *thd) if (decimals != NOT_FIXED_DEC && decimals >= FLOATING_POINT_DECIMALS) { my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals), - field_name, static_cast<ulong>(FLOATING_POINT_DECIMALS-1)); + field_name, static_cast<uint>(FLOATING_POINT_DECIMALS-1)); DBUG_RETURN(TRUE); } break; @@ -10026,7 +10026,7 @@ bool Column_definition::check(THD *thd) if (decimals != NOT_FIXED_DEC && decimals >= FLOATING_POINT_DECIMALS) { my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals), - field_name, static_cast<ulong>(FLOATING_POINT_DECIMALS-1)); + field_name, static_cast<uint>(FLOATING_POINT_DECIMALS-1)); DBUG_RETURN(TRUE); } break; diff --git a/sql/log_event.cc b/sql/log_event.cc index 2a9e6493c5e..bd6d325b3ef 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -18,7 +18,6 @@ #include <my_global.h> #include "sql_priv.h" -#include "mysqld_error.h" #ifndef MYSQL_CLIENT #include "unireg.h" @@ -44,6 +43,8 @@ #include <strfunc.h> #include "compat56.h" #include "wsrep_mysqld.h" +#else +#include "mysqld_error.h" #endif /* MYSQL_CLIENT */ #include <my_bitmap.h> @@ -1914,9 +1915,9 @@ err: #endif if (event.length() >= OLD_HEADER_LEN) sql_print_error("Error in Log_event::read_log_event(): '%s'," - " data_len: %lu, event_type: %d", error, - uint4korr(&event[EVENT_LEN_OFFSET]), - (uchar)event[EVENT_TYPE_OFFSET]); + " data_len: %lu, event_type: %u", error, + (ulong) uint4korr(&event[EVENT_LEN_OFFSET]), + (uint) (uchar)event[EVENT_TYPE_OFFSET]); else sql_print_error("Error in Log_event::read_log_event(): '%s'", error); /* diff --git a/sql/mdl.cc b/sql/mdl.cc index 25809c3d9cc..f5c5d06328d 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -19,7 +19,7 @@ #include "sql_array.h" #include "rpl_rli.h" #include <lf.h> -#include <mysqld_error.h> +#include "unireg.h" #include <mysql/plugin.h> #include <mysql/service_thd_wait.h> #include <mysql/psi/mysql_stage.h> diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 560e24e33c5..cc5746925a2 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -10241,8 +10241,8 @@ void SEL_ARG::test_use_count(SEL_ARG *root) ulong count=count_key_part_usage(root,pos->next_key_part); if (count > pos->next_key_part->use_count) { - sql_print_information("Use_count: Wrong count for key at %p, %lu " - "should be %lu", (long unsigned int)pos, + sql_print_information("Use_count: Wrong count for key at %p: %lu " + "should be %lu", pos, pos->next_key_part->use_count, count); return; } @@ -10251,7 +10251,7 @@ void SEL_ARG::test_use_count(SEL_ARG *root) } if (e_count != elements) sql_print_warning("Wrong use count: %u (should be %u) for tree at %p", - e_count, elements, (long unsigned int) this); + e_count, elements, this); } #endif diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index b24bcaf0879..2a0ac9a465f 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -1927,10 +1927,7 @@ slave_connection_state::load(char *slave_request, size_t len) for (;;) { if (!(rec= (uchar *)my_malloc(sizeof(entry), MYF(MY_WME)))) - { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*gtid)); return 1; - } gtid= &((entry *)rec)->gtid; if (gtid_parser_helper(&p, end, gtid)) { @@ -2547,10 +2544,7 @@ gtid_waiting::get_entry(uint32 domain_id) return e; if (!(e= (hash_element *)my_malloc(sizeof(*e), MYF(MY_WME)))) - { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*e)); return NULL; - } if (init_queue(&e->queue, 8, offsetof(queue_element, wait_seq_no), 0, cmp_queue_elem, NULL, 1+offsetof(queue_element, queue_idx), 1)) diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index dfb3bf970d5..ade9d53cdb7 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7570,7 +7570,7 @@ ER_WITH_COL_WRONG_LIST ER_TOO_MANY_DEFINITIONS_IN_WITH_CLAUSE eng "Too many WITH elements in WITH clause" ER_DUP_QUERY_NAME - eng "Duplicate query name in WITH clause" + eng "Duplicate query name in WITH clause '%s'" ER_RECURSIVE_WITHOUT_ANCHORS eng "No anchors for recursive WITH element '%s'" ER_UNACCEPTABLE_MUTUAL_RECURSION diff --git a/sql/slave.cc b/sql/slave.cc index 19905841a2c..9c6e8ebc200 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -41,7 +41,7 @@ #include <sql_common.h> #include <errmsg.h> #include <ssl_compat.h> -#include <mysqld_error.h> +#include "unireg.h" #include <mysys_err.h> #include "rpl_handler.h" #include <signal.h> diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 34c28e95e89..1a2c7fc302f 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1651,7 +1651,7 @@ static bool fix_lex_user(THD *thd, LEX_USER *user) if (user->pwhash.length && user->pwhash.length != check_length) { - my_error(ER_PASSWD_LENGTH, MYF(0), check_length); + my_error(ER_PASSWD_LENGTH, MYF(0), (int) check_length); return true; } @@ -2610,7 +2610,7 @@ static int check_user_can_set_role(const char *user, const char *host, acl_user= find_user_wild(host, user, ip); if (acl_user == NULL) { - my_error(ER_INVALID_CURRENT_USER, MYF(0), rolename); + my_error(ER_INVALID_CURRENT_USER, MYF(0)); result= -1; } else if (access) @@ -8557,10 +8557,7 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user) strxmov(buff, "CREATE USER for ", username, "@", hostname, NullS); Item_string *field = new (thd->mem_root) Item_string_ascii(thd, "", 0); if (!field) - { - my_error(ER_OUTOFMEMORY, MYF(0)); - DBUG_RETURN(true); - } + DBUG_RETURN(true); // Error given my my_alloc() field->name= buff; field->max_length= sizeof(buff); diff --git a/sql/sql_acl.h b/sql/sql_acl.h index 8d233fd3d0a..aeda2696894 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -190,8 +190,12 @@ extern LEX_STRING current_user_and_current_role; static inline int access_denied_error_code(int passwd_used) { +#ifdef mysqld_error_find_printf_error_used + return 0; +#else return passwd_used == 2 ? ER_ACCESS_DENIED_NO_PASSWORD_ERROR : ER_ACCESS_DENIED_ERROR; +#endif } diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index ea4a3b47e5b..b4131614adb 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1089,7 +1089,7 @@ bool login_connection(THD *thd) /* Updates global user connection stats. */ if (increment_connection_count(thd, TRUE)) { - my_error(ER_OUTOFMEMORY, MYF(0), 2*sizeof(USER_STATS)); + my_error(ER_OUTOFMEMORY, MYF(0), (int) (2*sizeof(USER_STATS))); error= 1; goto exit; } diff --git a/sql/sql_digest.cc b/sql/sql_digest.cc index 6605d0af0a9..b7ee3c4ffea 100644 --- a/sql/sql_digest.cc +++ b/sql/sql_digest.cc @@ -20,7 +20,7 @@ #include "my_global.h" #include "my_md5.h" -#include "mysqld_error.h" +#include "unireg.h" #include "sql_string.h" #include "sql_class.h" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 391972ea89a..f00c74b155c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1562,7 +1562,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (thd->wsrep_conflict_state == ABORTED && command != COM_STMT_CLOSE && command != COM_QUIT) { - my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); + my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction", + MYF(0)); WSREP_DEBUG("Deadlock error for: %s", thd->query()); mysql_mutex_unlock(&thd->LOCK_wsrep_thd); thd->reset_killed(); @@ -2285,7 +2286,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (server_command_flags[subcommand] & CF_NO_COM_MULTI) { - my_error(ER_BAD_COMMAND_IN_MULTI, MYF(0), command_name[subcommand]); + my_error(ER_BAD_COMMAND_IN_MULTI, MYF(0), + command_name[subcommand].str); goto com_multi_end; } @@ -7760,7 +7762,8 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, (longlong) thd->thread_id, is_autocommit, thd->wsrep_retry_counter, thd->variables.wsrep_retry_autocommit, thd->query()); - my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); + my_message(ER_LOCK_DEADLOCK, "Deadlock: wsrep aborted transaction", + MYF(0)); thd->reset_killed(); thd->wsrep_conflict_state= NO_CONFLICT; if (thd->wsrep_conflict_state != REPLAYING) diff --git a/sql/sql_partition_admin.cc b/sql/sql_partition_admin.cc index 41555306da7..1f9ee32ba73 100644 --- a/sql/sql_partition_admin.cc +++ b/sql/sql_partition_admin.cc @@ -378,17 +378,13 @@ static bool exchange_name_with_ddl_log(THD *thd, */ /* call rename table from table to tmp-name */ DBUG_EXECUTE_IF("exchange_partition_fail_3", - my_error(ER_ERROR_ON_RENAME, MYF(0), - name, tmp_name, 0, "n/a"); + my_error(ER_ERROR_ON_RENAME, MYF(0), name, tmp_name, 0); error_set= TRUE; goto err_rename;); DBUG_EXECUTE_IF("exchange_partition_abort_3", DBUG_SUICIDE();); if (file->ha_rename_table(name, tmp_name)) { - char errbuf[MYSYS_STRERROR_SIZE]; - my_strerror(errbuf, sizeof(errbuf), my_errno); - my_error(ER_ERROR_ON_RENAME, MYF(0), name, tmp_name, - my_errno, errbuf); + my_error(ER_ERROR_ON_RENAME, MYF(0), name, tmp_name, my_errno); error_set= TRUE; goto err_rename; } @@ -399,17 +395,13 @@ static bool exchange_name_with_ddl_log(THD *thd, /* call rename table from partition to table */ DBUG_EXECUTE_IF("exchange_partition_fail_5", - my_error(ER_ERROR_ON_RENAME, MYF(0), - from_name, name, 0, "n/a"); + my_error(ER_ERROR_ON_RENAME, MYF(0), from_name, name, 0); error_set= TRUE; goto err_rename;); DBUG_EXECUTE_IF("exchange_partition_abort_5", DBUG_SUICIDE();); if (file->ha_rename_table(from_name, name)) { - char errbuf[MYSYS_STRERROR_SIZE]; - my_strerror(errbuf, sizeof(errbuf), my_errno); - my_error(ER_ERROR_ON_RENAME, MYF(0), from_name, name, - my_errno, errbuf); + my_error(ER_ERROR_ON_RENAME, MYF(0), from_name, name, my_errno); error_set= TRUE; goto err_rename; } @@ -420,17 +412,13 @@ static bool exchange_name_with_ddl_log(THD *thd, /* call rename table from tmp-nam to partition */ DBUG_EXECUTE_IF("exchange_partition_fail_7", - my_error(ER_ERROR_ON_RENAME, MYF(0), - tmp_name, from_name, 0, "n/a"); + my_error(ER_ERROR_ON_RENAME, MYF(0), tmp_name, from_name, 0); error_set= TRUE; goto err_rename;); DBUG_EXECUTE_IF("exchange_partition_abort_7", DBUG_SUICIDE();); if (file->ha_rename_table(tmp_name, from_name)) { - char errbuf[MYSYS_STRERROR_SIZE]; - my_strerror(errbuf, sizeof(errbuf), my_errno); - my_error(ER_ERROR_ON_RENAME, MYF(0), tmp_name, from_name, - my_errno, errbuf); + my_error(ER_ERROR_ON_RENAME, MYF(0), tmp_name, from_name, my_errno); error_set= TRUE; goto err_rename; } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ae6f0e8f63d..be78a76152e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2287,10 +2287,8 @@ static int mysql_test_handler_read(Prepared_statement *stmt, if (!stmt->is_sql_prepare()) { if (!lex->result && !(lex->result= new (stmt->mem_root) select_send(thd))) - { - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(select_send)); DBUG_RETURN(1); - } + if (send_prep_stmt(stmt, ha_table->fields.elements) || lex->result->send_result_set_metadata(ha_table->fields, Protocol::SEND_EOF) || thd->protocol->flush()) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 071d33cc3b9..78034badf8c 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -865,7 +865,6 @@ get_binlog_list(MEM_ROOT *memroot) !(e->name= strmake_root(memroot, fname, length))) { mysql_bin_log.unlock_index(); - my_error(ER_OUTOFMEMORY, MYF(0), length + 1 + sizeof(*e)); DBUG_RETURN(NULL); } e->next= current_list; @@ -2979,7 +2978,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report) { /* connection was deleted while we waited for lock_slave_threads */ mi->unlock_slave_threads(); - my_error(WARN_NO_MASTER_INFO, mi->connection_name.length, + my_error(WARN_NO_MASTER_INFO, MYF(0), (int) mi->connection_name.length, mi->connection_name.str); DBUG_RETURN(-1); } @@ -3237,7 +3236,7 @@ int reset_slave(THD *thd, Master_info* mi) { /* connection was deleted while we waited for lock_slave_threads */ mi->unlock_slave_threads(); - my_error(WARN_NO_MASTER_INFO, mi->connection_name.length, + my_error(WARN_NO_MASTER_INFO, MYF(0), (int) mi->connection_name.length, mi->connection_name.str); DBUG_RETURN(-1); } @@ -3380,7 +3379,8 @@ static bool get_string_parameter(char *to, const char *from, size_t length, uint from_numchars= cs->cset->numchars(cs, from, from + from_length); if (from_numchars > length / cs->mbmaxlen) { - my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name, length / cs->mbmaxlen); + my_error(ER_WRONG_STRING_LENGTH, MYF(0), from, name, + (int) (length / cs->mbmaxlen)); return 1; } memcpy(to, from, from_length+1); @@ -3449,7 +3449,7 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added) { /* connection was deleted while we waited for lock_slave_threads */ mi->unlock_slave_threads(); - my_error(WARN_NO_MASTER_INFO, mi->connection_name.length, + my_error(WARN_NO_MASTER_INFO, MYF(0), (int) mi->connection_name.length, mi->connection_name.str); DBUG_RETURN(TRUE); } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f63d4a2d4f4..03107aa4574 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2949,7 +2949,7 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond) } else { - my_error(ER_NO_SUCH_THREAD, MYF(0), thread_id); + my_error(ER_NO_SUCH_THREAD, MYF(0), (ulong) thread_id); DBUG_RETURN(1); } } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ea06beeb560..9d1cfa1f1ad 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4999,7 +4999,8 @@ int mysql_create_table_no_lock(THD *thd, // Check if we hit FN_REFLEN bytes along with file extension. if (length+reg_ext_length > FN_REFLEN) { - my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), sizeof(path)-1, path); + my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), (int) sizeof(path)-1, + path); return true; } } @@ -5263,7 +5264,7 @@ mysql_rename_table(handlerton *base, const char *old_db, // Check if we hit FN_REFLEN bytes along with file extension. if (length+reg_ext_length > FN_REFLEN) { - my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), sizeof(to)-1, to); + my_error(ER_IDENT_CAUSES_TOO_LONG_PATH, MYF(0), (int) sizeof(to)-1, to); DBUG_RETURN(TRUE); } @@ -10348,7 +10349,7 @@ bool check_engine(THD *thd, const char *db_name, if (no_substitution) { const char *engine_name= ha_resolve_storage_engine_name(req_engine); - my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), engine_name, engine_name); + my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), engine_name); DBUG_RETURN(TRUE); } *new_engine= enf_engine; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 3c324a34ee9..1fcc568af09 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2335,7 +2335,7 @@ master_def: if ($3 > MASTER_DELAY_MAX) { my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0), - $3, MASTER_DELAY_MAX); + (uint) $3, (uint) MASTER_DELAY_MAX); } else Lex->mi.sql_delay = $3; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index d53276d7c24..ea95899b004 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1959,7 +1959,7 @@ Sys_var_slave_parallel_mode::global_update(THD *thd, set_var *var) if (mi->rli.slave_running) { my_error(ER_SLAVE_MUST_STOP, MYF(0), - mi->connection_name.length, mi->connection_name.str); + (int) mi->connection_name.length, mi->connection_name.str); res= true; } else @@ -4461,7 +4461,7 @@ bool Sys_var_rpl_filter::global_update(THD *thd, set_var *var) if (mi->rli.slave_running) { my_error(ER_SLAVE_MUST_STOP, MYF(0), - mi->connection_name.length, + (int) mi->connection_name.length, mi->connection_name.str); result= true; } @@ -4664,7 +4664,7 @@ static bool update_slave_skip_counter(sys_var *self, THD *thd, Master_info *mi) { if (mi->rli.slave_running) { - my_error(ER_SLAVE_MUST_STOP, MYF(0), mi->connection_name.length, + my_error(ER_SLAVE_MUST_STOP, MYF(0), (int) mi->connection_name.length, mi->connection_name.str); return true; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 76c753cf0b4..173e955e44b 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1553,8 +1553,8 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, ret, (thd->db ? thd->db : "(null)"), (thd->query()) ? thd->query() : "void"); - my_error(ER_LOCK_DEADLOCK, MYF(0), "WSREP replication failed. Check " - "your wsrep connection state and retry the query."); + my_message(ER_LOCK_DEADLOCK, "WSREP replication failed. Check " + "your wsrep connection state and retry the query.", MYF(0)); wsrep_keys_free(&key_arr); rc= -1; } diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 3c90f03a5fb..a6122a7b1bc 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -348,7 +348,7 @@ bool wsrep_provider_update (sys_var *self, THD* thd, enum_var_type type) if (wsrep_init()) { - my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp); + my_error(ER_CANT_OPEN_LIBRARY, MYF(0), tmp, my_error, "wsrep_init failed"); rcode = true; } free(tmp); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 2297149f272..4a0b6dfe4b9 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -15052,7 +15052,7 @@ ha_innobase::defragment_table( "Table %s is encrypted but encryption service or" " used key_id is not available. " " Can't continue checking table.", - index->table->name); + index->table->name.m_name); ret = convert_error_code_to_mysql(err, 0, current_thd); break; @@ -15272,7 +15272,7 @@ ha_innobase::check( "Table %s is encrypted but encryption service or" " used key_id is not available. " " Can't continue checking table.", - index->table->name); + index->table->name.m_name); } else { push_warning_printf( thd, @@ -22970,7 +22970,7 @@ ib_push_frm_error( "InnoDB: Table %s has a " "primary key in InnoDB data " "dictionary, but not in " - "MariaDB!", ib_table->name); + "MariaDB!", ib_table->name.m_name); } break; case DICT_NO_PK_FRM_HAS: @@ -22983,7 +22983,7 @@ ib_push_frm_error( "columns, then MariaDB internally treats that " "key as the primary key. You can fix this " "error by dump + DROP + CREATE + reimport " - "of the table.", ib_table->name); + "of the table.", ib_table->name.m_name); if (push_warning) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -22992,7 +22992,7 @@ ib_push_frm_error( "primary key in InnoDB data " "dictionary, but has one in " "MariaDB!", - ib_table->name); + ib_table->name.m_name); } break; @@ -23016,7 +23016,7 @@ ib_push_frm_error( "indexes inside InnoDB, which " "is different from the number of " "indexes %u defined in the MariaDB ", - ib_table->name, n_keys, + ib_table->name.m_name, n_keys, table->s->keys); } break; @@ -23026,7 +23026,7 @@ ib_push_frm_error( sql_print_error("InnoDB: Table %s is consistent " "on InnoDB data dictionary and MariaDB " " FRM file.", - ib_table->name); + ib_table->name.m_name); ut_error; break; } |