RESET MASTER;
SET SESSION GTID_NEXT='MASTER_UUID:1';
CREATE TABLE t1 (a int);
SET SESSION GTID_NEXT='MASTER_UUID:2';
#
# Execute a partially failed DROP TABLE statement.
#
DROP TABLE t1, t2;
ERROR 42S02: Unknown table 'test.t2'
#
# The table t1 was dropped, which means DROP TABLE
# can be failed partially.
#
SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist
#
# Verify that the partially failed DROP TABLE statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:2 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:2 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:3';
CREATE TEMPORARY TABLE tmp1 (a int);
SET SESSION GTID_NEXT='MASTER_UUID:4';
#
# Execute a partially failed DROP TEMPORARY TABLE statement.
#
DROP TEMPORARY TABLE tmp1, t2;
ERROR 42S02: Unknown table 'test.t2'
#
# Verify that the partially failed DROP TEMPORARY TABLE statement can
# consume its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:4 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:4 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:5';
CREATE TABLE t1(a INT, b INT);
SET SESSION GTID_NEXT='MASTER_UUID:6';
CREATE USER u1@h;
#
# Verify that u1 is added into mysql.user.
#
SELECT user FROM mysql.user where user='u1';
user
u1
SET SESSION GTID_NEXT='MASTER_UUID:7';
GRANT SELECT(a), SELECT(c) ON t1 TO u1@h;
ERROR 42S22: Unknown column 'c' in 't1'
#
# The SELECT privilege on column a is not granted to u1@h,
# which means that GRANT can not be failed partially when
# granting an available privilege and a non-available
# privilege to an existent user.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user	column_name	column_priv
#
# Verify that the failed GRANT statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:7';
GRANT SELECT(a) ON t1 TO u1@h, u2@h;
ERROR 42000: Can't find any matching row in the user table
#
# The SELECT privilege on column a is granted to u1@h,
# which means that GRANT can be failed partially when
# granting an available privilege to both an existent
# user and a non-existent user.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user	column_name	column_priv
u1	a	Select
#
# Verify that the partially failed GRANT statement does not
# save the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it
# did when binlog is enabled.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:8';
REVOKE SELECT(a), SELECT(b) ON t1 FROM u1@h;
ERROR 42000: There is no such grant defined for user 'u1' on host 'h' on table 't1'
#
# The SELECT privilege is removed on column a from user u1,
# which means that REVOKE statement can be failed partially
# when revoking multiple privileges from a user.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user	column_name	column_priv
#
# Verify that the partially failed REVOKE statement does not
# save the specified gtid into @@GLOBAL.GTID_EXECUTED and
# and mysql.gtid_executed table when binlog is disabled as it
# did when binlog is enabled.
#
include/assert.inc [Did not commit gtid MASTER_UUID:8 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Did not save gtid MASTER_UUID:8 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:9';
DROP USER u1@h, u2@h;
ERROR HY000: Operation DROP USER failed for 'u2'@'h'
#
# The u1 is removed from mysql.user which means that DROP USER
# can be failed partially.
#
SELECT user FROM mysql.user where user='u1';
user
#
# Verify that the partially failed DROP USER statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:9 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:9 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:10';
CREATE VIEW v1 as SELECT 1;
SET SESSION GTID_NEXT='MASTER_UUID:11';
DROP VIEW v1, v2;
ERROR 42S02: Unknown table 'test.v2'
#
# The view v1 was dropped, which means DROP VIEW can be failed
# partially when dropping multiple views.
#
SHOW CREATE VIEW v1;
ERROR 42S02: Table 'test.v1' doesn't exist
#
# Verify that the partially failed DROP VIEW statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:11 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:11 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:12';
RENAME TABLE t1 TO t2, t3 TO t4;
ERROR HY000: Can't find file: './test/t3.frm' (errno: 2 - No such file or directory)
#
# The table t1 was not renamed, which means RENAME TABLE
# can not be failed partially.
#
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) DEFAULT NULL,
  `b` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
#
# Verify that the failed RENAME TABLE statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Did not commit gtid MASTER_UUID:12 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Did not save gtid MASTER_UUID:12 into mysql.gtid_executed table]
#
# The OPTIMIZE TABLE statement can be failed partially when optimizing
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:12';
OPTIMIZE TABLE t1, t_non_existent;
Table	Op	Msg_type	Msg_text
test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
test.t1	optimize	status	OK
test.t_non_existent	optimize	Error	Table 'test.t_non_existent' doesn't exist
test.t_non_existent	optimize	status	Operation failed
#
# When optimizing a non-existent table, verify that the OPTIMIZE TABLE
# statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:12 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:12 into mysql.gtid_executed table]
#
# The ANALYZE TABLE statement can be failed partially when analyzing
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:13';
ANALYZE TABLE t1, t_non_existent;
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	OK
test.t_non_existent	analyze	Error	Table 'test.t_non_existent' doesn't exist
test.t_non_existent	analyze	status	Operation failed
#
# When analyzing a non-existent table, verify that the ANALYZE TABLE
# statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:13 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:13 into mysql.gtid_executed table]
#
# The REPAIR TABLE statement can be failed partially when repairing
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:14';
REPAIR TABLE t1, t_non_existent;
Table	Op	Msg_type	Msg_text
test.t1	repair	note	The storage engine for the table doesn't support repair
test.t_non_existent	repair	Error	Table 'test.t_non_existent' doesn't exist
test.t_non_existent	repair	status	Operation failed
#
# When repairing a non-existent table, verify that the REPAIR TABLE
# statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:14 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:13 into mysql.gtid_executed table]
#
# The CHECKSUM TABLE statement can be failed partially when checksuming
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:15';
CHECKSUM TABLE t1, t_non_existent;
Table	Checksum
test.t1	0
test.t_non_existent	NULL
Warnings:
Error	1146	Table 'test.t_non_existent' doesn't exist
#
# When checksuming a non-existent table, verify that the CHECKSUM TABLE
# statement does not save its specified gtid into @@GLOBAL.GTID_EXECUTED
# and mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Did not commit gtid MASTER_UUID:15 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Did not save gtid MASTER_UUID:15 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:16';
CREATE USER u1@h;
SET SESSION GTID_NEXT='MASTER_UUID:17';
CREATE USER u1@h, u2@h;
ERROR HY000: Operation CREATE USER failed for 'u1'@'h'
#
# The u2 is created into mysql.user which means that CREATE USER
# can be failed partially.
#
SELECT user FROM mysql.user where user='u2';
user
u2
SET SESSION GTID_NEXT='MASTER_UUID:18';
CREATE USER u1@h, u2@h;
ERROR HY000: Operation CREATE USER failed for 'u1'@'h','u2'@'h'
#
# Verify that the partially failed CREATE USER statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:17 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:17 into mysql.gtid_executed table]
include/assert.inc [Did not save gtid MASTER_UUID:18 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:19';
RENAME USER u1@h TO u11@h, u3@h TO u33@h;
ERROR HY000: Operation RENAME USER failed for 'u3'@'h'
#
# The u1 is renamed on mysql.user which means that RENAME USER
# can be failed partially.
#
SELECT user FROM mysql.user where user='u11';
user
u11
SET SESSION GTID_NEXT='MASTER_UUID:20';
RENAME USER u1@h TO u11@h, u3@h TO u33@h;
ERROR HY000: Operation RENAME USER failed for 'u1'@'h','u3'@'h'
#
# Verify that the partially failed RENAME USER statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:19 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:19 into mysql.gtid_executed table]
include/assert.inc [Did not save gtid MASTER_UUID:20 into mysql.gtid_executed table]
SELECT password_expired FROM mysql.user where user='u11';
password_expired
N
SET SESSION GTID_NEXT='MASTER_UUID:21';
ALTER USER u11@h, u3@h PASSWORD EXPIRE;
ERROR HY000: Operation ALTER USER failed for 'u3'@'h'
#
# The u11 is altered on mysql.user which means that ALTER USER
# can be failed partially.
#
SELECT password_expired FROM mysql.user where user='u11';
password_expired
Y
SET SESSION GTID_NEXT='MASTER_UUID:22';
ALTER USER u1@h, u3@h PASSWORD EXPIRE;
ERROR HY000: Operation ALTER USER failed for 'u1'@'h','u3'@'h'
#
# Verify that the partially failed ALTER USER statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:21 into @@GLOBAL.GTID_EXECUTED]
include/assert.inc [Saved gtid MASTER_UUID:21 into mysql.gtid_executed table]
include/assert.inc [Did not save gtid MASTER_UUID:22 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:23';
DROP USER u11@h, u2@h;
SET SESSION GTID_NEXT='MASTER_UUID:24';
DROP TABLE t1;
