Commit a8d0df3a 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 9357319d
...@@ -125,6 +125,7 @@ static int block_stack[BLOCK_STACK_DEPTH]; ...@@ -125,6 +125,7 @@ static int block_stack[BLOCK_STACK_DEPTH];
static int block_ok_stack[BLOCK_STACK_DEPTH]; static int block_ok_stack[BLOCK_STACK_DEPTH];
static uint global_expected_errno[MAX_EXPECTED_ERRORS], global_expected_errors; 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 int embedded_server_arg_count=0;
static char *embedded_server_args[MAX_SERVER_ARGS]; 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))) ...@@ -716,7 +717,7 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused)))
MYSQL* mysql = &cur_con->mysql; MYSQL* mysql = &cur_con->mysql;
for (;;) for (;;)
{ {
MYSQL_RES* res; MYSQL_RES *res;
MYSQL_ROW row; MYSQL_ROW row;
int done; int done;
LINT_INIT(res); LINT_INIT(res);
...@@ -770,9 +771,7 @@ int do_server_op(struct st_query* q,const char* op) ...@@ -770,9 +771,7 @@ int do_server_op(struct st_query* q,const char* op)
if (!*p) if (!*p)
die("Missing server name in server_%s\n",op); die("Missing server name in server_%s\n",op);
while (*p && !my_isspace(charset_info,*p)) while (*p && !my_isspace(charset_info,*p))
{ *com_p++= *p++;
*com_p++=*p++;
}
*com_p++=' '; *com_p++=' ';
com_p=int10_to_str(manager_wait_timeout,com_p,10); com_p=int10_to_str(manager_wait_timeout,com_p,10);
*com_p++ = '\n'; *com_p++ = '\n';
...@@ -864,7 +863,7 @@ int do_exec(struct st_query* q) ...@@ -864,7 +863,7 @@ int do_exec(struct st_query* q)
FILE *res_file; FILE *res_file;
char *cmd= q->first_argument; char *cmd= q->first_argument;
while (*cmd && isspace(*cmd)) while (*cmd && my_isspace(charset_info, *cmd))
cmd++; cmd++;
if (!*cmd) if (!*cmd)
die("Missing argument in exec\n"); die("Missing argument in exec\n");
......
...@@ -437,6 +437,7 @@ if [ x$SOURCE_DIST = x1 ] ; then ...@@ -437,6 +437,7 @@ if [ x$SOURCE_DIST = x1 ] ; then
MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog" MYSQL_BINLOG="$BASEDIR/client/.libs/mysqlbinlog"
else else
MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog" MYSQL_BINLOG="$BASEDIR/client/mysqlbinlog"
fi
if [ -n "$STRACE_CLIENT" ]; then if [ -n "$STRACE_CLIENT" ]; then
MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST" MYSQL_TEST="strace -o $MYSQL_TEST_DIR/var/log/mysqltest.strace $MYSQL_TEST"
fi fi
......
...@@ -303,9 +303,9 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -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 t2 index id id 8 NULL 1 Using index; Distinct
1 SIMPLE t3 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 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 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 SELECT DISTINCT
t1.id t1.id
from from
......
...@@ -10,9 +10,9 @@ get_lock("a",10) ...@@ -10,9 +10,9 @@ get_lock("a",10)
1 1
show binlog events; show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info 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.000001 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.000001 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.000001 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.000001 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 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`; drop database `drop-temp+table-test`;
...@@ -614,7 +614,7 @@ INSERT INTO t2 VALUES (1,1); ...@@ -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; 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 id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 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; SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx id name id idx
2 no NULL NULL 2 no NULL NULL
......
...@@ -4,6 +4,8 @@ INSERT INTO t1 VALUES (1), (2); ...@@ -4,6 +4,8 @@ INSERT INTO t1 VALUES (1), (2);
<?xml version="1.0"?> <?xml version="1.0"?>
<mysqldump> <mysqldump>
<database name="test"> <database name="test">
DROP TABLE IF EXISTS t1;
LOCK TABLES t1 WRITE;
<table name="t1"> <table name="t1">
<row> <row>
<field name="a">1</field> <field name="a">1</field>
...@@ -12,6 +14,7 @@ INSERT INTO t1 VALUES (1), (2); ...@@ -12,6 +14,7 @@ INSERT INTO t1 VALUES (1), (2);
<field name="a">2</field> <field name="a">2</field>
</row> </row>
</table> </table>
UNLOCK TABLES;
</database> </database>
</mysqldump> </mysqldump>
DROP TABLE t1; DROP TABLE t1;
...@@ -153,12 +153,12 @@ a b ...@@ -153,12 +153,12 @@ a b
7 NULL 7 NULL
explain select * from t1 where (a = 7 or a is null) and (b=7 or b is 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 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); select * from t1 where (a = 7 or a is null) and (b=7 or b is null);
a b a b
NULL 7
7 NULL 7 NULL
7 7 7 7
NULL 7
explain select * from t1 where (a = 7 or a is null) and (a = 7 or a is null); 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 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 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 ...@@ -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 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; 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 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 ALL PRIMARY NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 test.t1.gid 1 Using where 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; 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 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 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 ...@@ -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; 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 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 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; 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 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 1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
......
...@@ -4,18 +4,18 @@ reset master; ...@@ -4,18 +4,18 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
drop database if exists test_$1; drop database if exists mysqltest;
create database test_$1; create database mysqltest;
create table test_$1.t1 ( n int); create table mysqltest.t1 ( n int);
alter table test_$1.t1 add m int; alter table mysqltest.t1 add m int;
insert into test_$1.t1 values (1,2); insert into mysqltest.t1 values (1,2);
create table test_$1.t2 (n int); create table mysqltest.t2 (n int);
insert into test_$1.t2 values (45); insert into mysqltest.t2 values (45);
rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
select * from test_$1.t2; select * from mysqltest.t2;
n m n m
1 2 1 2
select * from test_$1.t3; select * from mysqltest.t3;
n n
45 45
drop database test_$1; drop database mysqltest;
...@@ -61,8 +61,8 @@ unique(day)); ...@@ -61,8 +61,8 @@ unique(day));
load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines; '\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; show master status;
File Position Binlog_do_db Binlog_ignore_db File Position Binlog_do_db Binlog_ignore_db
master-bin.001 491 master-bin.000001 491
drop table t2; drop table t2;
...@@ -4,11 +4,12 @@ reset master; ...@@ -4,11 +4,12 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
drop database if exists mysqltest;
reset master; reset master;
create database test2; create database mysqltest;
create table t1(a int, b int, unique(b)); 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; load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79; show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info 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; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master; reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
slave start; start slave;
stop slave; stop slave;
flush logs; flush logs;
reset slave; reset slave;
start slave; start slave;
show slave status; 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 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.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 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; reset master;
...@@ -70,7 +70,7 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu ...@@ -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; 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 id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21 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; set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; 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 id select_type table type possible_keys key key_len ref rows Extra
......
...@@ -80,10 +80,10 @@ drop table t1,t2; ...@@ -80,10 +80,10 @@ drop table t1,t2;
# #
--disable_warnings --disable_warnings
drop database if exists test_$1; drop database if exists mysqltest;
--enable_warnings --enable_warnings
create database test_$1; create database mysqltest;
use test_$1; use mysqltest;
create table t1 (c int); create table t1 (c int);
insert into test_$1.t1 set test_$1.t1.c = '1'; insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database test_$1; drop database mysqltest;
...@@ -39,28 +39,28 @@ select "--- Local --" as ""; ...@@ -39,28 +39,28 @@ select "--- Local --" as "";
# #
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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 # this should not fail but shouldn't produce any working statements
--disable_query_log --disable_query_log
select "--- Broken LOAD DATA --" as ""; select "--- Broken LOAD DATA --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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 # this should show almost nothing
--disable_query_log --disable_query_log
select "--- --database --" as ""; select "--- --database --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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 # this test for position option
--disable_query_log --disable_query_log
select "--- --position --" as ""; select "--- --position --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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. # These are tests for remote binlog.
# They should return the same as previous test. # They should return the same as previous test.
...@@ -74,30 +74,30 @@ select "--- Remote --" as ""; ...@@ -74,30 +74,30 @@ select "--- Remote --" as "";
--enable_query_log --enable_query_log
# This is broken now # 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 --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 # This is broken too
--disable_query_log --disable_query_log
select "--- Broken LOAD DATA --" as ""; select "--- Broken LOAD DATA --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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) # And this too ! (altough it is documented)
--disable_query_log --disable_query_log
select "--- --database --" as ""; select "--- --database --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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 # Strangely but this works
--disable_query_log --disable_query_log
select "--- --position --" as ""; select "--- --position --" as "";
--enable_query_log --enable_query_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --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 # clean up
drop table t1; drop table t1;
...@@ -3,9 +3,15 @@ ...@@ -3,9 +3,15 @@
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings --disable_warnings
drop database if exists mysqltest;
drop database if exists mysqltest2; drop database if exists mysqltest2;
create database mysqltest2; drop database if exists mysqltest3;
connection slave;
drop database if exists mysqltest; drop database if exists mysqltest;
drop database if exists mysqltest2;
drop database if exists mysqltest3;
connection master;
create database mysqltest2;
create database mysqltest; create database mysqltest;
--enable_warnings --enable_warnings
...@@ -60,38 +66,42 @@ sync_with_master; ...@@ -60,38 +66,42 @@ sync_with_master;
# This should show that the slave is empty at this point # This should show that the slave is empty at this point
show databases; show databases;
# Create foo and foo2 on slave; we expect that LOAD DATA FROM MASTER will # Create mysqltest2 and mysqltest3 on slave; we expect that LOAD DATA FROM
# neither touch database foo nor foo2. # MASTER will neither touch database mysqltest nor mysqltest3
create database foo; create database mysqltest2;
create table foo.t1(n int, s char(20)); create table mysqltest2.t1(n int, s char(20));
insert into foo.t1 values (1, 'original foo.t1'); insert into mysqltest2.t1 values (1, 'original foo.t1');
create table foo.t3(n int, s char(20)); create table mysqltest2.t3(n int, s char(20));
insert into foo.t3 values (1, 'original foo.t3'); insert into mysqltest2.t3 values (1, 'original foo.t3');
create database foo2; create database mysqltest3;
create table foo2.t1(n int, s char(20)); create table mysqltest3.t1(n int, s char(20));
insert into foo2.t1 values (1, 'original foo2.t1'); insert into mysqltest3.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 mysqltest, and mysqltest.t1, to check that it gets replaced,
create database bar; # and mysqltest.t3 to check that it is not touched (there is no
create table bar.t1(n int, s char(20)); # mysqltest.t3 on master)
insert into bar.t1 values (1, 'original bar.t1'); create database mysqltest;
create table bar.t3(n int, s char(20)); create table mysqltest.t1(n int, s char(20));
insert into bar.t3 values (1, 'original bar.t3'); 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; load data from master;
# Now let's check if we have the right tables and the right data in them # Now let's check if we have the right tables and the right data in them
show databases; show databases;
use mysqltest2; 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 # LOAD DATA FROM MASTER uses only replicate_*_db rules to decide which
# first drop "foo", then create "foo". This "drop" is a bug; in that case t3 # databases have to be copied. So it thinks "mysqltest" has to be
# would disappear. # copied. Before 4.0.16 it would first drop "mysqltest", then create
# So here the effect of this bug (BUG#1248) would be to leave an empty "foo" on # "mysqltest". This "drop" is a bug; in that case t3 would disappear. So
# the slave. # here the effect of this bug (BUG#1248) would be to leave an empty
# "mysqltest" on the slave.
show tables; # should be t1 & t3 show tables; # should be t1 & t3
select * from t1; # should be slave's original select * from t1; # should be slave's original
use foo2; use mysqltest3;
show tables; # should be t1 show tables; # should be t1
select * from t1; # should be slave's original select * from t1; # should be slave's original
use mysqltest; use mysqltest;
...@@ -111,19 +121,24 @@ select * from mysqltest.t1; ...@@ -111,19 +121,24 @@ select * from mysqltest.t1;
# Check that LOAD DATA FROM MASTER reports the error if it can't drop a # Check that LOAD DATA FROM MASTER reports the error if it can't drop a
# table to be overwritten. # table to be overwritten.
# DISABLED FOR NOW AS chmod IS NOT PORTABLE ON NON-UNIX # 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; # flush tables;
# system chmod 500 var/slave-data/bar/; # system chmod 500 var/slave-data/mysqltest/;
# --error 6 # --error 6
# load data from master; # should fail (errno 13) # load data from master; # should fail (errno 13)
# system chmod 700 var/slave-data/bar/; # system chmod 700 var/slave-data/mysqltest/;
# select * from bar.t1; # should contain the row (10, ...) # select * from mysqltest.t1; # should contain the row (10, ...)
# Check that LOAD TABLE FROM MASTER fails if the table exists on slave # Check that LOAD TABLE FROM MASTER fails if the table exists on slave
--error 1050 --error 1050
load table bar.t1 from master; load table mysqltest.t1 from master;
drop table bar.t1; 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; load table bar.t1 from master;
# as LOAD DATA FROM MASTER failed it did not restart slave threads # as LOAD DATA FROM MASTER failed it did not restart slave threads
...@@ -137,5 +152,6 @@ drop database mysqltest2; ...@@ -137,5 +152,6 @@ drop database mysqltest2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
drop database mysqltest; # These has to be droped on slave as they are not replicated
drop database mysqltest2; drop database mysqltest2;
drop database mysqltest3;
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings --disable_warnings
drop database if exists test_$1; drop database if exists mysqltest;
--enable_warnings --enable_warnings
create database test_$1; create database mysqltest;
create table test_$1.t1 ( n int); create table mysqltest.t1 ( n int);
alter table test_$1.t1 add m int; alter table mysqltest.t1 add m int;
insert into test_$1.t1 values (1,2); insert into mysqltest.t1 values (1,2);
create table test_$1.t2 (n int); create table mysqltest.t2 (n int);
insert into test_$1.t2 values (45); insert into mysqltest.t2 values (45);
rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; rename table mysqltest.t2 to mysqltest.t3, mysqltest.t1 to mysqltest.t2;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
select * from test_$1.t2; select * from mysqltest.t2;
select * from test_$1.t3; select * from mysqltest.t3;
connection master; connection master;
drop database test_$1; drop database mysqltest;
save_master_pos; save_master_pos;
connection slave; connection slave;
sync_with_master; sync_with_master;
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
# This is for BUG#1100 (LOAD DATA INFILE was half-logged). # This is for BUG#1100 (LOAD DATA INFILE was half-logged).
source include/master-slave.inc; source include/master-slave.inc;
--disable_warnings
drop database if exists mysqltest;
--enable_warnings
connection slave; connection slave;
reset master; reset master;
...@@ -10,9 +15,9 @@ reset master; ...@@ -10,9 +15,9 @@ reset master;
connection master; connection master;
# 'test' is the current database # 'test' is the current database
create database test2; create database mysqltest;
create table t1(a int, b int, unique(b)); 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; load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79; # should be nothing 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 # We are testing if a binlog which contains BEGIN but not COMMIT (the
# while writing the transaction to the binlog) triggers an error on slave. # master did while writing the transaction to the binlog) triggers an
# So we use such a truncated binlog and simulate that the master restarted after # error on slave. So we use such a truncated binlog and simulate that
# this. # the master restarted after this.
source include/master-slave.inc; source include/master-slave.inc;
...@@ -9,8 +9,8 @@ connection slave; ...@@ -9,8 +9,8 @@ connection slave;
stop slave; stop slave;
connection master; connection master;
flush logs; flush logs;
system mv -f var/log/master-bin.001 var/log/master-bin.002; system mv -f var/log/master-bin.000001 var/log/master-bin.000002;
system cp std_data/trunc_binlog.001 var/log/master-bin.001; system cp std_data/trunc_binlog.000001 var/log/master-bin.000001;
connection slave; connection slave;
reset slave; reset slave;
start slave; start slave;
......
...@@ -1317,10 +1317,6 @@ mysql_init(MYSQL *mysql) ...@@ -1317,10 +1317,6 @@ mysql_init(MYSQL *mysql)
#ifndef TO_BE_DELETED #ifndef TO_BE_DELETED
mysql->rpl_pivot = 1; mysql->rpl_pivot = 1;
#endif #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 Only enable LOAD DATA INFILE by default if configured with
......
...@@ -1096,7 +1096,6 @@ int subselect_indexsubquery_engine::exec() ...@@ -1096,7 +1096,6 @@ int subselect_indexsubquery_engine::exec()
/* Check if there exists a row with a null value in the index */ /* Check if there exists a row with a null value in the index */
if ((error= (safe_index_read(tab) == 1))) if ((error= (safe_index_read(tab) == 1)))
break; break;
}
} }
} }
} }
......
...@@ -755,6 +755,8 @@ int load_master_data(THD* thd) ...@@ -755,6 +755,8 @@ int load_master_data(THD* thd)
int error = 0; int error = 0;
const char* errmsg=0; const char* errmsg=0;
int restart_thread_mask; int restart_thread_mask;
HA_CREATE_INFO create_info;
mysql_init(&mysql); mysql_init(&mysql);
/* /*
...@@ -858,7 +860,10 @@ int load_master_data(THD* thd) ...@@ -858,7 +860,10 @@ int load_master_data(THD* thd)
continue; 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); send_error(thd, 0, 0);
cleanup_mysql_results(db_res, cur_table_res - 1, table_res); 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, ...@@ -1125,12 +1125,13 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
handler *file; handler *file;
ulong save_options; ulong save_options;
NET *net= &mysql->net; NET *net= &mysql->net;
DBUG_ENTER("create_table_from_dump");
packet_len= my_net_read(net); // read create table statement packet_len= my_net_read(net); // read create table statement
if (packet_len == packet_error) if (packet_len == packet_error)
{ {
send_error(thd, ER_MASTER_NET_READ); send_error(thd, ER_MASTER_NET_READ);
return 1; DBUG_RETURN(1);
} }
if (net->read_pos[0] == 255) // error from master 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, ...@@ -1139,7 +1140,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
CLIENT_PROTOCOL_41) ? CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3); 3+SQLSTATE_LENGTH+1 : 3);
net_printf(thd, ER_MASTER, err_msg); net_printf(thd, ER_MASTER, err_msg);
return 1; DBUG_RETURN(1);
} }
thd->command = COM_TABLE_DUMP; thd->command = COM_TABLE_DUMP;
thd->query_length= packet_len; thd->query_length= packet_len;
...@@ -1148,12 +1149,23 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, ...@@ -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"); sql_print_error("create_table_from_dump: out of memory");
net_printf(thd, ER_GET_ERRNO, "Out of memory"); net_printf(thd, ER_GET_ERRNO, "Out of memory");
return 1; DBUG_RETURN(1);
} }
thd->query= query; thd->query= query;
thd->query_error = 0; thd->query_error = 0;
thd->net.no_send_ok = 1; 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 */ /* Create the table. We do not want to log the "create table" statement */
save_options = thd->options; save_options = thd->options;
thd->options &= ~(ulong) (OPTION_BIN_LOG); thd->options &= ~(ulong) (OPTION_BIN_LOG);
...@@ -1207,7 +1219,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db, ...@@ -1207,7 +1219,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
err: err:
close_thread_tables(thd); close_thread_tables(thd);
thd->net.no_send_ok = 0; 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) ...@@ -3431,15 +3443,15 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
case STOP_EVENT: case STOP_EVENT:
/* /*
We needn't write this event to the relay log. Indeed, it just indicates a 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 master server shutdown. The only thing this does is cleaning. But
is already done on a per-master-thread basis (as the master server is cleaning is already done on a per-master-thread basis (as the master
shutting down cleanly, it has written all DROP TEMPORARY TABLE and DO server is shutting down cleanly, it has written all DROP TEMPORARY TABLE
RELEASE_LOCK; prepared statements' deletion are TODO). 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 We don't even increment mi->master_log_pos, because we may be just after
Rotate event. Btw, in a few milliseconds we are going to have a Start 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 event from the next binlog (unless the master is presently running
--log-bin). without --log-bin).
*/ */
goto err; goto err;
case ROTATE_EVENT: case ROTATE_EVENT:
...@@ -3465,8 +3477,8 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) ...@@ -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. 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 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 will be filtered anyway by the SQL slave thread which also tests the
id (we must also keep this test in the SQL thread, in case somebody 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). 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; 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) ...@@ -1438,15 +1438,17 @@ bool select_insert::send_data(List<Item> &values)
void select_insert::send_error(uint errcode,const char *err) 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 //TODO error should be sent at the query processing end
::send_error(thd,errcode,err); ::send_error(thd,errcode,err);
table->file->extra(HA_EXTRA_NO_CACHE); table->file->extra(HA_EXTRA_NO_CACHE);
table->file->activate_all_index(thd); table->file->activate_all_index(thd);
/* /*
If at least one row has been inserted/modified and will stay in the table 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 (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 error while inserting into a MyISAM table) we must write to the binlog (and
the error code will make the slave stop). the error code will make the slave stop).
*/ */
if ((info.copied || info.deleted) && !table->file->has_transactions()) if ((info.copied || info.deleted) && !table->file->has_transactions())
{ {
...@@ -1465,6 +1467,7 @@ void select_insert::send_error(uint errcode,const char *err) ...@@ -1465,6 +1467,7 @@ void select_insert::send_error(uint errcode,const char *err)
if (info.copied || info.deleted) if (info.copied || info.deleted)
query_cache_invalidate3(thd, table, 1); query_cache_invalidate3(thd, table, 1);
ha_rollback_stmt(thd); 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