Skip to content

Commit c7ba237

Browse files
committed
Merge 10.3 into 10.4
2 parents 2917bd0 + ac49b7a commit c7ba237

19 files changed

+567
-313
lines changed

mysql-test/suite/innodb/r/innodb-index-online.result

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ SET @rowlog_decrypt_1=
358358
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
359359
connection con1;
360360
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
361-
ALTER TABLE t1 ADD INDEX c2f(c2);
361+
ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
362362
connection default;
363363
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
364364
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
@@ -397,7 +397,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done';
397397
connection con1;
398398
Warnings:
399399
Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release
400-
ALTER TABLE t1 CHANGE c2 c22f INT;
401400
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
402401
name count
403402
ddl_background_drop_indexes 0

mysql-test/suite/innodb/t/innodb-index-online.test

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,7 @@ connection con1;
318318
# Accumulate and apply some modification log.
319319
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
320320
--send
321-
# FIXME: MDEV-13668
322-
#ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
323-
ALTER TABLE t1 ADD INDEX c2f(c2);
321+
ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
324322

325323
connection default;
326324
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
@@ -345,8 +343,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done';
345343

346344
connection con1;
347345
reap;
348-
# FIXME: MDEV-13668
349-
ALTER TABLE t1 CHANGE c2 c22f INT;
350346

351347
eval $innodb_metrics_select;
352348

mysql-test/suite/innodb_fts/r/misc_debug2.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,17 @@ INSERT INTO mdev21563 VALUES('This is a test');
66
ALTER TABLE mdev21563 DISCARD TABLESPACE;
77
# restart
88
DROP TABLE mdev21563;
9+
#
10+
# MDEV-29342 Assertion failure in file que0que.cc line 728
11+
#
12+
CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
13+
INSERT INTO t1 VALUES('mysql'), ('innodb');
14+
set debug_dbug="+d,fts_instrument_sync_debug";
15+
INSERT INTO t1 VALUES('test');
16+
set debug_dbug="-d,fts_instrument_sync_debug";
17+
INSERT INTO t1 VALUES('This is a fts issue');
18+
# restart
19+
set debug_dbug="+d,fts_instrument_sync_debug";
20+
UPDATE t1 SET f1="mariadb";
21+
set debug_dbug="-d,fts_instrument_sync_debug";
22+
DROP TABLE t1;

mysql-test/suite/innodb_fts/t/misc_debug2.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,18 @@ INSERT INTO mdev21563 VALUES('This is a test');
1010
ALTER TABLE mdev21563 DISCARD TABLESPACE;
1111
--source include/restart_mysqld.inc
1212
DROP TABLE mdev21563;
13+
14+
--echo #
15+
--echo # MDEV-29342 Assertion failure in file que0que.cc line 728
16+
--echo #
17+
CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
18+
INSERT INTO t1 VALUES('mysql'), ('innodb');
19+
set debug_dbug="+d,fts_instrument_sync_debug";
20+
INSERT INTO t1 VALUES('test');
21+
set debug_dbug="-d,fts_instrument_sync_debug";
22+
INSERT INTO t1 VALUES('This is a fts issue');
23+
--source include/restart_mysqld.inc
24+
set debug_dbug="+d,fts_instrument_sync_debug";
25+
UPDATE t1 SET f1="mariadb";
26+
set debug_dbug="-d,fts_instrument_sync_debug";
27+
DROP TABLE t1;
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
include/master-slave.inc
2+
[connection master]
3+
#
4+
# Set replica to ignore system tables
5+
connection slave;
6+
include/stop_slave.inc
7+
SET @@GLOBAL.replicate_wild_ignore_table="mysql.%";
8+
include/start_slave.inc
9+
#
10+
# Trying to execute REVOKE ALL PRIVILEGES on a non-existent user and
11+
# DROP USER on a list of users where not all users exist should error
12+
# and be written into the binary log
13+
connection master;
14+
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistentuser'@'%';
15+
ERROR HY000: Can't revoke all privileges for one or more of the requested users
16+
CREATE USER 'testuser'@'localhost' IDENTIFIED by '';
17+
DROP USER 'testuser'@'localhost', 'nonexistentuser'@'%';
18+
ERROR HY000: Operation DROP USER failed for 'nonexistentuser'@'%'
19+
#
20+
# Ensure the events exist in the primary's binary log
21+
FLUSH BINARY LOGS;
22+
# MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/mysqlbinlog_out.sql
23+
# There should be three Query events: REVOKE, CREATE USER, and DROP USER
24+
FOUND 3 /Query/ in mysqlbinlog_out.sql
25+
FOUND 1 /REVOKE ALL PRIVILEGES/ in mysqlbinlog_out.sql
26+
FOUND 1 /CREATE USER/ in mysqlbinlog_out.sql
27+
FOUND 1 /DROP USER/ in mysqlbinlog_out.sql
28+
#
29+
# Ensure that the replica receives the event without error
30+
connection slave;
31+
Last_SQL_Error =
32+
Last_SQL_Errno = 0
33+
#
34+
# Clean up
35+
connection slave;
36+
include/stop_slave.inc
37+
SET @@GLOBAL.replicate_wild_ignore_table="";
38+
include/start_slave.inc
39+
include/rpl_end.inc
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
#
2+
# Purpose:
3+
# This test ensures that a binlogged Query_log_event which failed on the
4+
# primary server does not break replication if it is ignored by Grant_tables
5+
# on the replica. The bug reported by MDEV-28530 shows this with
6+
# REVOKE ALL PRIVILEGES.. using a non-existent user. The primary will binlog
7+
# the REVOKE command with an error code, and the replica will think the command
8+
# executed with success because the replication filter will ignore the command
9+
# while accessing the Grant_tables classes. When the replica performs an error
10+
# check, it sees the difference between the error codes, and replication
11+
# breaks.
12+
#
13+
# Methodology:
14+
# Using a replica configured with replicate_wild_ignore_table="schema.%",
15+
# on the primary, execute REVOKE ALL PRVILEGES using a non-existent user and
16+
# DROP USER using a list of users where not all users exist, and ensure that
17+
# the replica acknowledges and ignores the events without erroring.
18+
#
19+
# References:
20+
# MDEV-28530: Revoking privileges from a non-existing user on a master breaks
21+
# replication on the slave in the presence of replication filters
22+
#
23+
24+
source include/master-slave.inc;
25+
source include/have_binlog_format_statement.inc;
26+
27+
--echo #
28+
--echo # Set replica to ignore system tables
29+
connection slave;
30+
let $old_filter= query_get_value(SHOW SLAVE STATUS, Replicate_Wild_Ignore_Table, 1);
31+
source include/stop_slave.inc;
32+
SET @@GLOBAL.replicate_wild_ignore_table="mysql.%";
33+
source include/start_slave.inc;
34+
35+
36+
--echo #
37+
--echo # Trying to execute REVOKE ALL PRIVILEGES on a non-existent user and
38+
--echo # DROP USER on a list of users where not all users exist should error
39+
--echo # and be written into the binary log
40+
--connection master
41+
42+
--error 1269
43+
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistentuser'@'%';
44+
45+
CREATE USER 'testuser'@'localhost' IDENTIFIED by '';
46+
--error 1396
47+
DROP USER 'testuser'@'localhost', 'nonexistentuser'@'%';
48+
--save_master_pos
49+
50+
51+
--echo #
52+
--echo # Ensure the events exist in the primary's binary log
53+
--let $MYSQLD_DATADIR= `select @@datadir`
54+
--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
55+
FLUSH BINARY LOGS;
56+
--echo # MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/mysqlbinlog_out.sql
57+
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQL_TMP_DIR/mysqlbinlog_out.sql
58+
59+
--echo # There should be three Query events: REVOKE, CREATE USER, and DROP USER
60+
--let SEARCH_FILE= $MYSQL_TMP_DIR/mysqlbinlog_out.sql
61+
62+
--let SEARCH_PATTERN= Query
63+
--source include/search_pattern_in_file.inc
64+
65+
--let SEARCH_PATTERN= REVOKE ALL PRIVILEGES
66+
--source include/search_pattern_in_file.inc
67+
68+
--let SEARCH_PATTERN= CREATE USER
69+
--source include/search_pattern_in_file.inc
70+
71+
--let SEARCH_PATTERN= DROP USER
72+
--source include/search_pattern_in_file.inc
73+
74+
75+
--echo #
76+
--echo # Ensure that the replica receives the event without error
77+
connection slave;
78+
--sync_with_master
79+
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
80+
--echo Last_SQL_Error = $error
81+
let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
82+
--echo Last_SQL_Errno = $errno
83+
84+
85+
--echo #
86+
--echo # Clean up
87+
--connection slave
88+
source include/stop_slave.inc;
89+
--eval SET @@GLOBAL.replicate_wild_ignore_table="$old_filter"
90+
source include/start_slave.inc;
91+
92+
--source include/rpl_end.inc

plugin/disks/information_schema_disks.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int disks_table_add_row_stat(
106106
#else
107107
if (info.f_flags & MNT_RDONLY)
108108
#endif
109-
return 0;
109+
return 0;
110110

111111
pTable->field[0]->store(zDisk, strlen(zDisk), system_charset_info);
112112
pTable->field[1]->store(zPath, strlen(zPath), system_charset_info);
@@ -212,15 +212,15 @@ static int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond)
212212
)
213213
{
214214
struct stat f;
215-
const char *path, *point;
215+
const char *path, *point;
216216
#ifdef HAVE_SETMNTENT
217-
path= pEnt->mnt_dir;
218-
point= pEnt->mnt_fsname;
217+
path= pEnt->mnt_dir;
218+
point= pEnt->mnt_fsname;
219219
#else
220-
path= pEnt->mnt_mountp;
221-
point= pEnt->mnt_special;
220+
path= pEnt->mnt_mountp;
221+
point= pEnt->mnt_special;
222222
#endif
223-
// Try to keep to real storage by excluding
223+
// Try to keep to real storage by excluding
224224
// read only mounts, and mount points that aren't directories
225225
if (hasmntopt(pEnt, MNTOPT_RO) != NULL)
226226
continue;

sql/log_event.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5740,6 +5740,13 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
57405740
thd->update_server_status();
57415741
log_slow_statement(thd);
57425742
thd->lex->restore_set_statement_var();
5743+
5744+
/*
5745+
When THD::slave_expected_error gets reset inside execution stack
5746+
that is the case of to be ignored event. In this case the expected
5747+
error must change to the reset value as well.
5748+
*/
5749+
expected_error= thd->slave_expected_error;
57435750
}
57445751

57455752
thd->variables.option_bits&= ~OPTION_MASTER_SQL_ERROR;

sql/share/errmsg-utf8.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7135,8 +7135,9 @@ ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS
71357135
chi "语句不安全,因为它在访问同一事务中访问事务表后访问非事务性表"
71367136
eng "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"
71377137
ER_MESSAGE_AND_STATEMENT
7138-
chi "%s语句:%s"
7139-
eng "%s Statement: %s"
7138+
chi "%s.语句:%s"
7139+
eng "%s. Statement: %s"
7140+
71407141
ER_SLAVE_CONVERSION_FAILED
71417142
chi "列%d表'%-.192s.%-.192s'无法从'%-.50s'类型为'%-.50s'"
71427143
eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.50s' to type '%-.50s'"

sql/sql_acl.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1969,9 +1969,11 @@ class Grant_tables
19691969
some kind of updates to the mysql.% tables.
19701970
*/
19711971
Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter;
1972-
19731972
if (rpl_filter->is_on() && !rpl_filter->tables_ok(0, tables))
1973+
{
1974+
thd->slave_expected_error= 0;
19741975
DBUG_RETURN(1);
1976+
}
19751977
}
19761978
DBUG_RETURN(0);
19771979
}

sql/sql_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,6 +3218,8 @@ class THD: public THD_count, /* this must be first */
32183218
/*
32193219
In case of a slave, set to the error code the master got when executing
32203220
the query. 0 if no error on the master.
3221+
The stored into variable master error code may get reset inside
3222+
execution stack when the event turns out to be ignored.
32213223
*/
32223224
int slave_expected_error;
32233225
enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command()

storage/innobase/fts/fts0fts.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2655,7 +2655,7 @@ fts_cmp_set_sync_doc_id(
26552655
}
26562656
mutex_exit(&cache->doc_id_lock);
26572657

2658-
if (cmp_doc_id > *doc_id) {
2658+
if (cmp_doc_id && cmp_doc_id >= *doc_id) {
26592659
error = fts_update_sync_doc_id(
26602660
table, cache->synced_doc_id, trx);
26612661
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#
2+
# MDEV-27172 Prefix indices on Spider tables may lead to wrong query results
3+
#
4+
for master_1
5+
for child2
6+
child2_1
7+
child2_2
8+
child2_3
9+
for child3
10+
connection child2_1;
11+
SET @general_log_backup = @@global.general_log;
12+
SET @log_output_backup = @@global.log_output;
13+
SET @@global.general_log = 1;
14+
SET @@global.log_output = "TABLE";
15+
CREATE DATABASE auto_test_remote;
16+
USE auto_test_remote;
17+
CREATE TABLE tbl_a (
18+
id int NOT NULL,
19+
greeting VARCHAR(255),
20+
KEY(greeting)
21+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
22+
CREATE TABLE tbl_b (
23+
id int NOT NULL,
24+
greeting VARCHAR(255),
25+
KEY k (greeting(5))
26+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
27+
CREATE TABLE tbl_c (
28+
id int NOT NULL,
29+
greeting TEXT,
30+
KEY k (greeting(5))
31+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
32+
TRUNCATE TABLE mysql.general_log;
33+
connection master_1;
34+
CREATE DATABASE auto_test_local;
35+
USE auto_test_local;
36+
CREATE TABLE tbl_a (
37+
id int NOT NULL,
38+
greeting VARCHAR(255),
39+
KEY k (greeting)
40+
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
41+
INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
42+
SELECT * FROM tbl_a WHERE greeting = "Aloha!"
43+
AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
44+
id greeting
45+
2 Aloha!
46+
CREATE TABLE tbl_b (
47+
id int NOT NULL,
48+
greeting VARCHAR(255),
49+
KEY k (greeting(5))
50+
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"';
51+
INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
52+
SELECT * FROM tbl_b WHERE greeting = "Aloha!"
53+
AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
54+
id greeting
55+
2 Aloha!
56+
CREATE TABLE tbl_c (
57+
id int NOT NULL,
58+
greeting TEXT,
59+
KEY k (greeting(5))
60+
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c", srv "s_2_1"';
61+
INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
62+
SELECT * FROM tbl_c WHERE greeting = "Aloha!"
63+
AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
64+
id greeting
65+
2 Aloha!
66+
connection child2_1;
67+
SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %';
68+
argument
69+
select `id`,`greeting` from `auto_test_remote`.`tbl_a` where `greeting` = 'Aloha!' and ((`greeting` = 'Aloha!'))
70+
select `id`,`greeting` from `auto_test_remote`.`tbl_b` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
71+
select `id`,`greeting` from `auto_test_remote`.`tbl_c` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
72+
SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %'
73+
connection child2_1;
74+
SET @@global.general_log = @general_log_backup;
75+
SET @@global.log_output = @log_output_backup;
76+
DROP DATABASE auto_test_remote;
77+
connection master_1;
78+
DROP DATABASE auto_test_local;
79+
for master_1
80+
for child2
81+
child2_1
82+
child2_2
83+
child2_3
84+
for child3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
!include include/default_mysqld.cnf
2+
!include ../my_1_1.cnf
3+
!include ../my_2_1.cnf

0 commit comments

Comments
 (0)