diff --git a/configure.in b/configure.in index b9ad38fb59d8b7a658a629a8c8bca577b865b387..1d6df1dd55ed0f30aa1deed25159eb35f4a8c4ce 100644 --- a/configure.in +++ b/configure.in @@ -118,7 +118,7 @@ AC_SUBST(SAVE_LDFLAGS) AC_SUBST(SAVE_CXXLDFLAGS) AC_SUBST(CXXLDFLAGS) -AC_PREREQ(2.57)dnl Minimum Autoconf version required. +AC_PREREQ(2.52)dnl Minimum Autoconf version required. #AC_ARG_PROGRAM # Automaticly invoked by AM_INIT_AUTOMAKE AM_SANITY_CHECK diff --git a/mysql-test/r/rpl_drop_db.result b/mysql-test/r/rpl_drop_db.result index 3d1dfba5b05eb3ea1a5845dabf55e769e7e89634..ce9d39e87f6d5b68a47b12bf34ea877ce12b7b68 100644 --- a/mysql-test/r/rpl_drop_db.result +++ b/mysql-test/r/rpl_drop_db.result @@ -4,29 +4,29 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists mysqltest; -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); -drop database mysqltest; -ERROR HY000: Error dropping database (can't rmdir './mysqltest/', errno: 17) -use mysqltest; +drop database if exists mysqltest1; +create database mysqltest1; +create table mysqltest1.t1 (n int); +insert into mysqltest1.t1 values (1); +select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; +create table mysqltest1.t2 (n int); +create table mysqltest1.t3 (n int); +drop database mysqltest1; +ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17) +use mysqltest1; show tables; -Tables_in_mysqltest -drop database mysqltest; -ERROR HY000: Error dropping database (can't rmdir './mysqltest/', errno: 17) -use mysqltest; +Tables_in_mysqltest1 +drop database mysqltest1; +ERROR HY000: Error dropping database (can't rmdir './mysqltest1/', errno: 17) +use mysqltest1; show tables; -Tables_in_mysqltest +Tables_in_mysqltest1 use test; create table t1 (n int); insert into t1 values (1234); -use mysqltest; +use mysqltest1; show tables; -Tables_in_mysqltest +Tables_in_mysqltest1 use test; select * from t1; n diff --git a/mysql-test/t/rpl_drop_db.test b/mysql-test/t/rpl_drop_db.test index 7b4a56910d6d92bc87d342e881d1d416a1e2d6af..6b72623d88fe56f3e6f9005ec1a201c4f4893760 100644 --- a/mysql-test/t/rpl_drop_db.test +++ b/mysql-test/t/rpl_drop_db.test @@ -5,32 +5,33 @@ connection master; --disable_warnings -drop database if exists mysqltest; +drop database if exists mysqltest1; --enable_warnings -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); +create database mysqltest1; +create table mysqltest1.t1 (n int); +insert into mysqltest1.t1 values (1); +select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; +create table mysqltest1.t2 (n int); +create table mysqltest1.t3 (n int); --error 1010 -drop database mysqltest; -use mysqltest; +drop database mysqltest1; +use mysqltest1; show tables; # test the branch of the code that deals with the query buffer overflow -disable_query_log; -let $1=50; +--disable_query_log +let $1=1000; while ($1) { - eval create table mysqltest.mysql_test_long_table_name$1 (n int); + eval create table mysqltest1.t$1(n int); dec $1; } -enable_query_log; +--enable_query_log + --error 1010 -drop database mysqltest; -use mysqltest; +drop database mysqltest1; +use mysqltest1; show tables; use test; create table t1 (n int); @@ -38,7 +39,7 @@ insert into t1 values (1234); sync_slave_with_master; connection slave; -use mysqltest; +use mysqltest1; show tables; use test; select * from t1; @@ -50,7 +51,5 @@ sync_slave_with_master; #cleanup connection slave; stop slave; -system rm -rf var/master-data/mysqltest; - -# End of 4.1 tests +system rm -rf var/master-data/mysqltest1; diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index d8c19d86e5cb0e8c0ec63221e2018a01b9f4e18c..d52a8efeed2a3ea1356fa4e06d4a425f4304c2c4 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -203,7 +203,7 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); *prev=next; } - + point= (gptr) ((char*) next+ (next->size-next->left)); /*TODO: next part may be unneded due to mem_root->first_block_usage counter*/ if ((next->left-= Size) < mem_root->min_malloc) @@ -217,6 +217,12 @@ gptr alloc_root(MEM_ROOT *mem_root,unsigned int Size) #endif } +#ifdef SAFEMALLOC +#define TRASH(X) bfill(((char*)(X) + ((X)->size-(X)->left)), (X)->left, 0xa5) +#else +#define TRASH /* no-op */ +#endif + /* Mark all data in blocks free for reusage */ static inline void mark_blocks_free(MEM_ROOT* root) @@ -227,14 +233,20 @@ static inline void mark_blocks_free(MEM_ROOT* root) /* iterate through (partially) free blocks, mark them free */ last= &root->free; for (next= root->free; next; next= *(last= &next->next)) + { next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM)); + TRASH(next); + } /* Combine the free and the used list */ *last= next=root->used; /* now go through the used blocks and mark them free */ for (; next; next= next->next) + { next->left= next->size - ALIGN_SIZE(sizeof(USED_MEM)); + TRASH(next); + } /* Now everything is set; Indicate that nothing is used anymore */ root->used= 0; @@ -280,6 +292,7 @@ void free_root(MEM_ROOT *root, myf MyFlags) { root->free=root->pre_alloc; root->free->left=root->pre_alloc->size-ALIGN_SIZE(sizeof(USED_MEM)); + TRASH(root->pre_alloc); root->free->next=0; } root->block_num= 4; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index a279fae93a9518468c65542f164696c30993f550..7635774e3ac0a5e3889f79f79a6e9db8ae6c8fe0 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -701,30 +701,28 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) 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_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*/ - tbl_name_len= strlen(tbl->real_name) + 3; + + /* 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; - } - + } + *query_pos++ = '`'; query_pos= strmov(query_pos,tbl->real_name); *query_pos++ = '`'; *query_pos++ = ','; } - + if (query_pos != query_data_start) { write_to_binlog(thd, query, query_pos -1 - query, db, db_len); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 80ac9e007b994dca64a819297d5b61f0833f3d23..87b864c73fa966b4885057bd183b7877c954d384 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -220,7 +220,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, for (table=tables ; table ; table=table->next) { char *db=table->db; - table->was_dropped= 0; mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL); if (!close_temporary_table(thd, db, table->real_name)) { @@ -281,8 +280,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, wrong_tables.append(','); wrong_tables.append(String(table->real_name,system_charset_info)); } - else - table->was_dropped= 1; } thd->tmp_table_used= tmp_table_deleted; error= 0; diff --git a/sql/table.h b/sql/table.h index fb742acf8045c3c93d355b981f8ec82883a2e3c9..77153e5d8cd048bc2cc1fbcdd113432bba2d60e2 100644 --- a/sql/table.h +++ b/sql/table.h @@ -235,9 +235,6 @@ typedef struct st_table_list bool cacheable_table; /* stop PS caching */ /* used in multi-upd privelege check */ bool table_in_update_from_clause; - - /* used for proper partially successful DROP DATABASE binlogging */ - bool was_dropped; } TABLE_LIST; typedef struct st_changed_table_list