Skip to content

Commit

Permalink
Merge 10.6 into 10.7
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Sep 7, 2022
2 parents 5fdbb3a + 1985204 commit 0c0b697
Show file tree
Hide file tree
Showing 24 changed files with 586 additions and 325 deletions.
3 changes: 1 addition & 2 deletions mysql-test/suite/innodb/r/innodb-index-online.result
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ SET @rowlog_decrypt_1=
WHERE variable_name = 'innodb_encryption_n_rowlog_blocks_decrypted');
connection con1;
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
ALTER TABLE t1 ADD INDEX c2f(c2);
ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
Expand Down Expand Up @@ -396,7 +396,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done';
connection con1;
Warnings:
Note 1831 Duplicate index `c2f`. This is deprecated and will be disallowed in a future release
ALTER TABLE t1 CHANGE c2 c22f INT;
SELECT name, count FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem = 'ddl';
name count
ddl_background_drop_indexes 0
Expand Down
6 changes: 1 addition & 5 deletions mysql-test/suite/innodb/t/innodb-index-online.test
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,7 @@ connection con1;
# Accumulate and apply some modification log.
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL c2f_created WAIT_FOR dml3_done';
--send
# FIXME: MDEV-13668
#ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;
ALTER TABLE t1 ADD INDEX c2f(c2);
ALTER TABLE t1 ADD INDEX c2f(c22f), CHANGE c2 c22f INT;

connection default;
SET DEBUG_SYNC = 'now WAIT_FOR c2f_created';
Expand All @@ -338,8 +336,6 @@ SET DEBUG_SYNC = 'now SIGNAL dml3_done';

connection con1;
reap;
# FIXME: MDEV-13668
ALTER TABLE t1 CHANGE c2 c22f INT;

eval $innodb_metrics_select;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ EOF
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1 WHERE PK = 1;

# We will disable also purge, to not let it request the corrupted page.
let $restart_parameters=--innodb-force-recovery=2;
# Force recovery to ignore the corrupted page.
let $restart_parameters=--innodb-force-recovery=1;
--source include/restart_mysqld.inc
SELECT * FROM t1 WHERE PK = 1;
--error ER_NOT_KEYFILE
SELECT * FROM t1 WHERE pk = 12;
CHECK TABLE t1;

DROP TABLE t1;
let $restart_parameters=;
--source include/restart_mysqld.inc
14 changes: 14 additions & 0 deletions mysql-test/suite/innodb_fts/r/misc_debug2.result
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,17 @@ INSERT INTO mdev21563 VALUES('This is a test');
ALTER TABLE mdev21563 DISCARD TABLESPACE;
# restart
DROP TABLE mdev21563;
#
# MDEV-29342 Assertion failure in file que0que.cc line 728
#
CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('mysql'), ('innodb');
set debug_dbug="+d,fts_instrument_sync_debug";
INSERT INTO t1 VALUES('test');
set debug_dbug="-d,fts_instrument_sync_debug";
INSERT INTO t1 VALUES('This is a fts issue');
# restart
set debug_dbug="+d,fts_instrument_sync_debug";
UPDATE t1 SET f1="mariadb";
set debug_dbug="-d,fts_instrument_sync_debug";
DROP TABLE t1;
15 changes: 15 additions & 0 deletions mysql-test/suite/innodb_fts/t/misc_debug2.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ INSERT INTO mdev21563 VALUES('This is a test');
ALTER TABLE mdev21563 DISCARD TABLESPACE;
--source include/restart_mysqld.inc
DROP TABLE mdev21563;

--echo #
--echo # MDEV-29342 Assertion failure in file que0que.cc line 728
--echo #
CREATE TABLE t1(f1 CHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('mysql'), ('innodb');
set debug_dbug="+d,fts_instrument_sync_debug";
INSERT INTO t1 VALUES('test');
set debug_dbug="-d,fts_instrument_sync_debug";
INSERT INTO t1 VALUES('This is a fts issue');
--source include/restart_mysqld.inc
set debug_dbug="+d,fts_instrument_sync_debug";
UPDATE t1 SET f1="mariadb";
set debug_dbug="-d,fts_instrument_sync_debug";
DROP TABLE t1;
39 changes: 39 additions & 0 deletions mysql-test/suite/rpl/r/rpl_filter_revoke_missing_user.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include/master-slave.inc
[connection master]
#
# Set replica to ignore system tables
connection slave;
include/stop_slave.inc
SET @@GLOBAL.replicate_wild_ignore_table="mysql.%";
include/start_slave.inc
#
# Trying to execute REVOKE ALL PRIVILEGES on a non-existent user and
# DROP USER on a list of users where not all users exist should error
# and be written into the binary log
connection master;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistentuser'@'%';
ERROR HY000: Can't revoke all privileges for one or more of the requested users
CREATE USER 'testuser'@'localhost' IDENTIFIED by '';
DROP USER 'testuser'@'localhost', 'nonexistentuser'@'%';
ERROR HY000: Operation DROP USER failed for 'nonexistentuser'@'%'
#
# Ensure the events exist in the primary's binary log
FLUSH BINARY LOGS;
# MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/mysqlbinlog_out.sql
# There should be three Query events: REVOKE, CREATE USER, and DROP USER
FOUND 3 /Query/ in mysqlbinlog_out.sql
FOUND 1 /REVOKE ALL PRIVILEGES/ in mysqlbinlog_out.sql
FOUND 1 /CREATE USER/ in mysqlbinlog_out.sql
FOUND 1 /DROP USER/ in mysqlbinlog_out.sql
#
# Ensure that the replica receives the event without error
connection slave;
Last_SQL_Error =
Last_SQL_Errno = 0
#
# Clean up
connection slave;
include/stop_slave.inc
SET @@GLOBAL.replicate_wild_ignore_table="";
include/start_slave.inc
include/rpl_end.inc
92 changes: 92 additions & 0 deletions mysql-test/suite/rpl/t/rpl_filter_revoke_missing_user.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# Purpose:
# This test ensures that a binlogged Query_log_event which failed on the
# primary server does not break replication if it is ignored by Grant_tables
# on the replica. The bug reported by MDEV-28530 shows this with
# REVOKE ALL PRIVILEGES.. using a non-existent user. The primary will binlog
# the REVOKE command with an error code, and the replica will think the command
# executed with success because the replication filter will ignore the command
# while accessing the Grant_tables classes. When the replica performs an error
# check, it sees the difference between the error codes, and replication
# breaks.
#
# Methodology:
# Using a replica configured with replicate_wild_ignore_table="schema.%",
# on the primary, execute REVOKE ALL PRVILEGES using a non-existent user and
# DROP USER using a list of users where not all users exist, and ensure that
# the replica acknowledges and ignores the events without erroring.
#
# References:
# MDEV-28530: Revoking privileges from a non-existing user on a master breaks
# replication on the slave in the presence of replication filters
#

source include/master-slave.inc;
source include/have_binlog_format_statement.inc;

--echo #
--echo # Set replica to ignore system tables
connection slave;
let $old_filter= query_get_value(SHOW SLAVE STATUS, Replicate_Wild_Ignore_Table, 1);
source include/stop_slave.inc;
SET @@GLOBAL.replicate_wild_ignore_table="mysql.%";
source include/start_slave.inc;


--echo #
--echo # Trying to execute REVOKE ALL PRIVILEGES on a non-existent user and
--echo # DROP USER on a list of users where not all users exist should error
--echo # and be written into the binary log
--connection master

--error 1269
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'nonexistentuser'@'%';

CREATE USER 'testuser'@'localhost' IDENTIFIED by '';
--error 1396
DROP USER 'testuser'@'localhost', 'nonexistentuser'@'%';
--save_master_pos


--echo #
--echo # Ensure the events exist in the primary's binary log
--let $MYSQLD_DATADIR= `select @@datadir`
--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH BINARY LOGS;
--echo # MYSQL_BINLOG MYSQLD_DATADIR/binlog_file > MYSQL_TMP_DIR/mysqlbinlog_out.sql
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQL_TMP_DIR/mysqlbinlog_out.sql

--echo # There should be three Query events: REVOKE, CREATE USER, and DROP USER
--let SEARCH_FILE= $MYSQL_TMP_DIR/mysqlbinlog_out.sql

--let SEARCH_PATTERN= Query
--source include/search_pattern_in_file.inc

--let SEARCH_PATTERN= REVOKE ALL PRIVILEGES
--source include/search_pattern_in_file.inc

--let SEARCH_PATTERN= CREATE USER
--source include/search_pattern_in_file.inc

--let SEARCH_PATTERN= DROP USER
--source include/search_pattern_in_file.inc


--echo #
--echo # Ensure that the replica receives the event without error
connection slave;
--sync_with_master
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo Last_SQL_Error = $error
let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
--echo Last_SQL_Errno = $errno


--echo #
--echo # Clean up
--connection slave
source include/stop_slave.inc;
--eval SET @@GLOBAL.replicate_wild_ignore_table="$old_filter"
source include/start_slave.inc;

--source include/rpl_end.inc
14 changes: 7 additions & 7 deletions plugin/disks/information_schema_disks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static int disks_table_add_row_stat(
#else
if (info.f_flags & MNT_RDONLY)
#endif
return 0;
return 0;

pTable->field[0]->store(zDisk, strlen(zDisk), system_charset_info);
pTable->field[1]->store(zPath, strlen(zPath), system_charset_info);
Expand Down Expand Up @@ -214,15 +214,15 @@ static int disks_fill_table(THD* pThd, TABLE_LIST* pTables, Item* pCond)
)
{
struct stat f;
const char *path, *point;
const char *path, *point;
#ifdef HAVE_SETMNTENT
path= pEnt->mnt_dir;
point= pEnt->mnt_fsname;
path= pEnt->mnt_dir;
point= pEnt->mnt_fsname;
#else
path= pEnt->mnt_mountp;
point= pEnt->mnt_special;
path= pEnt->mnt_mountp;
point= pEnt->mnt_special;
#endif
// Try to keep to real storage by excluding
// Try to keep to real storage by excluding
// read only mounts, and mount points that aren't directories
if (hasmntopt(pEnt, MNTOPT_RO) != NULL)
continue;
Expand Down
7 changes: 7 additions & 0 deletions sql/log_event_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1921,6 +1921,13 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
thd->update_server_status();
log_slow_statement(thd);
thd->lex->restore_set_statement_var();

/*
When THD::slave_expected_error gets reset inside execution stack
that is the case of to be ignored event. In this case the expected
error must change to the reset value as well.
*/
expected_error= thd->slave_expected_error;
}

thd->variables.option_bits&= ~OPTION_MASTER_SQL_ERROR;
Expand Down
7 changes: 4 additions & 3 deletions sql/share/errmsg-utf8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7535,9 +7535,10 @@ ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS
eng "Statement is unsafe because it accesses a non-transactional table after accessing a transactional table within the same transaction"
spa "La sentencia no es segura porque accede a una tabla no transaccional tras acceder a una transaccional dentro de la misma transacción"
ER_MESSAGE_AND_STATEMENT
chi "%s语句:%s"
eng "%s Statement: %s"
spa "%s Sentencia: %s"
chi "%s.语句:%s"
eng "%s. Statement: %s"
spa "%s. Sentencia: %s"

ER_SLAVE_CONVERSION_FAILED
chi "列%d表'%-.192s.%-.192s'无法从'%-.50s'类型为'%-.50s'"
eng "Column %d of table '%-.192s.%-.192s' cannot be converted from type '%-.50s' to type '%-.50s'"
Expand Down
4 changes: 3 additions & 1 deletion sql/sql_acl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2094,9 +2094,11 @@ class Grant_tables
some kind of updates to the mysql.% tables.
*/
Rpl_filter *rpl_filter= thd->system_thread_info.rpl_sql_info->rpl_filter;

if (rpl_filter->is_on() && !rpl_filter->tables_ok(0, tables))
{
thd->slave_expected_error= 0;
DBUG_RETURN(1);
}
}
DBUG_RETURN(0);
}
Expand Down
2 changes: 2 additions & 0 deletions sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -3625,6 +3625,8 @@ class THD: public THD_count, /* this must be first */
/*
In case of a slave, set to the error code the master got when executing
the query. 0 if no error on the master.
The stored into variable master error code may get reset inside
execution stack when the event turns out to be ignored.
*/
int slave_expected_error;
enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command()
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/fts/fts0fts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@ fts_cmp_set_sync_doc_id(
}
mysql_mutex_unlock(&cache->doc_id_lock);

if (cmp_doc_id > *doc_id) {
if (cmp_doc_id && cmp_doc_id >= *doc_id) {
error = fts_update_sync_doc_id(
table, cache->synced_doc_id, trx);
}
Expand Down
5 changes: 3 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13478,11 +13478,12 @@ int ha_innobase::delete_table(const char *name)

if (table->is_temporary())
{
dict_sys.remove(table, false, true);
dict_sys.unlock();
parent_trx->mod_tables.erase(table); /* CREATE...SELECT error handling */
btr_drop_temporary_table(*table);
dict_mem_table_free(table);
dict_sys.lock(SRW_LOCK_CALL);
dict_sys.remove(table);
dict_sys.unlock();
DBUG_RETURN(0);
}

Expand Down
4 changes: 3 additions & 1 deletion storage/innobase/page/page0cur.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,9 @@ page_cur_insert_rec_low(
{
const byte *r= rec;
const byte *c= cur->rec;
const byte *c_end= c + (page_rec_is_infimum(c) ? 8 : data_size);
const byte *c_end= c + data_size;
if (page_rec_is_infimum(c) && data_size > 8)
c_end= c + 8;
static_assert(REC_N_OLD_EXTRA_BYTES == REC_N_NEW_EXTRA_BYTES + 1, "");
if (c <= insert_buf && c_end > insert_buf)
c_end= insert_buf;
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/trx/trx0undo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,8 @@ static void trx_undo_seg_free(const trx_undo_t *undo)
else if (buf_block_t* rseg_header = rseg->get(&mtr, nullptr))
{
static_assert(FIL_NULL == 0xffffffff, "compatibility");
memset(TRX_RSEG + TRX_RSEG_UNDO_SLOTS + undo->id * TRX_RSEG_SLOT_SIZE +
rseg_header->page.frame, 0xff, 4);
mtr.memset(rseg_header, TRX_RSEG + TRX_RSEG_UNDO_SLOTS +
undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff);
MONITOR_DEC(MONITOR_NUM_UNDO_SLOT_USED);
}
}
Expand Down

0 comments on commit 0c0b697

Please sign in to comment.