mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-20 01:06:35 +08:00
Merge changes.
This commit is contained in:
+12
-7
@@ -47,6 +47,11 @@ make_sandbox() {
|
||||
echo "skip-innodb" >> /tmp/$port/my.sandbox.cnf
|
||||
fi
|
||||
|
||||
# If the sandbox is a slave, set it read_only.
|
||||
if [ "$type" = "slave" ]; then
|
||||
echo "read_only" >> /tmp/$port/my.sandbox.cnf
|
||||
fi
|
||||
|
||||
# Start the sandbox and check that it has InnoDB.
|
||||
/tmp/$port/start
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -65,6 +70,12 @@ make_sandbox() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the sandbox is a slave, start the slave.
|
||||
if [ "$type" = "slave" ]; then
|
||||
/tmp/$port/use -e "change master to master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=$master_port"
|
||||
/tmp/$port/use -e "start slave"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -149,13 +160,7 @@ if [ -f $PIDFILE ]; then
|
||||
echo "Sandbox $port already started (found pid file $PIDFILE)"
|
||||
else
|
||||
make_sandbox
|
||||
|
||||
# If the sandbox is a slave, start the slave.
|
||||
if [ "$type" = "slave" ]; then
|
||||
/tmp/$port/use -e "change master to master_host='127.0.0.1', master_user='msandbox', master_password='msandbox', master_port=$master_port"
|
||||
/tmp/$port/use -e "start slave"
|
||||
/tmp/$port/use -e "set global read_only=1"
|
||||
fi
|
||||
# make_sandbox has started slave and set read_only if necessary.
|
||||
|
||||
# If the sandbox is a master-master, start the second master and slave the
|
||||
# two together.
|
||||
|
||||
@@ -7,7 +7,7 @@ create table table_1(
|
||||
c int not null,
|
||||
d varchar(50),
|
||||
key(b)
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
insert into table_1 values
|
||||
(1, 2, 3, 4),
|
||||
|
||||
@@ -15,7 +15,7 @@ CREATE TABLE `table_5` (
|
||||
h decimal(9,5) not null,
|
||||
i datetime not null,
|
||||
PRIMARY KEY (a,b,c,d)
|
||||
) type=InnoDB;
|
||||
) engine=InnoDB;
|
||||
CREATE TABLE `table_5_dest` (
|
||||
a date not null,
|
||||
b int not null,
|
||||
@@ -27,7 +27,7 @@ CREATE TABLE `table_5_dest` (
|
||||
h decimal(9,5) not null,
|
||||
i datetime not null,
|
||||
PRIMARY KEY (a,b,c,d)
|
||||
) type=InnoDB;
|
||||
) engine=InnoDB;
|
||||
CREATE TABLE `table_5_copy` (
|
||||
a date not null,
|
||||
b int not null,
|
||||
@@ -39,7 +39,7 @@ CREATE TABLE `table_5_copy` (
|
||||
h decimal(9,5) not null,
|
||||
i datetime not null,
|
||||
PRIMARY KEY (a,b,c,d)
|
||||
) type=InnoDB;
|
||||
) engine=InnoDB;
|
||||
|
||||
|
||||
INSERT INTO `table_5` VALUES (current_date - interval 2 day,581,'m','ga',1,16,0,'0.00402','2007-03-10 18:00:33')
|
||||
|
||||
@@ -14,14 +14,14 @@ create table table_1(
|
||||
c int not null,
|
||||
d varchar(50),
|
||||
key(b)
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
create table table_2(
|
||||
a int not null primary key auto_increment,
|
||||
b int,
|
||||
c int not null,
|
||||
d varchar(50)
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
create table table_3(
|
||||
a int not null,
|
||||
@@ -29,11 +29,11 @@ create table table_3(
|
||||
c int not null,
|
||||
d varchar(50),
|
||||
primary key(a, c)
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
create table table_4(
|
||||
a int
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
insert into table_1 values
|
||||
(1, 2, 3, 4),
|
||||
|
||||
@@ -9,7 +9,7 @@ create table table_7(
|
||||
b int not null,
|
||||
c int not null,
|
||||
primary key(a, b)
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
drop table if exists table_8;
|
||||
create table table_8 like table_7;
|
||||
@@ -19,7 +19,7 @@ create table table_9(
|
||||
a int not null primary key,
|
||||
b int not null,
|
||||
c int not null
|
||||
) type=innodb;
|
||||
) engine=innodb;
|
||||
|
||||
insert into table_7(a, b, c) values
|
||||
(1, 2, 1),
|
||||
|
||||
@@ -272,6 +272,16 @@ is(
|
||||
"USE only --replicate-database (binlog dump)"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Stop and start slaves to avoid sandbox breakage caused by restarting servers.
|
||||
# #############################################################################
|
||||
$slave1_dbh = $sb->get_dbh_for('slave1');
|
||||
$slave2_dbh = $sb->get_dbh_for('slave2');
|
||||
$slave1_dbh->do('STOP SLAVE');
|
||||
$slave2_dbh->do('STOP SLAVE');
|
||||
$slave1_dbh->do('START SLAVE');
|
||||
$slave2_dbh->do('START SLAVE');
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
||||
Reference in New Issue
Block a user