Commit 1ead85e6 authored by unknown's avatar unknown

Fixes after merge


mysql-test/std_data/trunc_binlog.000001:
  Rename: mysql-test/std_data/trunc_binlog.001 -> mysql-test/std_data/trunc_binlog.000001
client/mysqltest.c:
  Fixed merge problem
mysql-test/mysql-test-run.sh:
  Fixed merge problem
mysql-test/r/distinct.result:
  Fix after merge
mysql-test/r/drop_temp_table.result:
  Fix after merge
mysql-test/r/join_outer.result:
  Fix after merge
mysql-test/r/mysqldump.result:
  Fix after merge
mysql-test/r/null_key.result:
  Fix after merge
mysql-test/r/order_by.result:
  Fix after merge
mysql-test/r/rpl_alter.result:
  Fix after merge
mysql-test/r/rpl_loaddata.result:
  Fix after merge
mysql-test/r/rpl_loaddata_rule_m.result:
  Fix after merge
mysql-test/r/rpl_trunc_binlog.result:
  Fix after merge
mysql-test/r/select_safe.result:
  Fix after merge
mysql-test/t/insert.test:
  Fix after merge
mysql-test/t/mysqlbinlog.test:
  Fix after merge
mysql-test/t/rpl000009.test:
  Fix after merge
mysql-test/t/rpl_alter.test:
  Fix after merge
mysql-test/t/rpl_loaddata_rule_m.test:
  Fix after merge
mysql-test/t/rpl_trunc_binlog.test:
  Fix after merge
sql-common/client.c:
  Fix after merge
sql/item_subselect.cc:
  Fix after merge
sql/repl_failsafe.cc:
  Fix after merge
sql/slave.cc:
  Fix after merge
sql/sql_insert.cc:
  Fix after merge
parent 118d5321
......@@ -125,6 +125,7 @@ static int block_stack[BLOCK_STACK_DEPTH];
static int block_ok_stack[BLOCK_STACK_DEPTH];
static uint global_expected_errno[MAX_EXPECTED_ERRORS], global_expected_errors;
static CHARSET_INFO *charset_info= &my_charset_latin1;
static int embedded_server_arg_count=0;
static char *embedded_server_args[MAX_SERVER_ARGS];
......@@ -716,7 +717,7 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
MYSQL* mysql = &cur_con->mysql;
for (;;)
{
MYSQL_RES* res;
MYSQL_RES *res;
MYSQL_ROW row;
int done;
LINT_INIT(res);
......@@ -770,9 +771,7 @@ int do_server_op(struct st_query* q,const char* op)
if (!*p)
die("Missing server name in server_%s\n",op);
while (*p && !my_isspace(charset_info,*p))
{
*com_p++=*p++;
}
*com_p++= *p++;
*com_p++=' ';
com_p=int10_to_str(manager_wait_timeout,com_p,10);
*com_p++ = '\n';
......@@ -864,7 +863,7 @@ int do_exec(struct st_query* q)
FILE *res_file;
char *cmd= q->first_argument;
while (*cmd && isspace(*cmd))
while (*cmd && my_isspace(charset_info, *cmd))
cmd++;
if (!*cmd)
die("Missing argument in exec\n");
......
......@@ -437,6 +437,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog"
else
MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog"
fi
if [ -n "$STRACE_CLIENT" ]; then
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
fi
......
......@@ -303,9 +303,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct
1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct
1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
1 SIMPLE t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
1 SIMPLE t2_lj ref id id 4 test.j_lj_t2.id 1 Using where; Using index; Distinct
1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
1 SIMPLE t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
1 SIMPLE t3_lj ref id id 4 test.j_lj_t3.id 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
......
......@@ -10,9 +10,9 @@ get_lock("a",10)
1
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
master-bin.001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
master-bin.001 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
master-bin.000001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
master-bin.000001 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
......@@ -614,7 +614,7 @@ INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
1 SIMPLE t2 ref id id 4 t1.id 1 Using where; Using index; Not exists
1 SIMPLE t2 ref id id 4 test.t1.id 1 Using where; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
......
......@@ -4,6 +4,8 @@ INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?>
<mysqldump>
<database name="test">
DROP TABLE IF EXISTS t1;
LOCK TABLES t1 WRITE;
<table name="t1">
<row>
<field name="a">1</field>
......@@ -12,6 +14,7 @@ INSERT INTO t1 VALUES (1), (2);
<field name="a">2</field>
</row>
</table>
UNLOCK TABLES;
</database>
</mysqldump>
DROP TABLE t1;
......@@ -153,12 +153,12 @@ a b
7 NULL
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a,b a 10 NULL 3 Using where; Using index
1 SIMPLE t1 ref_or_null a,b a 5 const 4 Using where; Using index
select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
a b
NULL 7
7 NULL
7 7
NULL 7
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref_or_null a a 5 const 5 Using where; Using index
......
......@@ -470,8 +470,8 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.gid 1 Using where
1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
......@@ -480,7 +480,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t3.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
......
......@@ -4,18 +4,18 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists test_$1;
create database test_$1;
create table test_$1.t1 ( n int);
alter table test_$1.t1 add m int;
insert into test_$1.t1 values (1,2);
create table test_$1.t2 (n int);
insert into test_$1.t2 values (45);
rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
select * from test_$1.t2;
drop database if exists mysqltest;
create database mysqltest;
create table mysqltest.t1 ( n int);
alter table mysqltest.t1 add m int;
insert into mysqltest.t1 values (1,2);
create table mysqltest.t2 (n int);
insert into mysqltest.t2 values (45);
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
select * from mysqltest.t2;
n m
1 2
select * from test_$1.t3;
select * from mysqltest.t3;
n
45
drop database test_$1;
drop database mysqltest;
......@@ -61,8 +61,8 @@ unique(day));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
Duplicate entry '2003-03-22' for key 1
ERROR 23000: Duplicate entry '2003-03-22' for key 1
show master status;
File Position Binlog_do_db Binlog_ignore_db
master-bin.001 491
master-bin.000001 491
drop table t2;
......@@ -4,11 +4,12 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
drop database if exists mysqltest;
reset master;
create database test2;
create database mysqltest;
create table t1(a int, b int, unique(b));
use test2;
use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
drop database test2;
drop database mysqltest;
slave stop;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start;
start slave;
stop slave;
flush logs;
reset slave;
start slave;
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 161 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 317
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space Until_condition Until_Log_File Until_Log_pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key
127.0.0.1 root MASTER_PORT 1 master-bin.000002 4 slave-relay-bin.000002 123 master-bin.000001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 326 None 0 No
reset master;
......@@ -70,7 +70,7 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ref b b 21 t1.b 6 Using where
1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where
set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
......
......@@ -80,10 +80,10 @@ drop table t1,t2;
#
--disable_warnings
drop database if exists test_$1;
drop database if exists mysqltest;
--enable_warnings
create database test_$1;
use test_$1;
create database mysqltest;
use mysqltest;
create table t1 (c int);
insert into test_$1.t1 set test_$1.t1.c = '1';
drop database test_$1;
insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database mysqltest;
......@@ -39,28 +39,28 @@ select "--- Local --" as "";
#
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.001
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
# this should not fail but shouldn't produce any working statements
--disable_query_log
select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.002
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000002
# this should show almost nothing
--disable_query_log
select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.001
--exec $MYSQL_BINLOG --short-form --database=nottest $MYSQL_TEST_DIR/var/log/master-bin.000001
# this test for position option
--disable_query_log
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --position=27 $MYSQL_TEST_DIR/var/log/master-bin.002
--exec $MYSQL_BINLOG --short-form --position=27 $MYSQL_TEST_DIR/var/log/master-bin.000002
# These are tests for remote binlog.
# They should return the same as previous test.
......@@ -74,30 +74,30 @@ select "--- Remote --" as "";
--enable_query_log
# This is broken now
# By the way it seems that remote version fetches all events with name >= master-bin.001
# By the way it seems that remote version fetches all events with name >= master-bin.000001
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.001
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
# This is broken too
--disable_query_log
select "--- Broken LOAD DATA --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
# And this too ! (altough it is documented)
--disable_query_log
select "--- --database --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.001
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --database=nottest master-bin.000001
# Strangely but this works
--disable_query_log
select "--- --position --" as "";
--enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
--exec $MYSQL_BINLOG --short-form --read-from-remote-server --position=27 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.002
# clean up
drop table t1;
......@@ -3,9 +3,15 @@
source include/master-slave.inc;
--disable_warnings
drop database if exists mysqltest;
drop database if exists mysqltest2;
create database mysqltest2;
drop database if exists mysqltest3;
connection slave;
drop database if exists mysqltest;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
connection master;
create database mysqltest2;
create database mysqltest;
--enable_warnings
......@@ -60,38 +66,42 @@ sync_with_master;
# This should show that the slave is empty at this point
show databases;
# Create foo and foo2 on slave; we expect that LOAD DATA FROM MASTER will
# neither touch database foo nor foo2.
create database foo;
create table foo.t1(n int, s char(20));
insert into foo.t1 values (1, 'original foo.t1');
create table foo.t3(n int, s char(20));
insert into foo.t3 values (1, 'original foo.t3');
create database foo2;
create table foo2.t1(n int, s char(20));
insert into foo2.t1 values (1, 'original foo2.t1');
# Create bar, and bar.t1, to check that it gets replaced,
# and bar.t3 to check that it is not touched (there is no bar.t3 on master)
create database bar;
create table bar.t1(n int, s char(20));
insert into bar.t1 values (1, 'original bar.t1');
create table bar.t3(n int, s char(20));
insert into bar.t3 values (1, 'original bar.t3');
# Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
# MASTER will neither touch database mysqltest nor mysqltest3
create database mysqltest2;
create table mysqltest2.t1(n int, s char(20));
insert into mysqltest2.t1 values (1, 'original foo.t1');
create table mysqltest2.t3(n int, s char(20));
insert into mysqltest2.t3 values (1, 'original foo.t3');
create database mysqltest3;
create table mysqltest3.t1(n int, s char(20));
insert into mysqltest3.t1 values (1, 'original foo2.t1');
# Create mysqltest, and mysqltest.t1, to check that it gets replaced,
# and mysqltest.t3 to check that it is not touched (there is no
# mysqltest.t3 on master)
create database mysqltest;
create table mysqltest.t1(n int, s char(20));
insert into mysqltest.t1 values (1, 'original bar.t1');
create table mysqltest.t3(n int, s char(20));
insert into mysqltest.t3 values (1, 'original bar.t3');
load data from master;
# Now let's check if we have the right tables and the right data in them
show databases;
use mysqltest2;
# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which databases
# have to be copied. So it thinks "foo" has to be copied. Before 4.0.16 it would
# first drop "foo", then create "foo". This "drop" is a bug; in that case t3
# would disappear.
# So here the effect of this bug (BUG#1248) would be to leave an empty "foo" on
# the slave.
# LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
# databases have to be copied. So it thinks "mysqltest" has to be
# copied. Before 4.0.16 it would first drop "mysqltest", then create
# "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
# here the effect of this bug (BUG#1248) would be to leave an empty
# "mysqltest" on the slave.
show tables; # should be t1 & t3
select * from t1; # should be slave's original
use foo2;
use mysqltest3;
show tables; # should be t1
select * from t1; # should be slave's original
use mysqltest;
......@@ -111,19 +121,24 @@ select * from mysqltest.t1;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten.
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX
# insert into bar.t1 values(10, 'should be there');
# insert into mysqltest.t1 values(10, 'should be there');
# flush tables;
# system chmod 500 var/slave-data/bar/;
# system chmod 500 var/slave-data/mysqltest/;
# --error 6
# load data from master; # should fail (errno 13)
# system chmod 700 var/slave-data/bar/;
# select * from bar.t1; # should contain the row (10, ...)
# system chmod 700 var/slave-data/mysqltest/;
# select * from mysqltest.t1; # should contain the row (10, ...)
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave
--error 1050
load table bar.t1 from master;
drop table bar.t1;
load table mysqltest.t1 from master;
drop table mysqltest.t1;
load table mysqltest.t1 from master;
# Check what happens when requestion not existing table
#
--error 1188
load table bar.t1 from master;
# as LOAD DATA FROM MASTER failed it did not restart slave threads
......@@ -137,5 +152,6 @@ drop database mysqltest2;
save_master_pos;
connection slave;
sync_with_master;
drop database mysqltest;
# These has to be droped on slave as they are not replicated
drop database mysqltest2;
drop database mysqltest3;
source include/master-slave.inc;
--disable_warnings
drop database if exists test_$1;
drop database if exists mysqltest;
--enable_warnings
create database test_$1;
create database mysqltest;
create table test_$1.t1 ( n int);
alter table test_$1.t1 add m int;
insert into test_$1.t1 values (1,2);
create table test_$1.t2 (n int);
insert into test_$1.t2 values (45);
rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2;
create table mysqltest.t1 ( n int);
alter table mysqltest.t1 add m int;
insert into mysqltest.t1 values (1,2);
create table mysqltest.t2 (n int);
insert into mysqltest.t2 values (45);
rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
save_master_pos;
connection slave;
sync_with_master;
select * from test_$1.t2;
select * from test_$1.t3;
select * from mysqltest.t2;
select * from mysqltest.t3;
connection master;
drop database test_$1;
drop database mysqltest;
save_master_pos;
connection slave;
sync_with_master;
......@@ -3,6 +3,11 @@
# This is for BUG#1100 (LOAD DATA INFILE was half-logged).
source include/master-slave.inc;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection slave;
reset master;
......@@ -10,9 +15,9 @@ reset master;
connection master;
# 'test' is the current database
create database test2;
create database mysqltest;
create table t1(a int, b int, unique(b));
use test2;
use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79; # should be nothing
drop database test2;
drop database mysqltest;
# We are testing if a binlog which contains BEGIN but not COMMIT (the master did
# while writing the transaction to the binlog) triggers an error on slave.
# So we use such a truncated binlog and simulate that the master restarted after
# this.
# We are testing if a binlog which contains BEGIN but not COMMIT (the
# master did while writing the transaction to the binlog) triggers an
# error on slave. So we use such a truncated binlog and simulate that
# the master restarted after this.
source include/master-slave.inc;
......@@ -9,8 +9,8 @@ connection slave;
stop slave;
connection master;
flush logs;
system mv -f var/log/master-bin.001 var/log/master-bin.002;
system cp std_data/trunc_binlog.001 var/log/master-bin.001;
system mv -f var/log/master-bin.000001 var/log/master-bin.000002;
system cp std_data/trunc_binlog.000001 var/log/master-bin.000001;
connection slave;
reset slave;
start slave;
......
......@@ -1317,10 +1317,6 @@ mysql_init(MYSQL *mysql)
#ifndef TO_BE_DELETED
mysql->rpl_pivot = 1;
#endif
#if defined(SIGPIPE) && defined(THREAD) && !defined(__WIN__) && !defined(MYSQL_SERVER)
if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
(void) signal(SIGPIPE,pipe_sig_handler);
#endif
/*
Only enable LOAD DATA INFILE by default if configured with
......
......@@ -1096,7 +1096,6 @@ int subselect_indexsubquery_engine::exec()
/* Check if there exists a row with a null value in the index */
if ((error= (safe_index_read(tab) == 1)))
break;
}
}
}
}
......
......@@ -755,6 +755,8 @@ int load_master_data(THD* thd)
int error = 0;
const char* errmsg=0;
int restart_thread_mask;
HA_CREATE_INFO create_info;
mysql_init(&mysql);
/*
......@@ -858,7 +860,10 @@ int load_master_data(THD* thd)
continue;
}
if (mysql_create_db(thd, db, HA_LEX_CREATE_IF_NOT_EXISTS, 1))
bzero((char*) &create_info, sizeof(create_info));
create_info.options= HA_LEX_CREATE_IF_NOT_EXISTS;
if (mysql_create_db(thd, db, &create_info, 1))
{
send_error(thd, 0, 0);
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
......
......@@ -1125,12 +1125,13 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
handler *file;
ulong save_options;
NET *net= &mysql->net;
DBUG_ENTER("create_table_from_dump");
packet_len= my_net_read(net); // read create table statement
if (packet_len == packet_error)
{
send_error(thd, ER_MASTER_NET_READ);
return 1;
DBUG_RETURN(1);
}
if (net->read_pos[0] == 255) // error from master
{
......@@ -1139,7 +1140,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3);
net_printf(thd, ER_MASTER, err_msg);
return 1;
DBUG_RETURN(1);
}
thd->command = COM_TABLE_DUMP;
thd->query_length= packet_len;
......@@ -1148,12 +1149,23 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
{
sql_print_error("create_table_from_dump: out of memory");
net_printf(thd, ER_GET_ERRNO, "Out of memory");
return 1;
DBUG_RETURN(1);
}
thd->query= query;
thd->query_error = 0;
thd->net.no_send_ok = 1;
bzero((char*) &tables,sizeof(tables));
tables.db = (char*)db;
tables.alias= tables.real_name= (char*)table_name;
/* Drop the table if 'overwrite' is true */
if (overwrite && mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
{
send_error(thd);
sql_print_error("create_table_from_dump: failed to drop the table");
goto err;
}
/* Create the table. We do not want to log the "create table" statement */
save_options = thd->options;
thd->options &= ~(ulong) (OPTION_BIN_LOG);
......@@ -1207,7 +1219,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
err:
close_thread_tables(thd);
thd->net.no_send_ok = 0;
return error;
DBUG_RETURN(error);
}
......@@ -3431,15 +3443,15 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
case STOP_EVENT:
/*
We needn't write this event to the relay log. Indeed, it just indicates a
master server shutdown. The only thing this does is cleaning. But cleaning
is already done on a per-master-thread basis (as the master server is
shutting down cleanly, it has written all DROP TEMPORARY TABLE and DO
RELEASE_LOCK; prepared statements' deletion are TODO).
master server shutdown. The only thing this does is cleaning. But
cleaning is already done on a per-master-thread basis (as the master
server is shutting down cleanly, it has written all DROP TEMPORARY TABLE
and DO RELEASE_LOCK; prepared statements' deletion are TODO).
We don't even increment mi->master_log_pos, because we may be just after a
Rotate event. Btw, in a few milliseconds we are going to have a Start
event from the next binlog (unless the master is presently running without
--log-bin).
We don't even increment mi->master_log_pos, because we may be just after
a Rotate event. Btw, in a few milliseconds we are going to have a Start
event from the next binlog (unless the master is presently running
without --log-bin).
*/
goto err;
case ROTATE_EVENT:
......@@ -3465,8 +3477,8 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
/*
If this event is originating from this server, don't queue it.
We don't check this for 3.23 events because it's simpler like this; 3.23
will be filtered anyway by the SQL slave thread which also tests the server
id (we must also keep this test in the SQL thread, in case somebody
will be filtered anyway by the SQL slave thread which also tests the
server id (we must also keep this test in the SQL thread, in case somebody
upgrades a 4.0 slave which has a not-filtered relay log).
ANY event coming from ourselves can be ignored: it is obvious for queries;
......
......@@ -1438,15 +1438,17 @@ bool select_insert::send_data(List<Item> &values)
void select_insert::send_error(uint errcode,const char *err)
{
DBUG_ENTER("select_insert::send_error");
//TODO error should be sent at the query processing end
::send_error(thd,errcode,err);
table->file->extra(HA_EXTRA_NO_CACHE);
table->file->activate_all_index(thd);
/*
If at least one row has been inserted/modified and will stay in the table
(the table doesn't have transactions) (example: we got a duplicate key
error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop).
/*
If at least one row has been inserted/modified and will stay in the table
(the table doesn't have transactions) (example: we got a duplicate key
error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop).
*/
if ((info.copied || info.deleted) && !table->file->has_transactions())
{
......@@ -1465,6 +1467,7 @@ void select_insert::send_error(uint errcode,const char *err)
if (info.copied || info.deleted)
query_cache_invalidate3(thd, table, 1);
ha_rollback_stmt(thd);
DBUG_VOID_RETURN;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment