Skip to content

Commit

Permalink
Merge 10.2 into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Sep 22, 2020
2 parents fde3d89 + 9d0ee2d commit d9d9c30
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
Expand Down
12 changes: 12 additions & 0 deletions mysql-test/main/ctype_utf8.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
#
Expand Down
12 changes: 12 additions & 0 deletions mysql-test/main/ctype_utf8.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/main/mysql_upgrade.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
#
Expand Down
14 changes: 14 additions & 0 deletions mysql-test/main/subselect_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
16 changes: 16 additions & 0 deletions mysql-test/main/subselect_innodb.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
10 changes: 10 additions & 0 deletions mysql-test/suite/rpl/r/rpl_binlog_index.result
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,30 @@ 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
# Remove the unneeded master-bin.index file
# 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]
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/rpl/r/rpl_gtid_crash.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
18 changes: 13 additions & 5 deletions mysql-test/suite/rpl/t/rpl_binlog_index.test
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ FLUSH BINARY LOGS;
INSERT INTO t1 VALUES (1);

sync_slave_with_master;

--source include/stop_slave.inc
#
# Test on master
#
Expand All @@ -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
#
Expand All @@ -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;
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/rpl/t/rpl_gtid_crash.test
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 0 additions & 2 deletions sql/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
10 changes: 9 additions & 1 deletion sql/item_strfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1441,11 +1441,19 @@ class Item_func_conv_charset :public Item_str_func
/*
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(); }
Expand Down
57 changes: 52 additions & 5 deletions sql/sql_repl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/*
Expand All @@ -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");

Expand Down Expand Up @@ -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;
Expand All @@ -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
*/
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5395,6 +5395,7 @@ os_file_set_size(
errno = err;
return false;
case EINVAL:
case EOPNOTSUPP:
/* fall back to the code below */
break;
}
Expand Down
2 changes: 2 additions & 0 deletions support-files/use_galera_new_cluster.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ 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
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=

0 comments on commit d9d9c30

Please sign in to comment.