403Webshell
Server IP : 104.21.38.3  /  Your IP : 162.158.107.75
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/suite/rpl/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/rpl/t/rpl_concurrency_error.test
###############################################################################
#BUG#44581 Slave stops when transaction with non-transactional table gets
#lock wait timeout
#
# In STMT and MIXED modes, a statement that changes both non-transactional and
# transactional tables must be written to the binary log whenever there are
# changes to non-transactional tables. This means that the statement gets into
# the # binary log even when the changes to the transactional tables fail. In
# particular, in the presence of a failure such statement is annotated with the
# error number and wrapped in a begin/rollback. On the slave, while applying
# the statement, it is expected the same failure and the rollback prevents the
# transactional changes to be persisted.

# This test aims to verify if a statement that updates both transactional and
# non-transacitonal tables and fails due to concurrency problems is correctly
# processed by the slave in the sense that the statements get into the binary
# log, the error is ignored and only the non-transactional tables are changed.
###############################################################################

--source include/not_group_replication_plugin.inc
--source include/have_innodb.inc
--source include/have_myisam.inc
--source include/have_binlog_format_statement.inc
--source include/not_gtid_enabled.inc
--source include/master-slave.inc

call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");

--echo ########################################################################
--echo #                             Environment
--echo ########################################################################
connection master;

CREATE TABLE t (i INT, PRIMARY KEY(i), f CHAR(8)) engine = Innodb;
CREATE TABLE n (d DATETIME, f CHAR(32)) engine = MyIsam;

DELIMITER |;
CREATE TRIGGER tr AFTER UPDATE ON t FOR EACH ROW 
BEGIN 
  INSERT INTO n VALUES ( now(), concat( 'updated t: ', old.f, ' -> ', new.f ) ); 
END |
DELIMITER ;|

INSERT INTO t VALUES (4,'black'), (2,'red'), (3,'yelow'), (1,'cyan');

connect (conn1, 127.0.0.1,root,,);
connect (conn2, 127.0.0.1,root,,);

--echo ########################################################################
--echo #                     Testing ER_LOCK_WAIT_TIMEOUT
--echo ########################################################################

let $type=2;

while ($type)
{
  let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
  connection conn1;
  if ($type == 2)
  {
    SET AUTOCOMMIT = 1;
    BEGIN;
  }
  if ($type == 1)
  {
    SET AUTOCOMMIT = 0;
  }
  eval UPDATE t SET f = 'yellow $type' WHERE i = 3;
  
  connection conn2;
  if ($type == 2)
  {
    SET AUTOCOMMIT = 1;
    BEGIN;
  }
  if ($type == 1)
  {
    SET AUTOCOMMIT = 0;
  }
  --error ER_LOCK_WAIT_TIMEOUT
  eval UPDATE IGNORE t SET f = 'magenta $type' WHERE f = 'red';
  eval INSERT INTO t VALUES (5 + ($type * 10),"brown");
  INSERT INTO n VALUES (now(),"brown");
  
  connection conn1;
  COMMIT;
  
  connection conn2;
  ROLLBACK;
  --source include/show_binlog_events.inc

  let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
  connection conn1;
  if ($type == 2)
  {
    SET AUTOCOMMIT = 1;
    BEGIN;
  }
  if ($type == 1)
  {
    SET AUTOCOMMIT = 0;
  }
  eval UPDATE t SET f = 'gray $type' WHERE i = 3;
  
  connection conn2;
  if ($type == 2)
  {
    SET AUTOCOMMIT = 1;
    BEGIN;
  }
  if ($type == 1)
  {
    SET AUTOCOMMIT = 0;
  }
  --error ER_LOCK_WAIT_TIMEOUT
  eval UPDATE IGNORE t SET f = 'dark blue $type' WHERE f = 'red';
  eval INSERT INTO t VALUES (6 + ($type * 10),"brown");
  INSERT INTO n VALUES (now(),"brown");
  
  connection conn1;
  COMMIT;
  
  connection conn2;
  COMMIT;
  --source include/show_binlog_events.inc
  
  dec $type;
}

connection master;
--source include/sync_slave_sql_with_master.inc

let $rpl_diff_statement= SELECT * FROM t order by i;
source include/rpl_diff.inc;

let $rpl_diff_statement= SELECT * FROM n order by d, f;
source include/rpl_diff.inc;

--echo ########################################################################
--echo #                                Cleanup
--echo ########################################################################

connection master;
DROP TRIGGER tr;
DROP TABLE t;
DROP TABLE n;

--source include/sync_slave_sql_with_master.inc

connection master;
disconnect conn1;
disconnect conn2;
--source include/rpl_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit