Commit 89f30200 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Removed random chars after filename for LOAD DATA INFILE (in mysqlbinlog)

Add quoting for use `database` for mysqlbinlog
Removed test ins0000001
Add support for --replace for exec in mysqltest
Don't refer to install dir in mysqlbinlog.result
parent 9d7014c0
...@@ -202,7 +202,7 @@ const char *Load_log_processor::create_file(Create_file_log_event *ce) ...@@ -202,7 +202,7 @@ const char *Load_log_processor::create_file(Create_file_log_event *ce)
return 0; return 0;
} }
} }
ce->set_fname_outside_temp_buf(tmp,full_len); ce->set_fname_outside_temp_buf(tmp,strlen(tmp));
return tmp; return tmp;
} }
...@@ -622,10 +622,11 @@ Could not read entry at offset %s : Error in log format or read error", ...@@ -622,10 +622,11 @@ Could not read entry at offset %s : Error in log format or read error",
} }
} }
/* /*
We print the event, but with a leading '#': this is just to inform the We print the event, but with a leading '#': this is just to inform
user of the original command; the command we want to execute will be a the user of the original command; the command we want to execute
derivation of this original command (we will change the filename and will be a derivation of this original command (we will change the
use LOCAL), prepared in the 'case EXEC_LOAD_EVENT' below. filename and use LOCAL), prepared in the 'case EXEC_LOAD_EVENT'
below.
*/ */
ce->print(result_file, short_form, last_db, true); ce->print(result_file, short_form, last_db, true);
load_processor.process(ce); load_processor.process(ce);
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
**********************************************************************/ **********************************************************************/
#define MTEST_VERSION "1.28" #define MTEST_VERSION "1.29"
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h> #include <mysql_embed.h>
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
#ifndef MYSQL_MANAGER_PORT #ifndef MYSQL_MANAGER_PORT
#define MYSQL_MANAGER_PORT 23546 #define MYSQL_MANAGER_PORT 23546
#endif #endif
#define MAX_SERVER_ARGS 20
/* /*
Sometimes in a test the client starts before Sometimes in a test the client starts before
...@@ -121,10 +122,19 @@ static int *block_ok_stack_end; ...@@ -121,10 +122,19 @@ static int *block_ok_stack_end;
static int *cur_block, *block_stack_end; static int *cur_block, *block_stack_end;
static int block_stack[BLOCK_STACK_DEPTH]; 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 int embedded_server_arg_count=0;
static char *embedded_server_args[MAX_SERVER_ARGS];
static const char *embedded_server_groups[] = {
"server",
"embedded",
"mysqltest_SERVER",
NullS
};
#include "sslopt-vars.h" #include "sslopt-vars.h"
DYNAMIC_ARRAY q_lines; DYNAMIC_ARRAY q_lines;
...@@ -326,18 +336,8 @@ void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} ...@@ -326,18 +336,8 @@ void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {}
int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; } int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; }
int mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; } int mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif #endif
static void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val,
#define MAX_SERVER_ARGS 20 int len);
static int embedded_server_arg_count=0;
static char *embedded_server_args[MAX_SERVER_ARGS];
static const char *embedded_server_groups[] = {
"server",
"embedded",
"mysqltest_SERVER",
NullS
};
static void do_eval(DYNAMIC_STRING* query_eval, const char* query) static void do_eval(DYNAMIC_STRING* query_eval, const char* query)
...@@ -864,7 +864,7 @@ int do_exec(struct st_query* q) ...@@ -864,7 +864,7 @@ int do_exec(struct st_query* q)
if (!(res_file= popen(cmd, "r")) && q->abort_on_error) if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
die("popen() failed\n"); die("popen() failed\n");
while (fgets(buf, sizeof(buf), res_file)) while (fgets(buf, sizeof(buf), res_file))
dynstr_append(ds, buf); replace_dynstr_append_mem(ds, buf, strlen(buf));
pclose(res_file); pclose(res_file);
if (record) if (record)
{ {
......
...@@ -5,7 +5,7 @@ create temporary table `table:name` (a int); ...@@ -5,7 +5,7 @@ create temporary table `table:name` (a int);
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.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 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 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 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name`
drop database `drop-temp+table-test`; drop database `drop-temp+table-test`;
use test;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int(11) NOT NULL auto_increment, a int(11) NOT NULL auto_increment,
......
use test;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT AUTO_INCREMENT PRIMARY KEY, a INT AUTO_INCREMENT PRIMARY KEY,
......
use test;
drop table if exists t1,t2;
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key,
t2 varchar(50), unique(t2));
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
id t2
1 mysql.com
2 hotmail.com
3 aol.com
drop table if exists t1; drop table if exists t1,t2;
create table t1 (a int not null); create table t1 (a int not null);
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (a+2); insert into t1 values (a+2);
...@@ -68,9 +68,19 @@ id ...@@ -68,9 +68,19 @@ id
0 0
2 2
drop table t1; drop table t1;
drop database if exists foo; create table t1 (email varchar(50));
create database foo; insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
use foo; create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
id t2
1 mysql.com
2 hotmail.com
3 aol.com
drop table t1,t2;
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
create table t1 (c int); create table t1 (c int);
insert into foo.t1 set foo.t1.c = '1'; insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database foo; drop database mysqltest;
...@@ -75,7 +75,7 @@ Duplicate entry '2' for key 1 ...@@ -75,7 +75,7 @@ Duplicate entry '2' for key 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.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use test; insert into t1 select * from t2 master-bin.001 79 Query 1 79 use `test`; insert into t1 select * from t2
drop table t1, t2; drop table t1, t2;
drop table if exists t1, t2; drop table if exists t1, t2;
create table t1 (a int not null); create table t1 (a int not null);
......
...@@ -8,10 +8,10 @@ insert into t2 select * from t1; ...@@ -8,10 +8,10 @@ insert into t2 select * from t1;
commit; commit;
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(1) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(1)
master-bin.001 178 Query 1 79 use test; insert into t2 select * from t1 master-bin.001 178 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.001 244 Query 1 244 use test; COMMIT master-bin.001 244 Query 1 244 use `test`; COMMIT
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -22,10 +22,10 @@ rollback; ...@@ -22,10 +22,10 @@ rollback;
Warning: Some non-transactional changed tables couldn't be rolled back Warning: Some non-transactional changed tables couldn't be rolled back
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(2) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(2)
master-bin.001 178 Query 1 79 use test; insert into t2 select * from t1 master-bin.001 178 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.001 244 Query 1 244 use test; ROLLBACK master-bin.001 244 Query 1 244 use `test`; ROLLBACK
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -39,13 +39,13 @@ Warning: Some non-transactional changed tables couldn't be rolled back ...@@ -39,13 +39,13 @@ Warning: Some non-transactional changed tables couldn't be rolled back
commit; commit;
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(3) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(3)
master-bin.001 178 Query 1 79 use test; savepoint my_savepoint master-bin.001 178 Query 1 79 use `test`; savepoint my_savepoint
master-bin.001 235 Query 1 79 use test; insert into t1 values(4) master-bin.001 235 Query 1 79 use `test`; insert into t1 values(4)
master-bin.001 294 Query 1 79 use test; insert into t2 select * from t1 master-bin.001 294 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint master-bin.001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
master-bin.001 429 Query 1 429 use test; COMMIT master-bin.001 429 Query 1 429 use `test`; COMMIT
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -64,14 +64,14 @@ a ...@@ -64,14 +64,14 @@ a
7 7
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(5) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(5)
master-bin.001 178 Query 1 79 use test; savepoint my_savepoint master-bin.001 178 Query 1 79 use `test`; savepoint my_savepoint
master-bin.001 235 Query 1 79 use test; insert into t1 values(6) master-bin.001 235 Query 1 79 use `test`; insert into t1 values(6)
master-bin.001 294 Query 1 79 use test; insert into t2 select * from t1 master-bin.001 294 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.001 360 Query 1 79 use test; rollback to savepoint my_savepoint master-bin.001 360 Query 1 79 use `test`; rollback to savepoint my_savepoint
master-bin.001 429 Query 1 79 use test; insert into t1 values(7) master-bin.001 429 Query 1 79 use `test`; insert into t1 values(7)
master-bin.001 488 Query 1 488 use test; COMMIT master-bin.001 488 Query 1 488 use `test`; COMMIT
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -86,10 +86,10 @@ get_lock("a",10) ...@@ -86,10 +86,10 @@ get_lock("a",10)
1 1
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(8) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(8)
master-bin.001 178 Query 1 79 use test; insert into t2 select * from t1 master-bin.001 178 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.001 244 Query 1 244 use test; ROLLBACK master-bin.001 244 Query 1 244 use `test`; ROLLBACK
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -97,8 +97,8 @@ insert into t1 values(9); ...@@ -97,8 +97,8 @@ insert into t1 values(9);
insert into t2 select * from t1; insert into t2 select * from 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
master-bin.001 79 Query 1 79 use test; insert into t1 values(9) master-bin.001 79 Query 1 79 use `test`; insert into t1 values(9)
master-bin.001 138 Query 1 138 use test; insert into t2 select * from t1 master-bin.001 138 Query 1 138 use `test`; insert into t2 select * from t1
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -107,17 +107,17 @@ begin; ...@@ -107,17 +107,17 @@ begin;
insert into t2 select * from t1; insert into t2 select * from 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
master-bin.001 79 Query 1 79 use test; insert into t1 values(10) master-bin.001 79 Query 1 79 use `test`; insert into t1 values(10)
master-bin.001 139 Query 1 139 use test; insert into t2 select * from t1 master-bin.001 139 Query 1 139 use `test`; insert into t2 select * from t1
insert into t1 values(11); insert into t1 values(11);
commit; commit;
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
master-bin.001 79 Query 1 79 use test; insert into t1 values(10) master-bin.001 79 Query 1 79 use `test`; insert into t1 values(10)
master-bin.001 139 Query 1 139 use test; insert into t2 select * from t1 master-bin.001 139 Query 1 139 use `test`; insert into t2 select * from t1
master-bin.001 205 Query 1 205 use test; BEGIN master-bin.001 205 Query 1 205 use `test`; BEGIN
master-bin.001 245 Query 1 205 use test; insert into t1 values(11) master-bin.001 245 Query 1 205 use `test`; insert into t1 values(11)
master-bin.001 305 Query 1 305 use test; COMMIT master-bin.001 305 Query 1 305 use `test`; COMMIT
alter table t2 type=INNODB; alter table t2 type=INNODB;
delete from t1; delete from t1;
delete from t2; delete from t2;
...@@ -128,10 +128,10 @@ insert into t2 select * from t1; ...@@ -128,10 +128,10 @@ insert into t2 select * from t1;
commit; commit;
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(12) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(12)
master-bin.001 179 Query 1 79 use test; insert into t2 select * from t1 master-bin.001 179 Query 1 79 use `test`; insert into t2 select * from t1
master-bin.001 245 Query 1 245 use test; COMMIT master-bin.001 245 Query 1 245 use `test`; COMMIT
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -153,9 +153,9 @@ rollback to savepoint my_savepoint; ...@@ -153,9 +153,9 @@ rollback to savepoint my_savepoint;
commit; commit;
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(14) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(14)
master-bin.001 179 Query 1 179 use test; COMMIT master-bin.001 179 Query 1 179 use `test`; COMMIT
delete from t1; delete from t1;
delete from t2; delete from t2;
reset master; reset master;
...@@ -173,8 +173,8 @@ a ...@@ -173,8 +173,8 @@ a
18 18
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
master-bin.001 79 Query 1 79 use test; BEGIN master-bin.001 79 Query 1 79 use `test`; BEGIN
master-bin.001 119 Query 1 79 use test; insert into t1 values(16) master-bin.001 119 Query 1 79 use `test`; insert into t1 values(16)
master-bin.001 179 Query 1 79 use test; insert into t1 values(18) master-bin.001 179 Query 1 79 use `test`; insert into t1 values(18)
master-bin.001 239 Query 1 239 use test; COMMIT master-bin.001 239 Query 1 239 use `test`; COMMIT
drop table t1,t2; drop table t1,t2;
drop table if exists t1; drop table if exists t1,t2;
drop table if exists t2;
set timestamp=1000000000; set timestamp=1000000000;
create table t1 (word varchar(20)); create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key); create table t2 (id int auto_increment not null primary key);
...@@ -25,11 +24,11 @@ insert into t1 values ("abirvalg"); ...@@ -25,11 +24,11 @@ insert into t1 values ("abirvalg");
SET INSERT_ID=1; SET INSERT_ID=1;
SET TIMESTAMP=1000000000; SET TIMESTAMP=1000000000;
insert into t2 values (); insert into t2 values ();
LOAD DATA LOCAL INFILE '/home/dlenev/src/mysql-4.0-binlog/mysql-test/var/tmp/words.dat-1-0 ' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-1-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
LOAD DATA LOCAL INFILE '/home/dlenev/src/mysql-4.0-binlog/mysql-test/var/tmp/words.dat-2-0 ' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-2-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
LOAD DATA LOCAL INFILE '/home/dlenev/src/mysql-4.0-binlog/mysql-test/var/tmp/words.dat-3-0 ' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-3-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
LOAD DATA LOCAL INFILE '/home/dlenev/src/mysql-4.0-binlog/mysql-test/var/tmp/words.dat-4-0 ' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-4-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
LOAD DATA LOCAL INFILE '/home/dlenev/src/mysql-4.0-binlog/mysql-test/var/tmp/words.dat-5-0 ' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word); LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/var/tmp/words.dat-5-0' INTO TABLE t1 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' STARTING BY '' (word);
--- Broken LOAD DATA -- --- Broken LOAD DATA --
use test; use test;
......
...@@ -20,24 +20,24 @@ drop table t1; ...@@ -20,24 +20,24 @@ drop table t1;
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.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key) master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 172 INSERT_ID=1 master-bin.001 172 Intvar 1 172 INSERT_ID=1
master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL) master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
master-bin.001 263 Query 1 263 use test; drop table t1 master-bin.001 263 Query 1 263 use `test`; drop table t1
master-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null) master-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581 master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
master-bin.001 1056 Exec_load 1 1056 ;file_id=1 master-bin.001 1056 Exec_load 1 1056 ;file_id=1
master-bin.001 1079 Query 1 1079 use test; drop table t1 master-bin.001 1079 Query 1 1079 use `test`; drop table t1
show binlog events from 79 limit 1; show binlog events from 79 limit 1;
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 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key) master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 79 limit 2; show binlog events from 79 limit 2;
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 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key) master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 172 INSERT_ID=1 master-bin.001 172 Intvar 1 172 INSERT_ID=1
show binlog events from 79 limit 2,1; show binlog events from 79 limit 2,1;
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 200 Query 1 200 use test; insert into t1 values (NULL) master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs; flush logs;
create table t5 (a int); create table t5 (a int);
drop table t5; drop table t5;
...@@ -50,22 +50,22 @@ drop table t1; ...@@ -50,22 +50,22 @@ drop table t1;
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.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key) master-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
master-bin.001 172 Intvar 1 172 INSERT_ID=1 master-bin.001 172 Intvar 1 172 INSERT_ID=1
master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL) master-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
master-bin.001 263 Query 1 263 use test; drop table t1 master-bin.001 263 Query 1 263 use `test`; drop table t1
master-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null) master-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581 master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
master-bin.001 1056 Exec_load 1 1056 ;file_id=1 master-bin.001 1056 Exec_load 1 1056 ;file_id=1
master-bin.001 1079 Query 1 1079 use test; drop table t1 master-bin.001 1079 Query 1 1079 use `test`; drop table t1
master-bin.001 1127 Rotate 1 1127 master-bin.002;pos=4 master-bin.001 1127 Rotate 1 1127 master-bin.002;pos=4
show binlog events in 'master-bin.002'; show binlog events in 'master-bin.002';
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.002 4 Query 1 4 use test; create table t5 (a int) master-bin.002 4 Query 1 4 use `test`; create table t5 (a int)
master-bin.002 62 Query 1 62 use test; drop table t5 master-bin.002 62 Query 1 62 use `test`; drop table t5
master-bin.002 110 Query 1 110 use test; create table t1 (n int) master-bin.002 110 Query 1 110 use `test`; create table t1 (n int)
master-bin.002 168 Query 1 168 use test; insert into t1 values (1) master-bin.002 168 Query 1 168 use `test`; insert into t1 values (1)
master-bin.002 228 Query 1 228 use test; drop table t1 master-bin.002 228 Query 1 228 use `test`; drop table t1
show master logs; show master logs;
Log_name Log_name
master-bin.001 master-bin.001
...@@ -78,22 +78,22 @@ slave-bin.002 ...@@ -78,22 +78,22 @@ slave-bin.002
show binlog events in 'slave-bin.001' from 4; show binlog events in 'slave-bin.001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3 slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
slave-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key) slave-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.001 172 Intvar 1 172 INSERT_ID=1 slave-bin.001 172 Intvar 1 172 INSERT_ID=1
slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL) slave-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.001 263 Query 1 263 use test; drop table t1 slave-bin.001 263 Query 1 263 use `test`; drop table t1
slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null) slave-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581 slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=581
slave-bin.001 1065 Exec_load 1 1065 ;file_id=1 slave-bin.001 1065 Exec_load 1 1065 ;file_id=1
slave-bin.001 1088 Query 1 1088 use test; drop table t1 slave-bin.001 1088 Query 1 1088 use `test`; drop table t1
slave-bin.001 1136 Query 1 1136 use test; create table t5 (a int) slave-bin.001 1136 Query 1 1136 use `test`; create table t5 (a int)
slave-bin.001 1194 Query 1 1194 use test; drop table t5 slave-bin.001 1194 Query 1 1194 use `test`; drop table t5
slave-bin.001 1242 Rotate 2 1242 slave-bin.002;pos=4 slave-bin.001 1242 Rotate 2 1242 slave-bin.002;pos=4
show binlog events in 'slave-bin.002' from 4; show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.002 4 Query 1 4 use test; create table t1 (n int) slave-bin.002 4 Query 1 4 use `test`; create table t1 (n int)
slave-bin.002 62 Query 1 62 use test; insert into t1 values (1) slave-bin.002 62 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.002 122 Query 1 122 use test; drop table t1 slave-bin.002 122 Query 1 122 use `test`; drop table t1
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 Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.003 211 master-bin.002 Yes Yes 0 0 276 211 127.0.0.1 root MASTER_PORT 1 master-bin.002 276 slave-relay-bin.003 211 master-bin.002 Yes Yes 0 0 276 211
......
# several FULLTEXT indexes in one table test # several FULLTEXT indexes in one table test
use test;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a int(11) NOT NULL auto_increment, a int(11) NOT NULL auto_increment,
......
use test;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
a INT AUTO_INCREMENT PRIMARY KEY, a INT AUTO_INCREMENT PRIMARY KEY,
......
use test;
drop table if exists t1,t2;
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key,
t2 varchar(50), unique(t2));
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Test of refering to old values # Test of refering to old values
# #
drop table if exists t1; drop table if exists t1,t2;
create table t1 (a int not null); create table t1 (a int not null);
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (a+2); insert into t1 values (a+2);
...@@ -61,14 +61,26 @@ insert into t1 values (1), (NULL), (2); ...@@ -61,14 +61,26 @@ insert into t1 values (1), (NULL), (2);
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Test if insert ... select distinct
#
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key, t2 varchar(50), unique(t2));
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
drop table t1,t2;
# #
# Test of mysqld crash with fully qualified column names # Test of mysqld crash with fully qualified column names
# #
drop database if exists foo; --disable_warnings
create database foo; drop database if exists mysqltest;
use foo; --enable_warnings
create database mysqltest;
use mysqltest;
create table t1 (c int); create table t1 (c int);
insert into foo.t1 set foo.t1.c = '1'; insert into mysqltest.t1 set mysqltest.t1.c = '1';
drop database foo; drop database mysqltest;
# We are using .opt file since we need small binlog size # We are using .opt file since we need small binlog size
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1,t2;
drop table if exists t2;
--enable_warnings --enable_warnings
# we need this for getting fixed timestamps inside of this test # we need this for getting fixed timestamps inside of this test
...@@ -39,6 +38,7 @@ select "--- Local --" as ""; ...@@ -39,6 +38,7 @@ select "--- Local --" as "";
# be time dependend. Better than nothing. # be time dependend. Better than nothing.
# #
--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.001
# 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
...@@ -50,12 +50,14 @@ select "--- Broken LOAD DATA --" as ""; ...@@ -50,12 +50,14 @@ select "--- Broken LOAD DATA --" as "";
--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
--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.001
# 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
--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.002
# These are tests for remote binlog. # These are tests for remote binlog.
......
...@@ -244,9 +244,9 @@ void Query_log_event::pack_info(String* packet) ...@@ -244,9 +244,9 @@ void Query_log_event::pack_info(String* packet)
tmp.length(0); tmp.length(0);
if (db && db_len) if (db && db_len)
{ {
tmp.append("use "); tmp.append("use `",5);
tmp.append(db, db_len); tmp.append(db, db_len);
tmp.append("; ", 2); tmp.append("`; ", 3);
} }
if (query && q_len) if (query && q_len)
......
...@@ -57,16 +57,6 @@ fi ...@@ -57,16 +57,6 @@ fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
export PATH export PATH
if test -z "$pid_file"
then
pid_file=$datadir/`@HOSTNAME@`.pid
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_file" ;;
esac
fi
mode=$1 # start or stop mode=$1 # start or stop
parse_arguments() { parse_arguments() {
...@@ -118,6 +108,19 @@ else ...@@ -118,6 +108,19 @@ else
test -z "$print_defaults" && print_defaults="my_print_defaults" test -z "$print_defaults" && print_defaults="my_print_defaults"
fi fi
#
# Set pid file if not given
#
if test -z "$pid_file"
then
pid_file=$datadir/`@HOSTNAME@`.pid
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_file" ;;
esac
fi
# #
# Test if someone changed datadir; In this case we should also read the # Test if someone changed datadir; In this case we should also read the
# default arguments from this directory # default arguments from this directory
......
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