diff options
-rw-r--r-- | client/mysql_upgrade.c | 2 | ||||
-rw-r--r-- | mysql-test/main/ctype_utf8.result | 12 | ||||
-rw-r--r-- | mysql-test/main/ctype_utf8.test | 12 | ||||
-rw-r--r-- | mysql-test/main/mysql_upgrade.result | 4 | ||||
-rw-r--r-- | mysql-test/main/subselect_innodb.result | 14 | ||||
-rw-r--r-- | mysql-test/main/subselect_innodb.test | 16 | ||||
-rw-r--r-- | mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test | 5 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_binlog_index.result | 10 | ||||
-rw-r--r-- | mysql-test/suite/rpl/r/rpl_gtid_crash.result | 3 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_binlog_index.test | 18 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/rpl_gtid_crash.test | 3 | ||||
-rw-r--r-- | mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test | 2 | ||||
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/item_strfunc.h | 10 | ||||
-rw-r--r-- | sql/sql_repl.cc | 57 | ||||
-rw-r--r-- | storage/innobase/os/os0file.cc | 1 | ||||
-rw-r--r-- | support-files/use_galera_new_cluster.conf | 2 |
18 files changed, 159 insertions, 17 deletions
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index 26fa275dacd..619fe07505b 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -1173,7 +1173,7 @@ static int check_version_match(void) extract_variable_from_show(&ds_version, version_str)) { print_error("Version check failed. Got the following error when calling " - "the 'mysql' command line client", &ds_version); + "the 'mysql_upgrade' command line client", &ds_version); dynstr_free(&ds_version); return 1; /* Query failed */ } diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 55d72f670ee..102e904d4f0 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -10532,6 +10532,18 @@ SELECT CONVERT(1, CHAR) IN ('100', '10', '1'); CONVERT(1, CHAR) IN ('100', '10', '1') 1 # +# MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds) +# +SET NAMES utf8; +CREATE OR REPLACE TABLE t1(a DATETIME) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('2019-03-10 02:55:05'); +CREATE OR REPLACE TABLE t2(a VARCHAR(50) CHARACTER SET latin1) ENGINE=MYISAM; +INSERT INTO t2 VALUES ('2019-03-10 02:55:05'); +SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2); +a +2019-03-10 02:55:05 +DROP TABLE t1, t2; +# # End of 10.1 tests # # diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 6de12fef97b..38dd9341e47 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -2051,6 +2051,18 @@ SELECT CONVERT(1, CHAR) IN ('100', 10, '101'); SELECT CONVERT(1, CHAR) IN ('100', 10, '1'); SELECT CONVERT(1, CHAR) IN ('100', '10', '1'); +--echo # +--echo # MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds) +--echo # + +SET NAMES utf8; +CREATE OR REPLACE TABLE t1(a DATETIME) ENGINE=MYISAM; +INSERT INTO t1 VALUES ('2019-03-10 02:55:05'); +CREATE OR REPLACE TABLE t2(a VARCHAR(50) CHARACTER SET latin1) ENGINE=MYISAM; +INSERT INTO t2 VALUES ('2019-03-10 02:55:05'); +SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2); +DROP TABLE t1, t2; + --echo # --echo # End of 10.1 tests diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index aa58440747a..a77a4c061a0 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -145,7 +145,7 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK DROP USER mysqltest1@'%'; -Version check failed. Got the following error when calling the 'mysql' command line client +Version check failed. Got the following error when calling the 'mysql_upgrade' command line client ERROR 1045 (28000): Access denied for user 'mysqltest1'@'localhost' (using password: YES) FATAL ERROR: Upgrade failed Run mysql_upgrade with a non existing server socket @@ -413,7 +413,7 @@ OK # Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR # Run mysql_upgrade with unauthorized access -Version check failed. Got the following error when calling the 'mysql' command line client +Version check failed. Got the following error when calling the 'mysql_upgrade' command line client ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) FATAL ERROR: Upgrade failed # diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result index ec7f2c0a3d5..4eaea099451 100644 --- a/mysql-test/main/subselect_innodb.result +++ b/mysql-test/main/subselect_innodb.result @@ -615,3 +615,17 @@ id select_type table type possible_keys key key_len ref rows filtered Extra Warnings: Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2` DROP TABLE t1,t2,t3,t4; +# +# MDEV-23535: SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds) +# +set @save_character_set_connection=@@character_set_connection; +set character_set_connection='utf8'; +CREATE TABLE t1(a DATETIME, b VARCHAR(50)) ENGINE=INNODB; +INSERT INTO t1 VALUES ('2019-03-10 02:55:05', '2019-03-10 02:55:05'); +CREATE TABLE t2(a VARCHAR(50)) ENGINE=INNODB; +INSERT INTO t2 VALUES ('2019-03-10 02:55:05'); +SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2); +a b +2019-03-10 02:55:05 2019-03-10 02:55:05 +DROP TABLE t1,t2; +set character_set_connection=@save_character_set_connection; diff --git a/mysql-test/main/subselect_innodb.test b/mysql-test/main/subselect_innodb.test index 544bcd994ed..2c117fe00d6 100644 --- a/mysql-test/main/subselect_innodb.test +++ b/mysql-test/main/subselect_innodb.test @@ -611,3 +611,19 @@ FROM t1 DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-23535: SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds) +--echo # + +set @save_character_set_connection=@@character_set_connection; +set character_set_connection='utf8'; + +CREATE TABLE t1(a DATETIME, b VARCHAR(50)) ENGINE=INNODB; +INSERT INTO t1 VALUES ('2019-03-10 02:55:05', '2019-03-10 02:55:05'); +CREATE TABLE t2(a VARCHAR(50)) ENGINE=INNODB; +INSERT INTO t2 VALUES ('2019-03-10 02:55:05'); +SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2); +DROP TABLE t1,t2; + +set character_set_connection=@save_character_set_connection; diff --git a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result index 358422c5842..c2e634ebe82 100644 --- a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result +++ b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result @@ -9,4 +9,7 @@ INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repea INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255)); UPDATE t1 SET c1=repeat('b',255); INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255)); +SHOW BINLOG EVENTS FROM POS; +ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Invalid pos specified. Requested from pos:POS is greater than actual file size:MAX_POS + DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test b/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test index e6a9e1cb2c1..05e6967c538 100644 --- a/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test +++ b/mysql-test/suite/binlog/t/binlog_show_binlog_event_random_pos.test @@ -34,4 +34,9 @@ while ($pos <= $max_pos) --enable_query_log } +# Testing a case where input position is greater than actual binlog file size. +--replace_result $pos POS $max_pos MAX_POS +--error 1220 +eval SHOW BINLOG EVENTS FROM $pos; + DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_binlog_index.result b/mysql-test/suite/rpl/r/rpl_binlog_index.result index 4257dbde57a..78665ba1a7b 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_index.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_index.result @@ -7,13 +7,20 @@ CREATE TABLE t1 (a INT); FLUSH BINARY LOGS; INSERT INTO t1 VALUES (1); connection slave; +include/stop_slave.inc connection master; # Shutdown master include/rpl_stop_server.inc [server_number=1] # Move the master binlog files and the index file to a new place # Restart master with log-bin option set to the new path # Master has restarted successfully +connection slave; +include/start_slave.inc +connection master; # Create the master-bin.index file with the old format +connection slave; +include/stop_slave.inc +connection master; # Shutdown master include/rpl_stop_server.inc [server_number=1] # Move back the master binlog files @@ -21,6 +28,9 @@ include/rpl_stop_server.inc [server_number=1] # Restart master with log-bin option set to default # Master has restarted successfully connection slave; +include/start_slave.inc +connection master; +connection slave; # stop slave include/stop_slave.inc include/rpl_stop_server.inc [server_number=2] diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index ed2a2b287e9..153081d9ca5 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -9,6 +9,9 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1, 0); connection server_2; +SET sql_log_bin=0; +call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); +SET sql_log_bin=1; include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, MASTER_USE_GTID=CURRENT_POS; diff --git a/mysql-test/suite/rpl/t/rpl_binlog_index.test b/mysql-test/suite/rpl/t/rpl_binlog_index.test index 8586b1d7489..95c49c3d574 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_index.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_index.test @@ -43,7 +43,7 @@ FLUSH BINARY LOGS; INSERT INTO t1 VALUES (1); sync_slave_with_master; - +--source include/stop_slave.inc # # Test on master # @@ -58,13 +58,15 @@ source include/rpl_stop_server.inc; --move_file $master_datadir/master-bin.index $tmpdir/master-bin.index --echo # Restart master with log-bin option set to the new path ---let $rpl_server_parameters=--log-bin=$tmpdir/master-bin +--let $rpl_server_parameters=--log-bin=$tmpdir/master-bin --log-bin-index=$tmpdir/master-bin --let $keep_include_silent=1 source include/rpl_start_server.inc; --let $keep_include_silent=0 --echo # Master has restarted successfully - +--connection slave +--source include/start_slave.inc +--connection master # # Test master can handle old format with directory path in index file # @@ -85,7 +87,10 @@ if (!$is_windows) --disable_query_log source include/write_var_to_file.inc; --enable_query_log +--sync_slave_with_master +--source include/stop_slave.inc +--connection master --echo # Shutdown master --let $rpl_server_number=1 source include/rpl_stop_server.inc; @@ -99,14 +104,17 @@ source include/rpl_stop_server.inc; --remove_file $tmpdir/master-bin.index --echo # Restart master with log-bin option set to default ---let $rpl_server_parameters=--log-bin=$master_datadir/master-bin +--let $rpl_server_parameters=--log-bin=$master_datadir/master-bin --log-bin-index=$master_datadir/master-bin --let $keep_include_silent=1 source include/rpl_start_server.inc; --let $keep_include_silent=0 --echo # Master has restarted successfully +--connection slave +--source include/start_slave.inc -connection slave; +--connection master +--sync_slave_with_master --echo # stop slave --source include/stop_slave.inc --let $rpl_server_number= 2 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test index e72d1c3ef47..d0af69a65ed 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test @@ -21,6 +21,9 @@ INSERT INTO t1 VALUES (1, 0); --connection server_2 --sync_with_master +SET sql_log_bin=0; +call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); +SET sql_log_bin=1; --source include/stop_slave.inc --replace_result $MASTER_MYPORT MASTER_PORT eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT, diff --git a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test index 06a9e8ad75b..12794dbd898 100644 --- a/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test +++ b/mysql-test/suite/rpl/t/show_status_stop_slave_race-7126.test @@ -10,7 +10,7 @@ call mtr.add_suppression("Master is configured to log replication events"); # If everything is okay, the test will end in several seconds; maybe a minute. # If the problem shows up, it will hang until testcase timeout is exceeded. ---exec $MYSQL_SLAP --silent --socket=$SLAVE_MYSOCK -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test +--exec $MYSQL_SLAP --silent --host=127.0.0.1 -P $SLAVE_MYPORT -q "START SLAVE; STOP SLAVE; SHOW GLOBAL STATUS" -c 2 --number-of-queries=100 --create-schema=test # All done. diff --git a/sql/item.cc b/sql/item.cc index ff1a0cbd917..4c7e1ab7384 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2743,8 +2743,6 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll, Item* conv= (*arg)->safe_charset_converter(thd, coll.collation); if (conv == *arg) continue; - if (!conv && ((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII)) - conv= new (thd->mem_root) Item_func_conv_charset(thd, *arg, coll.collation, 1); if (!conv) { diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index a279dd8598f..c0505773ba8 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1441,11 +1441,19 @@ public: /* Conversion from and to "binary" is safe. Conversion to Unicode is safe. + Conversion from an expression with the ASCII repertoire + to any character set that can store characters U+0000..U+007F + is safe: + - All supported multibyte character sets can store U+0000..U+007F + - All supported 7bit character sets can store U+0000..U+007F + except those marked with MY_CS_NONASCII (e.g. swe7). Other kind of conversions are potentially lossy. */ safe= (args[0]->collation.collation == &my_charset_bin || cs == &my_charset_bin || - (cs->state & MY_CS_UNICODE)); + (cs->state & MY_CS_UNICODE) || + (args[0]->collation.repertoire == MY_REPERTOIRE_ASCII && + (cs->mbmaxlen > 1 || !(cs->state & MY_CS_NONASCII)))); } } bool is_json_type() { return args[0]->is_json_type(); } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 4b23348b306..4c3abc3c5a8 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -3906,6 +3906,7 @@ bool mysql_show_binlog_events(THD* thd) { Protocol *protocol= thd->protocol; List<Item> field_list; + char errmsg_buf[MYSYS_ERRMSG_SIZE]; const char *errmsg = 0; bool ret = TRUE; /* @@ -3920,6 +3921,9 @@ bool mysql_show_binlog_events(THD* thd) Master_info *mi= 0; LOG_INFO linfo; LEX_MASTER_INFO *lex_mi= &thd->lex->mi; + enum enum_binlog_checksum_alg checksum_alg; + my_off_t binlog_size; + MY_STAT s; DBUG_ENTER("mysql_show_binlog_events"); @@ -3968,10 +3972,6 @@ bool mysql_show_binlog_events(THD* thd) mi= 0; } - /* Validate user given position using checksum */ - if (lex_mi->pos == pos && !opt_master_verify_checksum) - verify_checksum_once= true; - unit->set_limit(thd->lex->current_select); limit_start= unit->offset_limit_cnt; limit_end= unit->select_limit_cnt; @@ -3995,6 +3995,17 @@ bool mysql_show_binlog_events(THD* thd) if ((file=open_binlog(&log, linfo.log_file_name, &errmsg)) < 0) goto err; + my_stat(linfo.log_file_name, &s, MYF(0)); + binlog_size= s.st_size; + if (lex_mi->pos > binlog_size) + { + sprintf(errmsg_buf, "Invalid pos specified. Requested from pos:%llu is " + "greater than actual file size:%lu\n", lex_mi->pos, + (ulong)s.st_size); + errmsg= errmsg_buf; + goto err; + } + /* to account binlog event header size */ @@ -4046,7 +4057,43 @@ bool mysql_show_binlog_events(THD* thd) } } - my_b_seek(&log, pos); + if (lex_mi->pos > BIN_LOG_HEADER_SIZE) + { + checksum_alg= description_event->checksum_alg; + /* Validate user given position using checksum */ + if (checksum_alg != BINLOG_CHECKSUM_ALG_OFF && + checksum_alg != BINLOG_CHECKSUM_ALG_UNDEF) + { + if (!opt_master_verify_checksum) + verify_checksum_once= true; + my_b_seek(&log, pos); + } + else + { + my_off_t cur_pos= my_b_tell(&log); + ulong next_event_len= 0; + uchar buff[IO_SIZE]; + while (cur_pos < pos) + { + my_b_seek(&log, cur_pos + EVENT_LEN_OFFSET); + if (my_b_read(&log, (uchar *)buff, sizeof(next_event_len))) + { + mysql_mutex_unlock(log_lock); + errmsg = "Could not read event_length"; + goto err; + } + next_event_len= uint4korr(buff); + cur_pos= cur_pos + next_event_len; + } + if (cur_pos > pos) + { + mysql_mutex_unlock(log_lock); + errmsg= "Invalid input pos specified please provide valid one."; + goto err; + } + my_b_seek(&log, cur_pos); + } + } for (event_count = 0; (ev = Log_event::read_log_event(&log, diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 0dc8ce6f1d3..8ff4533e588 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -5395,6 +5395,7 @@ fallback: errno = err; return false; case EINVAL: + case EOPNOTSUPP: /* fall back to the code below */ break; } diff --git a/support-files/use_galera_new_cluster.conf b/support-files/use_galera_new_cluster.conf index 4d8ad253ce5..79d191094d4 100644 --- a/support-files/use_galera_new_cluster.conf +++ b/support-files/use_galera_new_cluster.conf @@ -15,6 +15,7 @@ ConditionPathExists= Type=oneshot Restart=no +# Don't install or try to prepare for galera SST. ExecStartPre= # Override the multi instance service for a bootstrap start instance @@ -22,4 +23,5 @@ ExecStart= ExecStart=/usr/bin/echo "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster" ExecStart=/usr/bin/false +# This isn't a service meant to execute anything but a message ExecStartPost= |