403Webshell
Server IP : 104.21.38.3  /  Your IP : 108.162.227.64
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/mysql-test/suite/group_replication/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/mysql-test/suite/group_replication/t/gr_row_implicit_commit_binlog.test
################################################################################
# In this test case, we verify if some DDL statements implicitly commit a
# transaction and are written directly to the binary log without going
# through either the Statement- or Transactional-Cache when used with Group
# REPLICATON.
#
# As any statement that goes through a cache is written to the binary log
# wrapped in a BEGIN...COMMIT, we proceed as follows:
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With both the members ONLINE. On M1, create tables and insert some values.
# 2. Check implicit commit:
#  - Set auto_commit=0.
#  - Create a transaction and insert some values into a transactional table.
#  - Execute a DDL statement that is supposed to implicitly commit the previous
#    transaction. Following DDLs are tested:-
#    DROP DATABASE,  CREATE DATABASE,  DROP TABLE,  RENAME TABLE,  CREATE TABLE,
#    DROP VIEW,  ALTER VIEW,  CREATE VIEW,  DROP PROCEDURE,  ALTER PROCEDURE,
#    CREATE PROCEDURE,  DROP FUNCTION,  ALTER FUNCTION,  CREATE FUNCTION,
#    DROP EVENT,  ALTER EVENT,  CREATE EVENT,  DROP USER,  RENAME USER,  REVOKE,
#    SET PASSWORD,  GRANT,  CREATE USER,  UNLOCK TABLES,  LOCK TABLES,
#    REPAIR TABLE,  OPTIMIZE TABLE,  CHECK TABLE,  ANALYZE TABLE,  LOAD INDEX
#  - Check in the binary log for a COMMIT mark which is supposed to be written
#    before the DDL statement.
#  - Check in the binary log if the DML is not wrapped by a BEGIN..COMMIT.
#  - Set auto_commit=1.
# 3. Checking the consistency on the two members.
# 4. Clean up.
################################################################################
--source ../inc/have_group_replication_plugin.inc
--source ../inc/group_replication.inc

--echo #########################################################################
--echo #                            CONFIGURATION
--echo #########################################################################
--connection server1

--eval CREATE TABLE tt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = innodb
--eval CREATE TABLE tt_2 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = innodb
--eval CREATE TABLE nt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = innodb

INSERT INTO tt_1(ddl_case) VALUES(0);
INSERT INTO tt_2(ddl_case) VALUES(0);

--echo #########################################################################
--echo #                          CHECK IMPLICT COMMIT
--echo #########################################################################

# Creating a set of statements which goes through the implicit commit stage
# and checking the status of the group at the very end.
SET AUTOCOMMIT= 0;
--let $ddl_cases= 31
while ($ddl_cases >= 1)
{
  --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
  --let $in_temporary= no
  --let $ok= yes
  #
  # In RBR mode, the commit event is usually the fourth event in the binary log:
  #
  # 1: BEGIN
  # 2: TABLE MAP EVENT
  # 3: ROW EVENT
  # 4: COMMIT
  # 5: DDL EVENT which triggered the previous commmit.
  #

  --let $commit_event_row_number= 4
  --let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1)
  --enable_query_log
  --eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases)

  if ($ddl_cases == 31)
  {
    --let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES
  }
  if ($ddl_cases == 30)
  {
    --let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES
  }
  if ($ddl_cases == 29)
  {
    --let $cmd= ANALYZE TABLE nt_1
  }
  if ($ddl_cases == 28)
  {
    --let $cmd= CHECK TABLE nt_1
  }
  if ($ddl_cases == 27)
  {
    --let $cmd= OPTIMIZE TABLE nt_1
  }
  if ($ddl_cases == 26)
  {
    --let $cmd= REPAIR TABLE nt_1
  }
  if ($ddl_cases == 25)
  {
    --let $cmd= LOCK TABLES tt_1 WRITE
  }
  if ($ddl_cases == 24)
  {
    --let $cmd= UNLOCK TABLES
  }
  if ($ddl_cases == 23)
  {
    --let $cmd= CREATE USER 'user'@'localhost'
  }
  if ($ddl_cases == 22)
  {
    --let $cmd= GRANT ALL ON *.* TO 'user'@'localhost'
  }
  if ($ddl_cases == 21)
  {
    --let $cmd= SET PASSWORD FOR 'user'@'localhost' = 'newpass'
  }
  if ($ddl_cases == 20)
  {
    --let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost'
  }
  if ($ddl_cases == 19)
  {
    --let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost'
  }
  if ($ddl_cases == 18)
  {
    --let $cmd= DROP USER 'user_new'@'localhost'
  }
  if ($ddl_cases == 17)
  {
    --let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1
  }
  if ($ddl_cases == 16)
  {
    --let $cmd= ALTER EVENT evt COMMENT 'evt'
  }
  if ($ddl_cases == 15)
  {
    --let $cmd= DROP EVENT evt
  }
  if ($ddl_cases == 14)
  {
    --let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc"
  }
  if ($ddl_cases == 13)
  {
    --let $cmd= ALTER FUNCTION fc COMMENT 'fc'
  }
  if ($ddl_cases == 12)
  {
    --let $cmd= DROP FUNCTION fc
  }
  if ($ddl_cases == 11)
  {
    --let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case
  }
  if ($ddl_cases == 10)
  {
    --let $cmd= ALTER PROCEDURE pc COMMENT 'pc'
  }
  if ($ddl_cases == 8)
  {
    --let $cmd= DROP PROCEDURE pc
  }
  if ($ddl_cases == 9)
  {
    --let $cmd= CREATE VIEW v AS SELECT * FROM tt_1
  }
  if ($ddl_cases == 7)
  {
    --let $cmd= ALTER VIEW v AS SELECT * FROM tt_1
  }
  if ($ddl_cases == 6)
  {
    --let $cmd= DROP VIEW v
  }
  if ($ddl_cases == 5)
  {
    --let $cmd= CREATE TABLE tt_xx (a int)
  }
  if ($ddl_cases == 4)
  {
    --let $cmd= RENAME TABLE tt_xx TO new_tt_xx
  }
  if ($ddl_cases == 3)
  {
    --let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx
  }
  if ($ddl_cases == 2)
  {
    --let $cmd= CREATE DATABASE db
  }
  if ($ddl_cases == 1)
  {
    --let $cmd= DROP DATABASE IF EXISTS db
  }
  --eval $cmd
  --disable_query_log

  --let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, $commit_event_row_number)

  --echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
  --let $binlog_start= $first_binlog_position;
  --echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
  --source include/show_binlog_events.inc
  --echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
  --echo
  --dec $ddl_cases
}
SET AUTOCOMMIT= 1;

--echo ###################################################################################
--echo #                               CHECK CONSISTENCY
--echo ###################################################################################
--source include/rpl_sync.inc

# Checking the consistency on the two members.

--let $diff_tables= server1:tt_1,server2:tt_1
--source include/diff_tables.inc

--let $diff_tables= server1:tt_2,server2:tt_2
--source include/diff_tables.inc

--let $diff_tables= server1:nt_1,server2:nt_1
--source include/diff_tables.inc

--echo ###################################################################################
--echo #                                        CLEAN
--echo ###################################################################################
--connection server1

DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE nt_1;

--source include/rpl_sync.inc
--source ../inc/group_replication_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit