MINI MINI MANI MO
RESET MASTER;
CREATE TABLE t1(a INT, b INT);
CREATE USER u1@h;
#
# Verify that u1 is added into mysql.user.
#
SELECT user FROM mysql.user where user='u1';
user
u1
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 generate
# a gtid and save the gtid into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:3 into @@GLOBAL.GTID_EXECUTED]
#
# Verify that the failed GRANT statement is not binlogged
#
include/show_binlog_events.inc
GRANT SELECT(a) ON t1 TO u1@h;
#
# Verify that the grant info is added into mysql.columns_priv.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user column_name column_priv
u1 a Select
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 generate
# a gtid master_uuid:5 and save the gtid into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:4 into @@GLOBAL.GTID_EXECUTED]
#
# Verify that the partially failed REVOKE statement is not binlogged
#
include/show_binlog_events.inc
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 generates
# a gtid and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:5 into @@GLOBAL.GTID_EXECUTED]
#
# Verify that the partially failed DROP USER statement is binlogged
#
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; DROP USER u1@h, u2@h
CREATE VIEW v1 as SELECT 1;
DROP VIEW v1, v2;
ERROR 42S02: Unknown table 'test.v2'
#
# Verify that the partially failed DROP VIEW statement generates
# a gtid and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
#
# Verify that the partially failed DROP VIEW statement is binlogged
#
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; DROP VIEW v1, v2
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 generate
# a new GTID MASTER_UUID:8 and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Does not generate MASTER_UUID:8 and commit it into @@GLOBAL.GTID_EXECUTED]
#
# Verify that the failed RENAME TABLE statement is not binlogged
#
include/show_binlog_events.inc
#
# The OPTIMIZE TABLE statement can be failed partially when optimizing
# multiple tables, which contain a non-existent table.
#
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 generates a gtid and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:8 into @@GLOBAL.GTID_EXECUTED]
#
# When optimizing a non-existent table, verify that the OPTIMIZE TABLE
# statement is binlogged.
#
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; OPTIMIZE TABLE t1, t_non_existent
#
# The ANALYZE TABLE statement can be failed partially when analyzing
# multiple tables, which contain a non-existent table.
#
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 generates a gtid and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:9 into @@GLOBAL.GTID_EXECUTED]
#
# When analyzing a non-existent table, verify that the ANALYZE TABLE
# statement is binlogged.
#
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; ANALYZE TABLE t1, t_non_existent
#
# The REPAIR TABLE statement can be failed partially when repairing
# multiple tables, which contain a non-existent table.
#
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 generates a gtid and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Committed gtid MASTER_UUID:10 into @@GLOBAL.GTID_EXECUTED]
#
# When repairing a non-existent table, verify that the REPAIR TABLE
# statement is binlogged.
#
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; REPAIR TABLE t1, t_non_existent
#
# The CHECKSUM TABLE statement can be failed partially when checksuming
# multiple tables, which contain a non-existent table.
#
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 generates a gtid and save it into @@GLOBAL.GTID_EXECUTED.
#
include/assert.inc [Does not generate MASTER_UUID:11 and commit it into @@GLOBAL.GTID_EXECUTED]
#
# When checksuming a non-existent table, verify that the CHECKSUM TABLE
# statement is not binlogged.
#
include/show_binlog_events.inc
DROP TABLE t1;
OHA YOOOO