Merge 10.11 into 11.4

This commit is contained in:
Marko Mäkelä 2025-10-09 13:37:45 +03:00
commit 4ffa1ff4a7
55 changed files with 461 additions and 428 deletions

View file

@ -88,15 +88,6 @@ create role r1;
drop role r1;
rename table mysql.roles_mapping_bak to mysql.roles_mapping;
#
# MDEV-35622 SEGV, ASAN use-after-poison when reading system table with less than expected number of columns
#
call mtr.add_suppression("mysql.servers");
alter table mysql.servers drop column owner;
insert into mysql.servers values(0,0,0,0,0,0,0,0);
flush privileges;
ERROR HY000: Cannot load from mysql.servers. The table is probably corrupted
alter table mysql.servers add column Owner varchar(512) not null default '';
#
# MDEV-28482 SIGSEGV in get_access_value_from_val_int
#
create temporary table t1 select * from mysql.tables_priv;

View file

@ -104,16 +104,6 @@ create role r1;
drop role r1;
rename table mysql.roles_mapping_bak to mysql.roles_mapping;
--echo #
--echo # MDEV-35622 SEGV, ASAN use-after-poison when reading system table with less than expected number of columns
--echo #
call mtr.add_suppression("mysql.servers");
alter table mysql.servers drop column owner;
insert into mysql.servers values(0,0,0,0,0,0,0,0);
--error ER_CANNOT_LOAD_FROM_TABLE_V2
flush privileges;
alter table mysql.servers add column Owner varchar(512) not null default '';
--echo #
--echo # MDEV-28482 SIGSEGV in get_access_value_from_val_int
--echo #

View file

@ -2533,7 +2533,8 @@ name dl
# Check that mysql_upgrade can be run on mysqldump
# of mysql schema from previous versions
#
call mtr.add_suppression("innodb_(table|index)_stats has length mismatch in the column name table_name");
call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table `mysql`\\.`gtid_slave_pos` but the required system tables mysql\\.innodb_table_stats and mysql\\.innodb_index_stats are not present or have unexpected structure");
call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.table_name");
call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20.");
#
# Upgrade from version 5.5

View file

@ -540,7 +540,8 @@ SELECT * FROM mysql.plugin WHERE name='unix_socket';
--echo #
# The warning appears during mysql_upgrade, before the schema becomes consistent
call mtr.add_suppression("innodb_(table|index)_stats has length mismatch in the column name table_name");
call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table `mysql`\\.`gtid_slave_pos` but the required system tables mysql\\.innodb_table_stats and mysql\\.innodb_index_stats are not present or have unexpected structure");
call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.table_name");
# This comes from opening 10.6 sys.host_summary view that uses sys.format_time function,
# on still inconsistent mysql.proc, in older versions
call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 21, found 20.");

View file

@ -37,11 +37,14 @@ alter server s1 options(host 'server.example.org');
rename table mysql.servers to mysql.servers_save;
create table mysql.servers (x int);
alter server s1 options(host 'server.example.org');
ERROR HY000: The foreign server name you are trying to reference does not exist. Data source error: s1
ERROR HY000: Cannot load from mysql.servers. The table is probably corrupted
drop server s1;
ERROR HY000: Cannot load from mysql.servers. The table is probably corrupted
create server s2 foreign data wrapper foo options(user 'a');
ERROR HY000: Can't read record in system table
ERROR HY000: Cannot load from mysql.servers. The table is probably corrupted
drop table mysql.servers;
rename table mysql.servers_save to mysql.servers;
flush privileges;
drop server s1;
#
# MDEV-35641 foreign server "disappears" after ALTERing the servers system table to use innodb and FLUSH PRIVILEGES
@ -50,3 +53,54 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (HOST '127.0.0.1');
ALTER TABLE mysql.servers ENGINE=innodb;
FLUSH PRIVILEGES;
drop server s1;
#
# MDEV-35622 SEGV, ASAN use-after-poison when reading system table with less than expected number of columns
# MDEV-37777 upgrade from MySQL 5.7 regression, mysql.servers invalid structure
#
# no crash:
rename table mysql.servers to mysql.servers_save;
create table mysql.servers like mysql.servers_save;
alter table mysql.servers drop column owner;
insert into mysql.servers values(0,0,0,0,0,0,0,0);
flush privileges;
ERROR HY000: Cannot load from mysql.servers. The table is probably corrupted
drop table mysql.servers;
# w/o PK
create table mysql.servers like mysql.servers_save;
alter table mysql.servers drop primary key;
insert into mysql.servers values(0,0,0,0,0,0,0,0,0);
flush privileges;
ERROR HY000: Cannot load from mysql.servers. The table is probably corrupted
drop table mysql.servers;
# upgrade is ok
create table mysql.servers like mysql.servers_save;
alter table mysql.servers add column Options text;
create server s1 foreign data wrapper mysql options (host '127.0.0.1');
flush privileges;
drop server s1;
drop table mysql.servers;
# MySQL 5.7 (MDEV-37777)
create table mysql.servers like mysql.servers_save;
alter table mysql.servers modify Host char(64) not null, modify Owner char(64) not null;
create server s1 foreign data wrapper mysql options (host '127.0.0.1');
flush privileges;
drop server s1;
drop table mysql.servers;
rename table mysql.servers_save to mysql.servers;
# plugin
create table mysql.plugin_save like mysql.plugin;
alter table mysql.plugin drop column dl;
install soname "ha_example";
ERROR HY000: Cannot load from mysql.plugin. The table is probably corrupted
uninstall soname "ha_example";
ERROR HY000: Cannot load from mysql.plugin. The table is probably corrupted
drop table mysql.plugin;
create table mysql.plugin like mysql.plugin_save;
alter table mysql.plugin drop primary key;
install soname "ha_example";
ERROR HY000: Cannot load from mysql.plugin. The table is probably corrupted
uninstall soname "ha_example";
ERROR HY000: Cannot load from mysql.plugin. The table is probably corrupted
drop table mysql.plugin;
rename table mysql.plugin_save to mysql.plugin;
# End of 10.11 tests

View file

@ -34,12 +34,15 @@ create server s1 foreign data wrapper foo options(user 'a');
alter server s1 options(host 'server.example.org');
rename table mysql.servers to mysql.servers_save;
create table mysql.servers (x int);
--error ER_FOREIGN_SERVER_DOESNT_EXIST
--error ER_CANNOT_LOAD_FROM_TABLE_V2
alter server s1 options(host 'server.example.org');
--error ER_CANT_FIND_SYSTEM_REC
--error ER_CANNOT_LOAD_FROM_TABLE_V2
drop server s1;
--error ER_CANNOT_LOAD_FROM_TABLE_V2
create server s2 foreign data wrapper foo options(user 'a');
drop table mysql.servers;
rename table mysql.servers_save to mysql.servers;
flush privileges;
drop server s1;
--echo #
@ -50,3 +53,61 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (HOST '127.0.0.1');
ALTER TABLE mysql.servers ENGINE=innodb;
FLUSH PRIVILEGES;
drop server s1;
--echo #
--echo # MDEV-35622 SEGV, ASAN use-after-poison when reading system table with less than expected number of columns
--echo # MDEV-37777 upgrade from MySQL 5.7 regression, mysql.servers invalid structure
--echo #
--echo # no crash:
rename table mysql.servers to mysql.servers_save;
create table mysql.servers like mysql.servers_save;
alter table mysql.servers drop column owner;
insert into mysql.servers values(0,0,0,0,0,0,0,0);
--error ER_CANNOT_LOAD_FROM_TABLE_V2
flush privileges;
drop table mysql.servers;
--echo # w/o PK
create table mysql.servers like mysql.servers_save;
alter table mysql.servers drop primary key;
insert into mysql.servers values(0,0,0,0,0,0,0,0,0);
--error ER_CANNOT_LOAD_FROM_TABLE_V2
flush privileges;
drop table mysql.servers;
--echo # upgrade is ok
create table mysql.servers like mysql.servers_save;
alter table mysql.servers add column Options text;
create server s1 foreign data wrapper mysql options (host '127.0.0.1');
flush privileges;
drop server s1;
drop table mysql.servers;
--echo # MySQL 5.7 (MDEV-37777)
create table mysql.servers like mysql.servers_save;
alter table mysql.servers modify Host char(64) not null, modify Owner char(64) not null;
create server s1 foreign data wrapper mysql options (host '127.0.0.1');
flush privileges;
drop server s1;
drop table mysql.servers;
rename table mysql.servers_save to mysql.servers;
--echo # plugin
create table mysql.plugin_save like mysql.plugin;
alter table mysql.plugin drop column dl;
--error ER_CANNOT_LOAD_FROM_TABLE_V2
install soname "ha_example";
--error ER_CANNOT_LOAD_FROM_TABLE_V2
uninstall soname "ha_example";
drop table mysql.plugin;
create table mysql.plugin like mysql.plugin_save;
alter table mysql.plugin drop primary key;
--error ER_CANNOT_LOAD_FROM_TABLE_V2
install soname "ha_example";
--error ER_CANNOT_LOAD_FROM_TABLE_V2
uninstall soname "ha_example";
drop table mysql.plugin;
rename table mysql.plugin_save to mysql.plugin;
--echo # End of 10.11 tests

View file

@ -0,0 +1,31 @@
RESET MASTER;
connect con1,localhost,root,,;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TRIGGER tr BEFORE UPDATE ON t1 FOR EACH ROW BEGIN END;
LOCK TABLES t1 WRITE;
LOAD DATA INFILE 'x' INTO TABLE x;
ERROR HY000: Table 'x' was not locked with LOCK TABLES
SET AUTOCOMMIT= OFF;
INSERT INTO t1 VALUES (1);
SAVEPOINT A;
COMMIT;
disconnect con1;
connect con2,localhost,root,,;
SELECT 1;
1
1
disconnect con2;
connection default;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) ENGINE=InnoDB
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` TRIGGER tr BEFORE UPDATE ON t1 FOR EACH ROW BEGIN END
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (1)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # SAVEPOINT `A`
master-bin.000001 # Xid # # COMMIT /* XID */
DROP TABLE t1;

View file

@ -0,0 +1,33 @@
--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
RESET MASTER;
# This sequence of statements triggered a bug, where the pending LOCK TABLES
# would skip flusing the pending row event for INSERT to the trx cache. And
# Then the pending event would be overwritten by the SAVEPOINT, leaving an
# invalid state in the THD. And then a later connection would pick the THD
# with invalid state and trigger an assertion.
--connect (con1,localhost,root,,)
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TRIGGER tr BEFORE UPDATE ON t1 FOR EACH ROW BEGIN END;
LOCK TABLES t1 WRITE;
--error ER_TABLE_NOT_LOCKED
LOAD DATA INFILE 'x' INTO TABLE x;
SET AUTOCOMMIT= OFF;
INSERT INTO t1 VALUES (1);
SAVEPOINT A;
COMMIT;
--disconnect con1
--connect (con2,localhost,root,,)
SELECT 1;
# Cleanup
--disconnect con2
--connection default
# Show the binlog events.
# When the bug occurs, the Write_rows event is missing STMT_END_F.
--source include/show_binlog_events.inc
DROP TABLE t1;

View file

@ -1,31 +0,0 @@
connection node_2;
connection node_1;
SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%';
expect 0
0
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_2;
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
VARIABLE_VALUE = 'Synced'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_1;
SET GLOBAL wsrep_provider_options = "socket.ssl_compression=No";
ERROR HY000: Incorrect arguments to SET
CREATE TABLE t1 (f1 VARCHAR(333) PRIMARY KEY, f2 BLOB) Engine=InnoDB;
INSERT INTO t1 VALUES (REPEAT('a', 333), REPEAT('b', 65535));
connection node_2;
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('a', 333) AND f2 = REPEAT('b', 65535);
COUNT(*) = 1
1
connection node_1;
DROP TABLE t1;
CALL mtr.add_suppression("Unknown parameter 'socket\\.ssl_compression'");
CALL mtr.add_suppression("Set options returned 7");

View file

@ -14,6 +14,7 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_perfschema.inc
--echo #
--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and DELETE on t1

View file

@ -14,6 +14,7 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_perfschema.inc
--echo #
--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t4 and INSERT t1

View file

@ -14,6 +14,7 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_perfschema.inc
--echo #
--echo # 1. BF-BF conflict on MDL locks between: DROP TABLE t6 and UPDATE on t1

View file

@ -1,7 +0,0 @@
!include ../galera_2nodes.cnf
[mysqld.1]
wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'
[mysqld.2]
wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M'

View file

@ -1,39 +0,0 @@
#
# Test SSL compression. The accompanying galera_ssl_compression.cnf has a customized wsrep_provider_options setting that enables SSL and compression.
#
# Unfortunately there is no wire-level traffic bytes counter that would allow us to determine that compression kicked in, so we can only
# perform a most basic replication check.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/big_test.inc
--source include/have_perfschema.inc
# Verify that SSL is handled by the provider.
SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%';
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_2
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
# Check that the socket.ssl_compression provider option is not dynamic
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_provider_options = "socket.ssl_compression=No";
CREATE TABLE t1 (f1 VARCHAR(333) PRIMARY KEY, f2 BLOB) Engine=InnoDB;
INSERT INTO t1 VALUES (REPEAT('a', 333), REPEAT('b', 65535));
--connection node_2
SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('a', 333) AND f2 = REPEAT('b', 65535);
--connection node_1
DROP TABLE t1;
CALL mtr.add_suppression("Unknown parameter 'socket\\.ssl_compression'");
CALL mtr.add_suppression("Set options returned 7");

View file

@ -9,6 +9,7 @@
--source include/have_ssl_communication.inc
--source include/have_openssl.inc
--source include/force_restart.inc
--source include/have_perfschema.inc
# Verify that SSL is handled by the provider.
SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%';

View file

@ -4,6 +4,7 @@
# that replicas survive and the primary (trx source) bails out.
#
--source include/galera_cluster.inc
--source include/have_perfschema.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 BLOB) ENGINE=InnoDB;

View file

@ -530,3 +530,16 @@ INDEX_TYPE BTREE
COMMENT
INDEX_COMMENT
IGNORED NO
#
# MDEV-31740 InnoDB statistics column length validation failed
#
call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.last_update");
ALTER TABLE mysql.innodb_table_stats MODIFY LAST_UPDATE DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
CREATE TABLE t (a INT KEY)Engine=InnoDB STATS_PERSISTENT=1;
FOUND 1 /InnoDB: Unexpected length of mysql\.innodb_table_stats\.last_update/ in mysqld.1.err
ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
CREATE TABLE t2(a INT KEY)ENGINE=InnoDB STATS_PERSISTENT= 1;
SELECT table_name FROM mysql.innodb_table_stats;
table_name
t2
DROP TABLE t, t2;

View file

@ -1,6 +1,6 @@
call mtr.add_suppression("InnoDB: Table .*innodb_index_stats.* not found");
call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table .*");
call mtr.add_suppression("InnoDB: Table mysql\\.innodb_index_stats has length mismatch in the column name stat_description\\. Please run mariadb-upgrade");
call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_index_stats\\.stat_description");
call mtr.add_suppression("InnoDB: Column stat_description in table mysql\\.innodb_index_stats is VARCHAR");
ALTER TABLE mysql.innodb_index_stats RENAME TO mysql.innodb_index_stats_;
CREATE TABLE test_ps_create_on_corrupted

View file

@ -3,6 +3,7 @@
#
-- source include/have_innodb.inc
-- source include/not_embedded.inc
-- disable_warnings
-- disable_query_log
@ -63,3 +64,17 @@ CREATE TABLE test_innodb_stats (
-- disable_query_log
DROP TABLE test_innodb_stats;
set @@use_stat_tables= @save_use_stat_tables;
--enable_query_log
--echo #
--echo # MDEV-31740 InnoDB statistics column length validation failed
--echo #
call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.last_update");
ALTER TABLE mysql.innodb_table_stats MODIFY LAST_UPDATE DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
CREATE TABLE t (a INT KEY)Engine=InnoDB STATS_PERSISTENT=1;
let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Unexpected length of mysql\\.innodb_table_stats\\.last_update;
--source include/search_pattern_in_file.inc
ALTER TABLE mysql.innodb_table_stats MODIFY last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP();
CREATE TABLE t2(a INT KEY)ENGINE=InnoDB STATS_PERSISTENT= 1;
SELECT table_name FROM mysql.innodb_table_stats;
DROP TABLE t, t2;

View file

@ -12,7 +12,7 @@
call mtr.add_suppression("InnoDB: Table .*innodb_index_stats.* not found");
call mtr.add_suppression("InnoDB: Fetch of persistent statistics requested for table .*");
call mtr.add_suppression("InnoDB: Table mysql\\.innodb_index_stats has length mismatch in the column name stat_description\\. Please run mariadb-upgrade");
call mtr.add_suppression("InnoDB: Unexpected length of mysql\\.innodb_index_stats\\.stat_description");
call mtr.add_suppression("InnoDB: Column stat_description in table mysql\\.innodb_index_stats is VARCHAR");
-- vertical_results

View file

@ -0,0 +1,19 @@
include/master-slave.inc
[connection master]
create table t (a int, key(a)) partition by range (a) (
partition p0 values less than (10),
partition p1 values less than (100)
);
insert into t values (5),(50);
connection slave;
flush tables;
connection master;
repair table t;
Table Op Msg_type Msg_text
test.t repair status OK
connection slave;
SET STATEMENT sql_log_bin=0 FOR
CALL mtr.add_suppression('[[]Warning[]] Moved 1 misplaced rows');
connection master;
DROP TABLE t;
include/rpl_end.inc

View file

@ -0,0 +1,17 @@
include/master-slave.inc
[connection master]
connection slave;
SET @old_format= @@GLOBAL.binlog_row_image;
SET GLOBAL binlog_row_image=MINIMAL;
include/stop_slave.inc
include/start_slave.inc
SET GLOBAL binlog_row_image= @old_format;
connection default;
SET SESSION binlog_row_image=MINIMAL;
CREATE TABLE t (id INT AUTO_INCREMENT, col_int BIGINT NOT NULL, UNIQUE (col_int), KEY(id)) ENGINE=InnoDB;
INSERT INTO t VALUES (1,1);
UPDATE t SET id = 2;
connection slave;
connection master;
DROP TABLE t;
include/rpl_end.inc

View file

@ -0,0 +1,31 @@
--source include/have_partition.inc
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
create table t (a int, key(a)) partition by range (a) (
partition p0 values less than (10),
partition p1 values less than (100)
);
insert into t values (5),(50);
--sync_slave_with_master
# Simulate rows ending up in wrong partitions, to make REPAIR have
# something to do.
# The bug was that the repair was reported as ERROR in the error log on the
# slave (it should be WARNING like in the interactive session on the master).
flush tables;
--let $datadir= `select @@datadir`
--move_file $datadir/test/t#P#p0.MYD $datadir/test/tmp
--move_file $datadir/test/t#P#p1.MYD $datadir/test/t#P#p0.MYD
--move_file $datadir/test/tmp $datadir/test/t#P#p1.MYD
--connection master
repair table t;
--sync_slave_with_master
SET STATEMENT sql_log_bin=0 FOR
CALL mtr.add_suppression('[[]Warning[]] Moved 1 misplaced rows');
--connection master
DROP TABLE t;
--source include/rpl_end.inc

View file

@ -0,0 +1,23 @@
--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--connection slave
SET @old_format= @@GLOBAL.binlog_row_image;
SET GLOBAL binlog_row_image=MINIMAL;
--source include/stop_slave.inc
--source include/start_slave.inc
SET GLOBAL binlog_row_image= @old_format;
--connection default
SET SESSION binlog_row_image=MINIMAL;
CREATE TABLE t (id INT AUTO_INCREMENT, col_int BIGINT NOT NULL, UNIQUE (col_int), KEY(id)) ENGINE=InnoDB;
INSERT INTO t VALUES (1,1);
UPDATE t SET id = 2;
--sync_slave_with_master
# Cleanup
--connection master
DROP TABLE t;
--source include/rpl_end.inc

View file

@ -498,11 +498,16 @@ void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
{
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end= map->last_word_ptr;
DBUG_ASSERT_IDENTICAL_BITMAPS(map,map2);
my_bitmap_map *to= map->bitmap, *from= map2->bitmap, *end;
uint len= no_words_in_map(map), len2= no_words_in_map(map2);
uint32 num_bits= MY_MIN(map->n_bits, map2->n_bits);
DBUG_ASSERT_DIFFERENT_BITMAPS(map,map2);
while (to <= end)
end= to + MY_MIN(len, len2) - 1;
while (to < end)
*to++ |= *from++;
*to|= *from & ~last_bit_mask(num_bits); /* Omit last not relevant bits */
}

View file

@ -1430,13 +1430,11 @@ int ha_partition::handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
(modelled after mi_check_print_msg)
TODO: move this into the handler, or rewrite mysql_admin_table.
*/
bool print_admin_msg(THD* thd, uint len,
const LEX_CSTRING *msg_type,
bool print_admin_msg(THD* thd, uint len, bool as_error,
const char* db_name, String &table_name,
const LEX_CSTRING *op_name, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 7, 8);
bool print_admin_msg(THD* thd, uint len,
const LEX_CSTRING *msg_type,
bool print_admin_msg(THD* thd, uint len, bool as_error,
const char* db_name, String &table_name,
const LEX_CSTRING *op_name, const char *fmt, ...)
{
@ -1447,6 +1445,7 @@ bool print_admin_msg(THD* thd, uint len,
char name[NAME_LEN*2+2];
char *msgbuf;
bool error= true;
const LEX_CSTRING *msg_type= as_error ? &msg_error : &msg_warning;
if (!(msgbuf= (char*) my_malloc(key_memory_Partition_admin, len, MYF(0))))
return true;
@ -1460,7 +1459,10 @@ bool print_admin_msg(THD* thd, uint len,
if (!thd->vio_ok())
{
sql_print_error("%s", msgbuf);
if (as_error)
sql_print_error("%s", msgbuf);
else
sql_print_warning("%s", msgbuf);
goto err;
}
@ -1482,8 +1484,12 @@ bool print_admin_msg(THD* thd, uint len,
protocol->store(msgbuf, msg_length, system_charset_info);
if (protocol->write())
{
sql_print_error("Failed on my_net_write, writing to stderr instead: %s",
msgbuf);
if (as_error)
sql_print_error("Failed on my_net_write, writing to stderr instead: %s",
msgbuf);
else
sql_print_warning("Failed on my_net_write, writing to stderr instead: %s",
msgbuf);
goto err;
}
error= false;
@ -1547,7 +1553,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
error != HA_ADMIN_TRY_ALTER &&
error != HA_ERR_TABLE_READONLY)
{
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, &msg_error,
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, true,
table_share->db.str, table->alias,
&opt_op_name[flag],
"Subpartition %s returned error",
@ -1574,7 +1580,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
error != HA_ADMIN_ALREADY_DONE &&
error != HA_ADMIN_TRY_ALTER)
{
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, &msg_error,
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, true,
table_share->db.str, table->alias,
&opt_op_name[flag], "Partition %s returned error",
part_elem->partition_name);
@ -11369,7 +11375,7 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
if (num_misplaced_rows > 0)
{
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_warning,
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, false,
table_share->db.str, table->alias,
&opt_op_name[REPAIR_PARTS],
"Moved %lld misplaced rows",
@ -11391,7 +11397,7 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
if (!do_repair)
{
/* Check. */
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_error,
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, true,
table_share->db.str, table->alias,
&opt_op_name[CHECK_PARTS],
"Found a misplaced row");
@ -11440,7 +11446,7 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
(uint) correct_part_id,
str.c_ptr_safe());
}
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_error,
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, true,
table_share->db.str, table->alias,
&opt_op_name[REPAIR_PARTS],
"Failed to move/insert a row"
@ -11567,7 +11573,7 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
!(part_buf= generate_partition_syntax_for_frm(thd, m_part_info,
&part_buf_len,
NULL, NULL)) ||
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, &msg_error,
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, true,
table_share->db.str,
table->alias,
&opt_op_name[CHECK_PARTS],
@ -11577,7 +11583,7 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
part_buf))
{
/* Error creating admin message (too long string?). */
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, &msg_error,
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, true,
table_share->db.str, table->alias,
&opt_op_name[CHECK_PARTS],
KEY_PARTITIONING_CHANGED_STR,

View file

@ -5110,7 +5110,11 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
{
bitmap_intersect(table->read_set,&m_cols);
if (get_general_type_code() == UPDATE_ROWS_EVENT)
{
/* Must read also after-image columns to be able to update them. */
bitmap_union(m_table->read_set, &m_cols_ai);
bitmap_intersect(table->write_set, &m_cols_ai);
}
table->mark_columns_per_binlog_row_image();
if (table->vfield)
table->mark_virtual_columns_for_write(0);

View file

@ -973,6 +973,8 @@ int close_thread_tables(THD *thd)
if (thd->locked_tables_mode == LTM_LOCK_TABLES)
{
if (thd->lock)
(void)thd->binlog_flush_pending_rows_event(TRUE);
error= 0;
goto end;
}

View file

@ -5837,11 +5837,12 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
if ((err_code= drop_server(thd, &lex->server_options)))
{
if (! lex->if_exists() && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST)
if (! lex->if_exists() || err_code != ER_FOREIGN_SERVER_DOESNT_EXIST)
{
DBUG_PRINT("info", ("problem dropping server %s",
lex->server_options.server_name.str));
my_error(err_code, MYF(0), lex->server_options.server_name.str);
if (!thd->is_error())
my_error(err_code, MYF(0), lex->server_options.server_name.str);
}
else
{

View file

@ -73,6 +73,8 @@ ulong plugin_maturity;
static LEX_CSTRING MYSQL_PLUGIN_NAME= {STRING_WITH_LEN("plugin") };
enum mysql_plugin_fields { PLUGIN_NAME, PLUGIN_SONAME, PLUGIN_FIELDS_COUNT };
/*
not really needed now, this map will become essential when we add more
maturity levels. We cannot change existing maturity constants,
@ -1873,6 +1875,19 @@ static bool register_builtin(struct st_maria_plugin *plugin,
}
static bool plugin_table_is_valid(TABLE *table)
{
if (table->s->fields < PLUGIN_FIELDS_COUNT ||
table->s->primary_key == MAX_KEY)
{
my_error(ER_CANNOT_LOAD_FROM_TABLE_V2, MYF(0),
table->s->db.str, table->s->table_name.str);
return false;
}
return true;
}
/*
called only by plugin_init()
*/
@ -1918,6 +1933,9 @@ static void plugin_load(MEM_ROOT *tmp_root)
goto end;
}
if (!plugin_table_is_valid(table))
goto end2;
if (init_read_record(&read_record_info, new_thd, table, NULL, NULL, 1, 0,
FALSE))
{
@ -1929,6 +1947,8 @@ static void plugin_load(MEM_ROOT *tmp_root)
while (!(error= read_record_info.read_record()))
{
DBUG_PRINT("info", ("init plugin record"));
static_assert(PLUGIN_NAME == 0, "");
static_assert(PLUGIN_SONAME == 1, "");
DBUG_ASSERT(new_thd == table->field[0]->get_thd());
DBUG_ASSERT(new_thd == table->field[1]->get_thd());
DBUG_ASSERT(!(new_thd->variables.sql_mode & MODE_PAD_CHAR_TO_FULL_LENGTH));
@ -1978,6 +1998,7 @@ static void plugin_load(MEM_ROOT *tmp_root)
sql_print_error(ER_THD(new_thd, ER_GET_ERRNO), my_errno,
table->file->table_type());
end_read_record(&read_record_info);
end2:
table->mark_table_for_reopen();
close_mysql_tables(new_thd);
end:
@ -2249,9 +2270,8 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_CSTRING *name,
DBUG_ASSERT(!table->file->row_logging);
table->use_all_columns();
restore_record(table, s->default_values);
table->field[0]->store(name->str, name->length, system_charset_info);
table->field[1]->store(tmp->plugin_dl->dl.str, tmp->plugin_dl->dl.length,
files_charset_info);
table->field[PLUGIN_NAME]->store(name->str, name->length, system_charset_info);
table->field[PLUGIN_SONAME]->store(&tmp->plugin_dl->dl, files_charset_info);
error= table->file->ha_write_row(table->record[0]);
if (unlikely(error))
{
@ -2281,8 +2301,8 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/* need to open before acquiring LOCK_plugin or it will deadlock */
if (! (table = open_ltable(thd, &tables, TL_WRITE,
MYSQL_LOCK_IGNORE_TIMEOUT)))
table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
if (!table || !plugin_table_is_valid(table))
DBUG_RETURN(TRUE);
if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL))
@ -2390,7 +2410,7 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
uchar user_key[MAX_KEY_LENGTH];
table->use_all_columns();
table->field[0]->store(name->str, name->length, system_charset_info);
table->field[PLUGIN_NAME]->store(name->str, name->length, system_charset_info);
key_copy(user_key, table->record[0], table->key_info,
table->key_info->key_length);
if (! table->file->ha_index_read_idx_map(table->record[0], 0, user_key,
@ -2439,19 +2459,10 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_CSTRING *name,
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/* need to open before acquiring LOCK_plugin or it will deadlock */
if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
if (!table || !plugin_table_is_valid(table))
DBUG_RETURN(TRUE);
if (!table->key_info)
{
my_printf_error(ER_UNKNOWN_ERROR,
"The table %s.%s has no primary key. "
"Please check the table definition and "
"create the primary key accordingly.", MYF(0),
table->s->db.str, table->s->table_name.str);
DBUG_RETURN(TRUE);
}
/*
Pre-acquire audit plugins for events that may potentially occur
during [UN]INSTALL PLUGIN.

View file

@ -80,9 +80,9 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
DBUG_ASSERT(!thd || !thd->in_sub_stmt);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (options & REFRESH_GRANT)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
THD *tmp_thd= 0;
/*
If reload_acl_and_cache() is called from SIGHUP handler we have to
@ -128,8 +128,11 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options,
thd= 0;
}
reset_mqh((LEX_USER *)NULL, TRUE);
}
#else
if ((result= thd && servers_reload(thd)))
my_error(ER_UNKNOWN_ERROR, MYF(0));
#endif
}
if (options & REFRESH_LOG)
{
/*

View file

@ -56,60 +56,11 @@ static MEM_ROOT mem;
static mysql_rwlock_t THR_LOCK_servers;
static LEX_CSTRING MYSQL_SERVERS_NAME= {STRING_WITH_LEN("servers") };
static const TABLE_FIELD_TYPE servers_table_fields[] =
{
{
{ STRING_WITH_LEN("Server_name") },
{ STRING_WITH_LEN("char(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Host") },
{ STRING_WITH_LEN("varchar(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Db") },
{ STRING_WITH_LEN("char(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Username") },
{ STRING_WITH_LEN("char(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Password") },
{ STRING_WITH_LEN("char(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Port") },
{ STRING_WITH_LEN("int(") },
{NULL, 0}
},
{
{ STRING_WITH_LEN("Socket") },
{ STRING_WITH_LEN("char(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Wrapper") },
{ STRING_WITH_LEN("char(") },
{ STRING_WITH_LEN("utf8mb") }
},
{
{ STRING_WITH_LEN("Owner") },
{ STRING_WITH_LEN("varchar(") },
{ STRING_WITH_LEN("utf8mb") }
}
enum servers_fields {
SERVER_NAME_FIELD, HOST_FIELD, DB_FIELD, USERNAME_FIELD, PASSWORD_FIELD,
PORT_FIELD, SOCKET_FIELD, SCHEME_FIELD, OWNER_FIELD,
SERVERS_FIELDS_COUNT
};
static const TABLE_FIELD_DEF servers_table_def=
{
array_elements(servers_table_fields), servers_table_fields, 0, NULL
};
static Table_check_intact_log_error table_intact;
static bool get_server_from_table_to_cache(TABLE *table);
@ -349,8 +300,7 @@ static bool servers_load(THD *thd, TABLE_LIST *tables)
init_sql_alloc(key_memory_servers, &mem, ACL_ALLOC_BLOCK_SIZE, 0, MYF(0));
table->use_all_columns();
if (init_read_record(&read_record_info,thd,table, NULL, NULL,
1,0, FALSE))
if (init_read_record(&read_record_info,thd,table, NULL, NULL, 1,0, FALSE))
DBUG_RETURN(1);
while (!(read_record_info.read_record()))
{
@ -367,6 +317,20 @@ end:
}
static bool servers_table_is_valid(TABLE *table)
{
if (table->s->fields < SERVERS_FIELDS_COUNT ||
table->s->primary_key == MAX_KEY)
{
my_errno= 1;
my_error(ER_CANNOT_LOAD_FROM_TABLE_V2, MYF(0),
table->s->db.str, table->s->table_name.str);
return false;
}
return true;
}
/*
Forget current servers cache and read new servers
from the conneciton table.
@ -410,12 +374,8 @@ bool servers_reload(THD *thd)
goto end;
}
if (table_intact.check(tables.table, &servers_table_def))
{
my_error(ER_CANNOT_LOAD_FROM_TABLE_V2, MYF(0),
tables.db.str, tables.table_name.str);
if (!servers_table_is_valid(tables.table))
goto end;
}
if ((return_val= servers_load(thd, &tables)))
{ // Error. Revert to old list
@ -470,27 +430,27 @@ get_server_from_table_to_cache(TABLE *table)
DBUG_ENTER("get_server_from_table_to_cache");
/* get each field into the server struct ptr */
ptr= get_field(&mem, table->field[0]);
ptr= get_field(&mem, table->field[SERVER_NAME_FIELD]);
server->server_name= ptr ? ptr : blank;
server->server_name_length= (uint) strlen(server->server_name);
ptr= get_field(&mem, table->field[1]);
ptr= get_field(&mem, table->field[HOST_FIELD]);
server->host= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[2]);
ptr= get_field(&mem, table->field[DB_FIELD]);
server->db= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[3]);
ptr= get_field(&mem, table->field[USERNAME_FIELD]);
server->username= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[4]);
ptr= get_field(&mem, table->field[PASSWORD_FIELD]);
server->password= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[5]);
ptr= get_field(&mem, table->field[PORT_FIELD]);
server->sport= ptr ? ptr : blank;
server->port= server->sport ? atoi(server->sport) : 0;
ptr= get_field(&mem, table->field[6]);
ptr= get_field(&mem, table->field[SOCKET_FIELD]);
server->socket= ptr && strlen(ptr) ? ptr : blank;
ptr= get_field(&mem, table->field[7]);
ptr= get_field(&mem, table->field[SCHEME_FIELD]);
server->scheme= ptr ? ptr : blank;
ptr= get_field(&mem, table->field[8]);
ptr= get_field(&mem, table->field[OWNER_FIELD]);
server->owner= ptr ? ptr : blank;
DBUG_PRINT("info", ("server->server_name %s", server->server_name));
DBUG_PRINT("info", ("server->host %s", server->host));
@ -538,8 +498,10 @@ insert_server(THD *thd, FOREIGN_SERVER *server)
tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_SERVERS_NAME, 0, TL_WRITE);
/* need to open before acquiring THR_LOCK_plugin or it will deadlock */
if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
if (!table || !servers_table_is_valid(table))
goto end;
table->file->row_logging= 0; // Don't log to binary log
/* insert the server into the table */
@ -618,9 +580,6 @@ store_server_fields(TABLE *table, FOREIGN_SERVER *server)
table->use_all_columns();
if (table->s->fields < 9)
return ER_CANT_FIND_SYSTEM_REC;
/*
"server" has already been prepped by prepare_server_struct_for_<>
so, all we need to do is check if the value is set (> -1 for port)
@ -630,34 +589,34 @@ store_server_fields(TABLE *table, FOREIGN_SERVER *server)
even if with empty strings
*/
if (server->host &&
table->field[1]->store(server->host,
table->field[HOST_FIELD]->store(server->host,
(uint) strlen(server->host), system_charset_info))
goto err;
if (server->db &&
table->field[2]->store(server->db,
table->field[DB_FIELD]->store(server->db,
(uint) strlen(server->db), system_charset_info))
goto err;
if (server->username &&
table->field[3]->store(server->username,
table->field[USERNAME_FIELD]->store(server->username,
(uint) strlen(server->username), system_charset_info))
goto err;
if (server->password &&
table->field[4]->store(server->password,
table->field[PASSWORD_FIELD]->store(server->password,
(uint) strlen(server->password), system_charset_info))
goto err;
if (server->port > -1 &&
table->field[5]->store(server->port))
table->field[PORT_FIELD]->store(server->port))
goto err;
if (server->socket &&
table->field[6]->store(server->socket,
table->field[SOCKET_FIELD]->store(server->socket,
(uint) strlen(server->socket), system_charset_info))
goto err;
if (server->scheme &&
table->field[7]->store(server->scheme,
table->field[SCHEME_FIELD]->store(server->scheme,
(uint) strlen(server->scheme), system_charset_info))
goto err;
if (server->owner &&
table->field[8]->store(server->owner,
table->field[OWNER_FIELD]->store(server->owner,
(uint) strlen(server->owner), system_charset_info))
goto err;
return 0;
@ -702,17 +661,14 @@ int insert_server_record(TABLE *table, FOREIGN_SERVER *server)
empty_record(table);
/* set the field that's the PK to the value we're looking for */
table->field[0]->store(server->server_name,
server->server_name_length,
system_charset_info);
table->field[SERVER_NAME_FIELD]->store(server->server_name,
server->server_name_length,
system_charset_info);
/* read index until record is that specified in server_name */
if (unlikely((error=
table->file->ha_index_read_idx_map(table->record[0], 0,
(uchar *)table->field[0]->
ptr,
HA_WHOLE_KEY,
HA_READ_KEY_EXACT))))
if ((error= table->file->ha_index_read_idx_map(table->record[0], 0,
(uchar *)table->field[SERVER_NAME_FIELD]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT)))
{
/* if not found, err */
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
@ -773,8 +729,8 @@ static int drop_server_internal(THD *thd, LEX_SERVER_OPTIONS *server_options)
if (unlikely((error= delete_server_record_in_cache(server_options))))
goto end;
if (unlikely(!(table= open_ltable(thd, &tables, TL_WRITE,
MYSQL_LOCK_IGNORE_TIMEOUT))))
table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
if (!table || !servers_table_is_valid(table))
{
error= my_errno;
goto end;
@ -901,7 +857,8 @@ int update_server(THD *thd, FOREIGN_SERVER *existing, FOREIGN_SERVER *altered)
tables.init_one_table(&MYSQL_SCHEMA_NAME, &MYSQL_SERVERS_NAME, 0, TL_WRITE);
if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT);
if (!table || !servers_table_is_valid(table))
{
error= my_errno;
goto end;
@ -1052,9 +1009,9 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server)
table->use_all_columns();
/* set the field that's the PK to the value we're looking for */
if (table->field[0]->store(server->server_name,
server->server_name_length,
system_charset_info))
if (table->field[SERVER_NAME_FIELD]->store(server->server_name,
server->server_name_length,
system_charset_info))
{
DBUG_ASSERT(0); /* Protected by servers_cache */
THD *thd= table->in_use;
@ -1062,12 +1019,9 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server)
return thd->get_stmt_da()->get_sql_errno();
}
if (unlikely((error=
table->file->ha_index_read_idx_map(table->record[0], 0,
(uchar *)table->field[0]->
ptr,
~(longlong)0,
HA_READ_KEY_EXACT))))
if ((error=table->file->ha_index_read_idx_map(table->record[0], 0,
(uchar *)table->field[SERVER_NAME_FIELD]->ptr,
~(longlong)0, HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
table->file->print_error(error, MYF(0));
@ -1121,14 +1075,11 @@ delete_server_record(TABLE *table, LEX_CSTRING *name)
table->use_all_columns();
/* set the field that's the PK to the value we're looking for */
table->field[0]->store(name->str, name->length, system_charset_info);
table->field[SERVER_NAME_FIELD]->store(name->str, name->length, system_charset_info);
if (unlikely((error=
table->file->ha_index_read_idx_map(table->record[0], 0,
(uchar *)table->field[0]->
ptr,
HA_WHOLE_KEY,
HA_READ_KEY_EXACT))))
if ((error= table->file->ha_index_read_idx_map(table->record[0], 0,
(uchar *)table->field[SERVER_NAME_FIELD]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT)))
{
if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE)
table->file->print_error(error, MYF(0));

View file

@ -719,11 +719,9 @@ static void wsrep_init_thd_for_schema(THD *thd)
{
thd->security_ctx->skip_grants();
thd->system_thread= SYSTEM_THREAD_GENERIC;
thd->real_id=pthread_self(); // Keep purify happy
thd->prior_thr_create_utime= thd->start_utime= thd->thr_create_utime;
thd->prior_thr_create_utime= thd->start_utime=
thd->thr_create_utime= microsecond_interval_timer();
/* No Galera replication */
thd->variables.wsrep_on= 0;
/* No binlogging */

View file

@ -42,6 +42,14 @@
#define WSREP_XID_RPL_GTID_OFFSET (WSREP_XID_SEQNO_OFFSET + sizeof(wsrep_seqno_t))
#define WSREP_XID_GTRID_LEN_V_3 (WSREP_XID_RPL_GTID_OFFSET + sizeof(wsrep_server_gtid_t))
void inline wsrep_xid_init(XID *xid)
{
xid->null();
xid->gtrid_length= 0;
xid->bqual_length= 0;
memset(xid->data, 0, sizeof(xid->data));
}
void wsrep_xid_init(XID* xid, const wsrep::gtid& wsgtid, const wsrep_server_gtid_t& gtid)
{
xid->formatID= 1;
@ -161,8 +169,6 @@ bool wsrep_get_SE_checkpoint(XID& xid)
static bool wsrep_get_SE_checkpoint_common(XID& xid)
{
xid.null();
if (wsrep_get_SE_checkpoint(xid))
{
return FALSE;
@ -186,6 +192,7 @@ template<>
wsrep::gtid wsrep_get_SE_checkpoint()
{
XID xid;
wsrep_xid_init(&xid);
if (!wsrep_get_SE_checkpoint_common(xid))
{
@ -199,6 +206,7 @@ template<>
wsrep_server_gtid_t wsrep_get_SE_checkpoint()
{
XID xid;
wsrep_xid_init(&xid);
wsrep_server_gtid_t gtid= {0,0,0};
if (!wsrep_get_SE_checkpoint_common(xid))

View file

@ -429,12 +429,12 @@ dict_table_schema_check(
/* check length for exact match */
if (req_schema->columns[i].len != table->cols[j].len) {
sql_print_warning("InnoDB: Table %s has"
" length mismatch in the"
" column name %s."
" Please run mariadb-upgrade",
req_schema->table_name_sql,
req_schema->columns[i].name);
snprintf(errstr, errstr_sz,
"Unexpected length of %s.%s. Please run "
"mariadb-upgrade or ALTER TABLE",
req_schema->table_name_sql,
req_schema->columns[i].name);
return DB_ERROR;
}
/*

View file

@ -1,24 +0,0 @@
let $CHILD2_1_HS_DROP_TABLES=
DROP TABLE IF EXISTS hs_r;
let $CHILD2_1_HS_CREATE_TABLES=
CREATE TABLE hs_r (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
d INT DEFAULT 11,
PRIMARY KEY(a)
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
let $CHILD2_1_HS_SELECT_TABLES=
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
let $CHILD2_1_HS_DROP_TABLES2=
DROP TABLE IF EXISTS hs_r2;
let $CHILD2_1_HS_CREATE_TABLES2=
CREATE TABLE hs_r2 (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
d INT DEFAULT 11,
PRIMARY KEY(a)
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
let $CHILD2_1_HS_SELECT_TABLES2=
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;

View file

@ -1,12 +0,0 @@
let $CHILD2_2_HS_DROP_TABLES=
DROP TABLE IF EXISTS hs_r3;
let $CHILD2_2_HS_CREATE_TABLES=
CREATE TABLE hs_r3 (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
d INT DEFAULT 11,
PRIMARY KEY(a)
) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
let $CHILD2_2_HS_SELECT_TABLES=
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;

View file

@ -1,12 +0,0 @@
let $MASTER_1_HS_COMMENT_TMP=
COMMENT='';
let $MASTER_1_HS_COMMENT_2_1=
COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT", hwr "0"';
let $MASTER_1_HS_COMMENT_P_2_1=
COMMENT='uhr "1", uhw "1", hwr "0"'
PARTITION BY RANGE(a) (
PARTITION pt1 VALUES LESS THAN (4)
COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"',
PARTITION pt2 VALUES LESS THAN MAXVALUE
COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"'
);

View file

@ -1,17 +0,0 @@
# get connection and exist engine test
--echo for master_1
--connection master_1
--source ../include/hs_deinit_master_1.inc
--echo for child2
if ($USE_CHILD_GROUP2)
{
--echo child2_1
--connection child2_1
--source ../include/hs_deinit_child2_1.inc
--echo child2_2
--connection child2_2
--source ../include/hs_deinit_child2_2.inc
--echo child2_3
--connection child2_3
--source ../include/hs_deinit_child2_3.inc
}

View file

@ -1,17 +0,0 @@
# get connection and exist engine test
--echo for master_1
--connection master_1
--source ../include/hs_init_master_1.inc
--echo for child2
if ($USE_CHILD_GROUP2)
{
--echo child2_1
--connection child2_1
--source ../include/hs_init_child2_1.inc
--echo child2_2
--connection child2_2
--source ../include/hs_init_child2_2.inc
--echo child2_3
--connection child2_3
--source ../include/hs_init_child2_3.inc
}

View file

@ -1,24 +0,0 @@
let $CHILD2_1_HS_DROP_TABLES=
DROP TABLE IF EXISTS hs_r;
let $CHILD2_1_HS_CREATE_TABLES=
CREATE TABLE hs_r (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
d INT DEFAULT 11,
PRIMARY KEY(a)
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
let $CHILD2_1_HS_SELECT_TABLES=
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a;
let $CHILD2_1_HS_DROP_TABLES2=
DROP TABLE IF EXISTS hs_r2;
let $CHILD2_1_HS_CREATE_TABLES2=
CREATE TABLE hs_r2 (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
d INT DEFAULT 11,
PRIMARY KEY(a)
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
let $CHILD2_1_HS_SELECT_TABLES2=
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a;

View file

@ -1,12 +0,0 @@
let $CHILD2_2_HS_DROP_TABLES=
DROP TABLE IF EXISTS hs_r3;
let $CHILD2_2_HS_CREATE_TABLES=
CREATE TABLE hs_r3 (
a INT DEFAULT 10,
b CHAR(1) DEFAULT 'c',
c DATETIME DEFAULT '1999-10-10 10:10:10',
d INT DEFAULT 11,
PRIMARY KEY(a)
) $CHILD2_2_ENGINE $CHILD2_2_CHARSET;
let $CHILD2_2_HS_SELECT_TABLES=
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a;

View file

@ -1,12 +0,0 @@
let $MASTER_1_HS_COMMENT_TMP=
COMMENT='';
let $MASTER_1_HS_COMMENT_2_1=
COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"';
let $MASTER_1_HS_COMMENT_P_2_1=
COMMENT='uhr "1", uhw "1"'
PARTITION BY RANGE(a) (
PARTITION pt1 VALUES LESS THAN (4)
COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"',
PARTITION pt2 VALUES LESS THAN MAXVALUE
COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"'
);

View file

@ -1,17 +0,0 @@
# get connection and exist engine test
--echo for master_1
--connection master_1
--source ../include/hs_deinit_master_1.inc
--echo for child2
if ($USE_CHILD_GROUP2)
{
--echo child2_1
--connection child2_1
--source ../include/hs_deinit_child2_1.inc
--echo child2_2
--connection child2_2
--source ../include/hs_deinit_child2_2.inc
--echo child2_3
--connection child2_3
--source ../include/hs_deinit_child2_3.inc
}

View file

@ -1,17 +0,0 @@
# get connection and exist engine test
--echo for master_1
--connection master_1
--source ../include/hs_init_master_1.inc
--echo for child2
if ($USE_CHILD_GROUP2)
{
--echo child2_1
--connection child2_1
--source ../include/hs_init_child2_1.inc
--echo child2_2
--connection child2_2
--source ../include/hs_init_child2_2.inc
--echo child2_3
--connection child2_3
--source ../include/hs_init_child2_3.inc
}