Commit 17654cd7 authored by monty@mishka.local's avatar monty@mishka.local

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

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