403Webshell
Server IP : 104.21.38.3  /  Your IP : 108.162.227.63
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/t/no_binlog_gtid_next_partially_failed_stmts.test
# ==== Purpose ====
#
# Verify that a partially failed statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED
# and mysql.gtid_executed table when binlog is disabled
# if it did the same when binlog is enabled.
#
# ==== Implementation ====
#
# 1) SET SESSION GTID_NEXT='UUID:GNO'.
# 2) Execute a partially failed statement.
# 3) Verify that the partially failed statement can consume
#    its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED
#    and mysql.gtid_executed table when binlog is disabled
#    if it did the same when binlog is enabled.
# 4) Execute above three steps for all different types of statements
#
# ==== References ====
#
# Bug#21686749  PARTIALLY FAILED DROP OR ACL STMT FAILS TO CONSUME GTID ON BINLOGLESS SLAVE
# See mysql-test/suite/binlog/t/binlog_gtid_next_partially_failed_stmts.test
# See mysql-test/suite/binlog/t/binlog_gtid_next_partially_failed_grant.test
# See mysql-test/t/no_binlog_gtid_next_partially_failed_stmts_error.test
#

# Test is not required to run against embedded server
--source include/not_embedded.inc
# Should be tested against "binlog disabled" server
--source include/not_log_bin.inc

# Make sure the test is repeatable
RESET MASTER;

--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`

--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:1'
CREATE TABLE t1 (a int);

# Check-1: DROP TABLE
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:2'
--echo #
--echo # Execute a partially failed DROP TABLE statement.
--echo #
--error ER_BAD_TABLE_ERROR
DROP TABLE t1, t2;

--echo #
--echo # The table t1 was dropped, which means DROP TABLE
--echo # can be failed partially.
--echo #
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE t1;

--echo #
--echo # Verify that the partially failed DROP TABLE statement can consume
--echo # its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--let $assert_text= Committed gtid MASTER_UUID:2 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-2"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:2 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 2]" = 1
--source include/assert.inc


--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:3'
CREATE TEMPORARY TABLE tmp1 (a int);

# Check-2: DROP TEMPORARY TABLE
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:4'
--echo #
--echo # Execute a partially failed DROP TEMPORARY TABLE statement.
--echo #
--error ER_BAD_TABLE_ERROR
DROP TEMPORARY TABLE tmp1, t2;
--echo #
--echo # Verify that the partially failed DROP TEMPORARY TABLE statement can
--echo # consume its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--let $assert_text= Committed gtid MASTER_UUID:4 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-4"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:4 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 4]" = 1
--source include/assert.inc

--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:5'
CREATE TABLE t1(a INT, b INT);
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:6'
CREATE USER u1@h;
--echo #
--echo # Verify that u1 is added into mysql.user.
--echo #
SELECT user FROM mysql.user where user='u1';

# Check-3: GRANT a non-available privilege
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:7'
--error ER_BAD_FIELD_ERROR
GRANT SELECT(a), SELECT(c) ON t1 TO u1@h;
--echo #
--echo # The SELECT privilege on column a is not granted to u1@h,
--echo # which means that GRANT can not be failed partially when
--echo # granting an available privilege and a non-available
--echo # privilege to an existent user.
--echo #
SELECT user, column_name, column_priv FROM mysql.columns_priv;
--echo #
--echo # Verify that the failed GRANT statement does not save
--echo # the specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6"
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 7]" = 0
--source include/assert.inc

# Check-4: GRANT a privilege to a non-existent user
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:7'
--error ER_PASSWORD_NO_MATCH
GRANT SELECT(a) ON t1 TO u1@h, u2@h;
--echo #
--echo # The SELECT privilege on column a is granted to u1@h,
--echo # which means that GRANT can be failed partially when
--echo # granting an available privilege to both an existent
--echo # user and a non-existent user.
--echo #
SELECT user, column_name, column_priv FROM mysql.columns_priv;
--echo #
--echo # Verify that the partially failed GRANT statement does not
--echo # save the specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it
--echo # did when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6"
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 7]" = 0
--source include/assert.inc

# Check-5: REVOKE
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:8'
--error ER_NONEXISTING_TABLE_GRANT
REVOKE SELECT(a), SELECT(b) ON t1 FROM u1@h;
--echo #
--echo # The SELECT privilege is removed on column a from user u1,
--echo # which means that REVOKE statement can be failed partially
--echo # when revoking multiple privileges from a user.
--echo #
SELECT user, column_name, column_priv FROM mysql.columns_priv;
--echo #
--echo # Verify that the partially failed REVOKE statement does not
--echo # save the specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # and mysql.gtid_executed table when binlog is disabled as it
--echo # did when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Did not commit gtid MASTER_UUID:8 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6"
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:8 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 8]" = 0
--source include/assert.inc

# Check-6: DROP USER
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:9'
--error ER_CANNOT_USER
DROP USER u1@h, u2@h;
--echo #
--echo # The u1 is removed from mysql.user which means that DROP USER
--echo # can be failed partially.
--echo #
SELECT user FROM mysql.user where user='u1';
--echo #
--echo # Verify that the partially failed DROP USER statement can consume
--echo # its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:9 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:9 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 9]" = 1
--source include/assert.inc

--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:10'
CREATE VIEW v1 as SELECT 1;

# Check-7: DROP VIEW
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:11'
--error ER_BAD_TABLE_ERROR
DROP VIEW v1, v2;
--echo #
--echo # The view v1 was dropped, which means DROP VIEW can be failed
--echo # partially when dropping multiple views.
--echo #
--error ER_NO_SUCH_TABLE
SHOW CREATE VIEW v1;
--echo #
--echo # Verify that the partially failed DROP VIEW statement can consume
--echo # its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:11 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-11"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:11 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 11]" = 1
--source include/assert.inc

# Check-8: RENAME TABLE
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:12'
--error ER_FILE_NOT_FOUND
RENAME TABLE t1 TO t2, t3 TO t4;
--echo #
--echo # The table t1 was not renamed, which means RENAME TABLE
--echo # can not be failed partially.
--echo #
SHOW CREATE TABLE t1;
--echo #
--echo # Verify that the failed RENAME TABLE statement does not save
--echo # the specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did
--echo # when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Did not commit gtid MASTER_UUID:12 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-11"
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:12 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 12]" = 0
--source include/assert.inc

# Check-9: OPTIMIZE TABLE
--echo #
--echo # The OPTIMIZE TABLE statement can be failed partially when optimizing
--echo # multiple tables, which contain a non-existent table.
--echo #
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:12'
OPTIMIZE TABLE t1, t_non_existent;
--echo #
--echo # When optimizing a non-existent table, verify that the OPTIMIZE TABLE
--echo # statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did
--echo # when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:12 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-12"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:12 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 12]" = 1
--source include/assert.inc

# Check-10: ANALYZE TABLE
--echo #
--echo # The ANALYZE TABLE statement can be failed partially when analyzing
--echo # multiple tables, which contain a non-existent table.
--echo #
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:13'
ANALYZE TABLE t1, t_non_existent;
--echo #
--echo # When analyzing a non-existent table, verify that the ANALYZE TABLE
--echo # statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did
--echo # when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:13 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-13"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:13 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 13]" = 1
--source include/assert.inc

# Check-11: REPAIR TABLE
--echo #
--echo # The REPAIR TABLE statement can be failed partially when repairing
--echo # multiple tables, which contain a non-existent table.
--echo #
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:14'
REPAIR TABLE t1, t_non_existent;
--echo #
--echo # When repairing a non-existent table, verify that the REPAIR TABLE
--echo # statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did
--echo # when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:14 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-14"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:13 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 14]" = 1
--source include/assert.inc

# Check-12: CHECKSUM TABLE
--echo #
--echo # The CHECKSUM TABLE statement can be failed partially when checksuming
--echo # multiple tables, which contain a non-existent table.
--echo #
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:15'
CHECKSUM TABLE t1, t_non_existent;
--echo #
--echo # When checksuming a non-existent table, verify that the CHECKSUM TABLE
--echo # statement does not save its specified gtid into @@GLOBAL.GTID_EXECUTED
--echo # and mysql.gtid_executed table when binlog is disabled as it did
--echo # when binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Did not commit gtid MASTER_UUID:15 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-14"
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:15 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 15]" = 0
--source include/assert.inc

# Check-13: CREATE USER
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:16'
CREATE USER u1@h;
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:17'
--error ER_CANNOT_USER
CREATE USER u1@h, u2@h;
--echo #
--echo # The u2 is created into mysql.user which means that CREATE USER
--echo # can be failed partially.
--echo #
SELECT user FROM mysql.user where user='u2';
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:18'
--error ER_CANNOT_USER
CREATE USER u1@h, u2@h;
--echo #
--echo # Verify that the partially failed CREATE USER statement can consume
--echo # its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:17 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-14:16-17"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:17 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 17]" = 1
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:18 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 18]" = 0
--source include/assert.inc

# Check-14: RENAME USER
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:19'
--error ER_CANNOT_USER
RENAME USER u1@h TO u11@h, u3@h TO u33@h;
--echo #
--echo # The u1 is renamed on mysql.user which means that RENAME USER
--echo # can be failed partially.
--echo #
SELECT user FROM mysql.user where user='u11';
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:20'
--error ER_CANNOT_USER
RENAME USER u1@h TO u11@h, u3@h TO u33@h;
--echo #
--echo # Verify that the partially failed RENAME USER statement can consume
--echo # its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:19 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-14:16-17:19"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:19 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 19]" = 1
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:20 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 20]" = 0
--source include/assert.inc

# Check-15: ALTER USER
SELECT password_expired FROM mysql.user where user='u11';
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:21'
--error ER_CANNOT_USER
ALTER USER u11@h, u3@h PASSWORD EXPIRE;
--echo #
--echo # The u11 is altered on mysql.user which means that ALTER USER
--echo # can be failed partially.
--echo #
SELECT password_expired FROM mysql.user where user='u11';
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:22'
--error ER_CANNOT_USER
ALTER USER u1@h, u3@h PASSWORD EXPIRE;
--echo #
--echo # Verify that the partially failed ALTER USER statement can consume
--echo # its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
--echo # mysql.gtid_executed table when binlog is disabled as it did when
--echo # binlog is enabled.
--echo #
--replace_result $master_uuid MASTER_UUID
--let $assert_text= Committed gtid MASTER_UUID:21 into @@GLOBAL.GTID_EXECUTED
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-6:9-14:16-17:19:21"
--source include/assert.inc
--let $assert_text= Saved gtid MASTER_UUID:21 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 21]" = 1
--source include/assert.inc
--let $assert_text= Did not save gtid MASTER_UUID:22 into mysql.gtid_executed table
--let $assert_cond= "[SELECT COUNT(*) FROM mysql.gtid_executed WHERE interval_end = 22]" = 0
--source include/assert.inc
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:23'
DROP USER u11@h, u2@h;

# Clean up
--replace_result $master_uuid MASTER_UUID
--eval SET SESSION GTID_NEXT='$master_uuid:24'
DROP TABLE t1;


Youez - 2016 - github.com/yon3zu
LinuXploit