403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.170.54
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/binlog/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/binlog/t/binlog_rewrite_db_noleak.test
# WL#6404 - Add rewrite-db option to mysqlbinlog on RBR
#
# The test checks that there is no leak of the global variables used
# to decide whether rewrite-db option is ON or OFF.
#
# The test checks this by creating two tables in two different databases.
# insert rows in both of them.
#
# Read the binlog file using the new option --rewrite-db="db1->db3" and
# writing in the .sql file.
#
# On applying the .sql file on database db3, we get an error since not
# all events are converted for database db3. Only DB1 is converted to db3.
# The db2 event cause the error.
#

--source include/have_binlog_format_row.inc
RESET MASTER;
CREATE DATABASE db1;
USE db1;
CREATE TABLE t1 (i INT);

# Get some INSERT, UPDATE and DELETE ROW events.
INSERT INTO db1.t1 VALUES(1);
INSERT INTO db1.t1 VALUES(2);
UPDATE t1 SET i= i+1;
DELETE FROM t1 WHERE i=2;

CREATE DATABASE db2;
CREATE TABLE db2.t1 (i INT);

# Get some INSERT, UPDATE and DELETE ROW events.
INSERT INTO db2.t1 VALUES(3);
INSERT INTO db2.t1 VALUES(4);
INSERT INTO db2.t1 VALUES(5);
UPDATE db2.t1 SET i= i+1;
DELETE FROM db2.t1 WHERE i=4;

--let $MYSQLD_DATADIR= `select @@datadir`

# Using the new option to apply the row event on some other database (from db1 -> db3 in the current case)

--exec $MYSQL_BINLOG --force-if-open --rewrite-db="db1->db3" $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/rewrite_noleak.sql
call mtr.add_suppression("Slave SQL: Error executing row event:*");

--echo Dropping the database db1 creating the new database db3.
DROP DATABASE db1;
CREATE DATABASE db3;

# The SQL file will be applied but only db1 events will be replayed on db3.
# Database db2 will not be applied on db3 confirming there is no leak.
DROP DATABASE db2;

# With gtid-mode=on we need purge gtid_executed, if not transactions
# replayed through mysqlbinlog will be skipped.
RESET MASTER;
--echo [The sql file will be applied on the current database]
--exec $MYSQL --database=db3 --local-infile=1 < $MYSQLTEST_VARDIR/tmp/rewrite_noleak.sql

--echo [The content of table db3.t1 and db2.t1 will be different confirming no leak]

--let $db3_max= `SELECT MAX(i) FROM db3.t1`
--let $db2_max= `SELECT MAX(i) FROM db2.t1`
--let $assert_text= The content of the table t1 in database db3 and db2 is different
--let $assert_cond= $db3_max <> $db2_max
--source include/assert.inc

--let $db3_count= `SELECT COUNT(*) FROM db3.t1`
--let $db2_count= `SELECT COUNT(*) FROM db2.t1`
--let $assert_text= Table t1 in db3 have different row count than t1 in db2
--let $assert_cond= $db3_count=1 AND $db2_count<>1
--source include/assert.inc

--echo CLEANUP

#--remove_file $MYSQLTEST_VARDIR/tmp/rewrite_noleak.sql
DROP DATABASE db1;
DROP DATABASE db2;
DROP DATABASE db3;

Youez - 2016 - github.com/yon3zu
LinuXploit