Commit 9171169e authored by unknown's avatar unknown
Browse files

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

into  mishka.local:/home/my/mysql-4.1

parents 23aecc5c 7b39b01b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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
+17 −1017

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -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
+19 −15
Original line number Diff line number Diff line
@@ -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
+46 −48
Original line number Diff line number Diff line
@@ -35,10 +35,6 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
				 const char *db, const char *path, uint level, 
                                 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,9 +60,11 @@ 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)
{
@@ -696,41 +695,39 @@ 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);
    char *query, *query_pos, *query_end, *query_data_start;
    TABLE_LIST *tbl;
    uint db_len;

     if (!query)
    if (!(query= thd->alloc(MAX_DROP_TABLE_Q_LEN)))
      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);
    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)
    {
      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)
      tbl_name_len= strlen(tbl->real_name) + 3; 
      if (query_pos + tbl_name_len + 1 >= query_end)
      {
          *--p= 0; /* kill , */
          write_to_binlog(thd, query, p - query, db, db_len);
          p= query + 11; /* reuse the initial "drop table" */
        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)
    if (query_pos != query_data_start)
    {
       *--p= 0;
       write_to_binlog(thd, query, p - query, db, db_len);
      write_to_binlog(thd, query, query_pos -1 - query, db, db_len);
    }
  }

@@ -777,7 +774,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
*/

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;