From 4eb6fd537b98eabf02b61d4a7979414bf735f784 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 4 Dec 2003 23:57:10 +0200 Subject: [PATCH] fixed length of current database name if it is dropped (BUG#1986) mysql-test/r/query_cache.result: test of BUG#1986 mysql-test/t/query_cache.test: test of BUG#1986 sql/sql_db.cc: as far as we remove db name we should remove its length --- mysql-test/r/query_cache.result | 8 ++++++++ mysql-test/t/query_cache.test | 13 +++++++++++++ sql/sql_db.cc | 5 +++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index e668b9031cc..54a72fe58c2 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -809,4 +809,12 @@ show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 4 DROP TABLE t1; +CREATE TABLE t1 (a int(1)); +CREATE DATABASE mysqltest; +USE mysqltest; +DROP DATABASE mysqltest; +SELECT * FROM test.t1; +a +USE test; +DROP TABLE t1; SET GLOBAL query_cache_size=0; diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 14cbf4c906d..a7f28bfb5b6 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -585,4 +585,17 @@ show status like "Qcache_queries_in_cache"; # Keep things tidy # DROP TABLE t1; + +# +# DROP current database test +# +CREATE TABLE t1 (a int(1)); +CREATE DATABASE mysqltest; +USE mysqltest; +DROP DATABASE mysqltest; +SELECT * FROM test.t1; +USE test; +DROP TABLE t1; + + SET GLOBAL query_cache_size=0; diff --git a/sql/sql_db.cc b/sql/sql_db.cc index c61e6800cfa..6aff95641ba 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -409,7 +409,7 @@ exit: when the slave is replicating a DROP DATABASE: - garbage characters in the error message: "Error 'Can't drop database 'test2'; database doesn't exist' on query - 'h4zIż'" + 'h4zI©'" - segfault - hang in "free(vio)" (yes!) in the I/O or SQL slave threads (so slave server hangs at shutdown etc). @@ -418,7 +418,8 @@ exit: { if (!(thd->slave_thread)) /* a slave thread will free it itself */ x_free(thd->db); - thd->db= 0; + thd->db= 0; + thd->db_length= 0; } exit2: VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));