Commit 8e6aa0e7 authored by monty@mishka.local's avatar monty@mishka.local

Review fixes

parent 3831bb56
...@@ -8581,9 +8581,8 @@ CREATE TABLE t1(f1 blob); ...@@ -8581,9 +8581,8 @@ CREATE TABLE t1(f1 blob);
PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)';
SET @var1= x'8300'; SET @var1= x'8300';
EXECUTE stmt1 USING @var1; EXECUTE stmt1 USING @var1;
SHOW BINLOG EVENTS; 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.000001 # Start 1 # Server ver: 4.1.15-debug-log, Binlog ver: 3
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=95,COLLATION_CONNECTION=95,COLLATION_DATABASE=95,COLLATION_SERVER=8 master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=95,COLLATION_CONNECTION=95,COLLATION_DATABASE=95,COLLATION_SERVER=8
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob) master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=95,COLLATION_CONNECTION=95,COLLATION_DATABASE=95,COLLATION_SERVER=8 master-bin.000001 # Query 1 # use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=95,COLLATION_CONNECTION=95,COLLATION_DATABASE=95,COLLATION_SERVER=8
......
This diff is collapsed.
...@@ -419,7 +419,7 @@ SET @var1= x'8300'; ...@@ -419,7 +419,7 @@ SET @var1= x'8300';
# exercise this code from mysql-test-run. # exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1; EXECUTE stmt1 USING @var1;
--replace_column 2 # 5 # --replace_column 2 # 5 #
SHOW BINLOG EVENTS; SHOW BINLOG EVENTS FROM 79;
SELECT HEX(f1) FROM t1; SELECT HEX(f1) FROM t1;
DROP table t1; DROP table t1;
# end test for bug#11338 # end test for bug#11338
......
...@@ -5,30 +5,32 @@ ...@@ -5,30 +5,32 @@
connection master; connection master;
--disable_warnings --disable_warnings
drop database if exists d1; drop database if exists mysqltest;
--enable_warnings --enable_warnings
create database d1; create database mysqltest;
create table d1.t1 (n int); create table mysqltest.t1 (n int);
insert into d1.t1 values (1); insert into mysqltest.t1 values (1);
select * from d1.t1 into outfile 'd1/f1.txt'; select * from mysqltest.t1 into outfile 'mysqltest/f1.txt';
create table d1.t2 (n int); create table mysqltest.t2 (n int);
create table d1.t3 (n int); create table mysqltest.t3 (n int);
--error 1010 --error 1010
drop database d1; drop database mysqltest;
use d1; use mysqltest;
show tables; show tables;
# test the branch of the code that deals with the query buffer overflow # test the branch of the code that deals with the query buffer overflow
let $1=1000; disable_query_log;
let $1=50;
while ($1) while ($1)
{ {
eval create table d1.t$1(n int); eval create table mysqltest.mysql_test_long_table_name$1 (n int);
dec $1; dec $1;
} }
enable_query_log;
--error 1010 --error 1010
drop database d1; drop database mysqltest;
use d1; use mysqltest;
show tables; show tables;
use test; use test;
create table t1 (n int); create table t1 (n int);
...@@ -36,7 +38,7 @@ insert into t1 values (1234); ...@@ -36,7 +38,7 @@ insert into t1 values (1234);
sync_slave_with_master; sync_slave_with_master;
connection slave; connection slave;
use d1; use mysqltest;
show tables; show tables;
use test; use test;
select * from t1; select * from t1;
...@@ -48,5 +50,7 @@ sync_slave_with_master; ...@@ -48,5 +50,7 @@ sync_slave_with_master;
#cleanup #cleanup
connection slave; connection slave;
stop slave; stop slave;
system rm -rf var/master-data/d1; system rm -rf var/master-data/mysqltest;
# End of 4.1 tests
...@@ -33,12 +33,8 @@ static TYPELIB deletable_extentions= ...@@ -33,12 +33,8 @@ static TYPELIB deletable_extentions=
static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
const char *db, const char *path, uint level, const char *db, const char *path, uint level,
TABLE_LIST** dropped_tables); TABLE_LIST **dropped_tables);
static inline void write_to_binlog(THD* thd, char* query, uint q_len,
char* db, uint db_len);
/* Database options hash */ /* Database options hash */
static HASH dboptions; static HASH dboptions;
static my_bool dboptions_init= 0; static my_bool dboptions_init= 0;
...@@ -56,6 +52,7 @@ typedef struct my_dbopt_st ...@@ -56,6 +52,7 @@ typedef struct my_dbopt_st
/* /*
Function we use in the creation of our hash to get key. Function we use in the creation of our hash to get key.
*/ */
static byte* dboptions_get_key(my_dbopt_t *opt, uint *length, static byte* dboptions_get_key(my_dbopt_t *opt, uint *length,
my_bool not_used __attribute__((unused))) my_bool not_used __attribute__((unused)))
{ {
...@@ -63,17 +60,19 @@ static byte* dboptions_get_key(my_dbopt_t *opt, uint *length, ...@@ -63,17 +60,19 @@ static byte* dboptions_get_key(my_dbopt_t *opt, uint *length,
return (byte*) opt->name; return (byte*) opt->name;
} }
/* /*
Helper function to write a query to binlog used by mysql_rm_db() Helper function to write a query to binlog used by mysql_rm_db()
*/ */
static inline void write_to_binlog(THD* thd, char* query, uint q_len,
char* db, uint db_len) static inline void write_to_binlog(THD *thd, char *query, uint q_len,
char *db, uint db_len)
{ {
Query_log_event qinfo(thd, query, q_len, 0, 0); Query_log_event qinfo(thd, query, q_len, 0, 0);
qinfo.error_code= 0; qinfo.error_code= 0;
qinfo.db= db; qinfo.db= db;
qinfo.db_len= db_len; qinfo.db_len= db_len;
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
...@@ -644,7 +643,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -644,7 +643,7 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
error= -1; error= -1;
if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0, if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0,
&dropped_tables)) >= 0) &dropped_tables)) >= 0)
{ {
ha_drop_database(path); ha_drop_database(path);
query_cache_invalidate1(db); query_cache_invalidate1(db);
...@@ -696,42 +695,40 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) ...@@ -696,42 +695,40 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
} }
else if (mysql_bin_log.is_open()) else if (mysql_bin_log.is_open())
{ {
char* query= thd->alloc(MAX_DROP_TABLE_Q_LEN); char *query, *query_pos, *query_end, *query_data_start;
TABLE_LIST *tbl;
if (!query) uint db_len;
goto exit; /* not much else we can do */
char* p= strmov(query,"drop table "); if (!(query= thd->alloc(MAX_DROP_TABLE_Q_LEN)))
char* p_end= query + MAX_DROP_TABLE_Q_LEN; goto exit; /* not much else we can do */
TABLE_LIST* tbl; query_pos= query_data_start= strmov(query,"drop table ");
bool last_query_needs_write= 0; query_end= query + MAX_DROP_TABLE_Q_LEN;
uint db_len= strlen(db); db_len= strlen(db);
for (tbl= dropped_tables;tbl;tbl= tbl->next) for (tbl= dropped_tables; tbl; tbl= tbl->next)
{ {
if (!tbl->was_dropped) uint tbl_name_len;
continue; if (!tbl->was_dropped)
continue;
/* 3 for the quotes and the comma*/ /* 3 for the quotes and the comma*/
uint tbl_name_len= strlen(tbl->real_name) + 3; tbl_name_len= strlen(tbl->real_name) + 3;
if (p + tbl_name_len + 1 >= p_end) if (query_pos + tbl_name_len + 1 >= query_end)
{ {
*--p= 0; /* kill , */ write_to_binlog(thd, query, query_pos -1 - query, db, db_len);
write_to_binlog(thd, query, p - query, db, db_len); query_pos= query_data_start;
p= query + 11; /* reuse the initial "drop table" */ }
}
*p++ = '`'; *query_pos++ = '`';
p= strmov(p,tbl->real_name); query_pos= strmov(query_pos,tbl->real_name);
*p++ = '`'; *query_pos++ = '`';
*p++ = ','; *query_pos++ = ',';
last_query_needs_write= 1; }
}
if (last_query_needs_write) if (query_pos != query_data_start)
{ {
*--p= 0; write_to_binlog(thd, query, query_pos -1 - query, db, db_len);
write_to_binlog(thd, query, p - query, db, db_len); }
}
} }
exit: exit:
...@@ -777,7 +774,8 @@ exit2: ...@@ -777,7 +774,8 @@ exit2:
*/ */
static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
const char *org_path, uint level, TABLE_LIST** dropped_tables) const char *org_path, uint level,
TABLE_LIST **dropped_tables)
{ {
long deleted=0; long deleted=0;
ulong found_other_files=0; ulong found_other_files=0;
......
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