Commit 350ad500 authored by unknown's avatar unknown

Merge gbichot@213.136.52.20:/home/bk/mysql-4.1

into mysql.com:/home/mysql_src/mysql-4.1-874

parents 5304a03e 43489240
drop table if exists t1,t2;
set timestamp=1000000000;
drop table if exists t1,t2;
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
insert into t1 values ("abirvalg");
......@@ -17,6 +17,8 @@ flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);
......@@ -51,6 +53,8 @@ insert into t1 values ("Alas");
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
use test;
SET TIMESTAMP=1000000000;
drop table if exists t1,t2;
SET TIMESTAMP=1000000000;
create table t1 (word varchar(20));
SET TIMESTAMP=1000000000;
create table t2 (id int auto_increment not null primary key);
......
......@@ -105,60 +105,62 @@ drop database test2;
drop database test3;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 Query 1 79 use `test`; create database test2 character set latin2
master-bin.000001 156 Query 1 156 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 290 Query 1 290 use `test`; create database test3
master-bin.000001 346 Query 1 346 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 480 Query 1 480 use `test`; drop database test3
master-bin.000001 534 Query 1 534 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 668 Query 1 668 use `test`; create database test3
master-bin.000001 724 Query 1 724 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 859 Query 1 859 use `test2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 961 Query 1 961 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1097 Intvar 1 1097 INSERT_ID=1
master-bin.000001 1125 Query 1 1125 use `test2`; insert into t1 (b) values(@@character_set_server)
master-bin.000001 1210 Query 1 1210 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1346 Intvar 1 1346 INSERT_ID=2
master-bin.000001 1374 Query 1 1374 use `test2`; insert into t1 (b) values(@@collation_server)
master-bin.000001 1455 Query 1 1455 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1591 Intvar 1 1591 INSERT_ID=3
master-bin.000001 1619 Query 1 1619 use `test2`; insert into t1 (b) values(@@character_set_client)
master-bin.000001 1704 Query 1 1704 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1840 Intvar 1 1840 INSERT_ID=4
master-bin.000001 1868 Query 1 1868 use `test2`; insert into t1 (b) values(@@character_set_connection)
master-bin.000001 1957 Query 1 1957 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2093 Intvar 1 2093 INSERT_ID=5
master-bin.000001 2121 Query 1 2121 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2206 Query 1 2206 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2341 Query 1 2341 use `test2`; truncate table t1
master-bin.000001 2394 Query 1 2394 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2529 Intvar 1 2529 INSERT_ID=1
master-bin.000001 2557 Query 1 2557 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2642 Query 1 2642 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2777 Intvar 1 2777 INSERT_ID=2
master-bin.000001 2805 Query 1 2805 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 2893 Query 1 2893 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3029 Intvar 1 3029 INSERT_ID=3
master-bin.000001 3057 Query 1 3057 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 3142 Query 1 3142 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3278 Intvar 1 3278 INSERT_ID=4
master-bin.000001 3306 Query 1 3306 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3394 Query 1 3394 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3530 Intvar 1 3530 INSERT_ID=74
master-bin.000001 3558 Create_file 1 3558 db=test2;table=t1;file_id=1;block_len=581
master-bin.000001 4226 Query 1 4226 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4362 Intvar 1 4362 INSERT_ID=5
master-bin.000001 4390 Exec_load 1 4390 ;file_id=1
master-bin.000001 4413 Query 1 4413 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4549 Query 1 4549 use `test2`; truncate table t1
master-bin.000001 4602 Query 1 4602 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4738 Intvar 1 4738 INSERT_ID=1
master-bin.000001 4766 User var 1 4766 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 4806 Query 1 4806 use `test2`; insert into t1 (b) values(collation(@a))
master-bin.000001 4882 Query 1 4882 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5018 Query 1 5018 use `test2`; drop database test2
master-bin.000001 5073 Query 1 5073 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5204 Query 1 5204 drop database test3
master-bin.000001 79 Query 1 79 use `test`; drop database if exists test2
master-bin.000001 143 Query 1 143 use `test`; drop database if exists test3
master-bin.000001 207 Query 1 207 use `test`; create database test2 character set latin2
master-bin.000001 284 Query 1 284 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
master-bin.000001 418 Query 1 418 use `test`; create database test3
master-bin.000001 474 Query 1 474 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 608 Query 1 608 use `test`; drop database test3
master-bin.000001 662 Query 1 662 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
master-bin.000001 796 Query 1 796 use `test`; create database test3
master-bin.000001 852 Query 1 852 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 987 Query 1 987 use `test2`; create table t1 (a int auto_increment primary key, b varchar(100))
master-bin.000001 1089 Query 1 1089 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1225 Intvar 1 1225 INSERT_ID=1
master-bin.000001 1253 Query 1 1253 use `test2`; insert into t1 (b) values(@@character_set_server)
master-bin.000001 1338 Query 1 1338 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1474 Intvar 1 1474 INSERT_ID=2
master-bin.000001 1502 Query 1 1502 use `test2`; insert into t1 (b) values(@@collation_server)
master-bin.000001 1583 Query 1 1583 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1719 Intvar 1 1719 INSERT_ID=3
master-bin.000001 1747 Query 1 1747 use `test2`; insert into t1 (b) values(@@character_set_client)
master-bin.000001 1832 Query 1 1832 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 1968 Intvar 1 1968 INSERT_ID=4
master-bin.000001 1996 Query 1 1996 use `test2`; insert into t1 (b) values(@@character_set_connection)
master-bin.000001 2085 Query 1 2085 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2221 Intvar 1 2221 INSERT_ID=5
master-bin.000001 2249 Query 1 2249 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2334 Query 1 2334 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2469 Query 1 2469 use `test2`; truncate table t1
master-bin.000001 2522 Query 1 2522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2657 Intvar 1 2657 INSERT_ID=1
master-bin.000001 2685 Query 1 2685 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 2770 Query 1 2770 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 2905 Intvar 1 2905 INSERT_ID=2
master-bin.000001 2933 Query 1 2933 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3021 Query 1 3021 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3157 Intvar 1 3157 INSERT_ID=3
master-bin.000001 3185 Query 1 3185 use `test2`; insert into t1 (b) values(@@collation_connection)
master-bin.000001 3270 Query 1 3270 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3406 Intvar 1 3406 INSERT_ID=4
master-bin.000001 3434 Query 1 3434 use `test2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
master-bin.000001 3522 Query 1 3522 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 3658 Intvar 1 3658 INSERT_ID=74
master-bin.000001 3686 Create_file 1 3686 db=test2;table=t1;file_id=1;block_len=581
master-bin.000001 4354 Query 1 4354 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4490 Intvar 1 4490 INSERT_ID=5
master-bin.000001 4518 Exec_load 1 4518 ;file_id=1
master-bin.000001 4541 Query 1 4541 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4677 Query 1 4677 use `test2`; truncate table t1
master-bin.000001 4730 Query 1 4730 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 4866 Intvar 1 4866 INSERT_ID=1
master-bin.000001 4894 User var 1 4894 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
master-bin.000001 4934 Query 1 4934 use `test2`; insert into t1 (b) values(collation(@a))
master-bin.000001 5010 Query 1 5010 use `test2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5146 Query 1 5146 use `test2`; drop database test2
master-bin.000001 5201 Query 1 5201 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 5332 Query 1 5332 drop database test3
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set global character_set_server=latin2;
......
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create database test1;
drop database if exists test1;
Warnings:
Note 1008 Can't drop database 'test1'; database doesn't exist
show tables from test1;
ERROR HY000: Can't read dir of './test1/' (Errcode: 2)
create table t1 (a int);
drop table if exists t1;
Warnings:
Note 1051 Unknown table 't1'
select * from t1;
ERROR 42S02: Table 'test.t1' doesn't exist
create table t1 (a int);
insert into t1 values(1);
delete from t1;
select * from t1;
a
insert into t1 values(1);
insert into t1 values(2);
update t1 set a=2;
select * from t1;
a
2
2
drop table t1;
......@@ -14,4 +14,4 @@ start slave;
flush logs;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 79 4 None 0 No #
# 127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 161 relay-log.000002 4 slave-bin.000001 Yes Yes 0 0 161 4 None 0 No #
......@@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325 None 0 No #
# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1340 slave-relay-bin.000002 1384 master-bin.000001 Yes Yes test.t1 0 0 1340 1384 None 0 No #
......@@ -39,17 +39,18 @@ f
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.000001 79 Query 1 79 use `test`; create table t1(f int)
master-bin.000001 136 Query 1 136 use `test`; create table t2(f int)
master-bin.000001 193 Query 1 193 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
master-bin.000001 290 Query 1 290 use `test`; create temporary table t3(f int)
master-bin.000001 357 Query 1 357 use `test`; insert into t3 select * from t1 where f<6
master-bin.000001 433 Query 1 433 use `test`; create temporary table t3(f int)
master-bin.000001 500 Query 1 500 use `test`; insert into t2 select count(*) from t3
master-bin.000001 573 Query 1 573 use `test`; insert into t3 select * from t1 where f>=4
master-bin.000001 650 Query 1 650 use `test`; drop temporary table t3
master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3
master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3
master-bin.000001 79 Query 1 79 use `test`; drop table if exists t1,t2
master-bin.000001 140 Query 1 140 use `test`; create table t1(f int)
master-bin.000001 197 Query 1 197 use `test`; create table t2(f int)
master-bin.000001 254 Query 1 254 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)
master-bin.000001 351 Query 1 351 use `test`; create temporary table t3(f int)
master-bin.000001 418 Query 1 418 use `test`; insert into t3 select * from t1 where f<6
master-bin.000001 494 Query 1 494 use `test`; create temporary table t3(f int)
master-bin.000001 561 Query 1 561 use `test`; insert into t2 select count(*) from t3
master-bin.000001 634 Query 1 634 use `test`; insert into t3 select * from t1 where f>=4
master-bin.000001 711 Query 1 711 use `test`; drop temporary table t3
master-bin.000001 769 Query 1 769 use `test`; insert into t2 select count(*) from t3
master-bin.000001 842 Query 1 842 use `test`; drop temporary table t3
drop table t1, t2;
use test;
SET TIMESTAMP=1040323920;
......
# We are using .opt file since we need small binlog size
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
# we need this for getting fixed timestamps inside of this test
set timestamp=1000000000;
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
create table t1 (word varchar(20));
create table t2 (id int auto_increment not null primary key);
......
source include/master-slave.inc;
connection slave;
create database test1;
connection master;
drop database if exists test1;
sync_slave_with_master;
# can't read dir
error 12;
show tables from test1;
connection slave;
create table t1 (a int);
connection master;
drop table if exists t1;
sync_slave_with_master;
# table does not exist
error 1146;
select * from t1;
connection master;
create table t1 (a int);
sync_slave_with_master;
insert into t1 values(1);
connection master;
delete from t1;
sync_slave_with_master;
select * from t1;
insert into t1 values(1);
connection master;
insert into t1 values(2);
update t1 set a=2;
sync_slave_with_master;
select * from t1;
# cleanup
connection master;
drop table t1;
sync_slave_with_master;
......@@ -358,15 +358,25 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{
error= -1;
my_error(ER_DB_DROP_EXISTS,MYF(0),db);
goto exit;
}
else
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_DB_DROP_EXISTS, ER(ER_DB_DROP_EXISTS), db);
if (!silent)
send_ok(thd,0);
}
else
{
pthread_mutex_lock(&LOCK_open);
remove_db_from_cache(db);
pthread_mutex_unlock(&LOCK_open);
error= -1;
if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0)) >= 0)
{
ha_drop_database(path);
query_cache_invalidate1(db);
error = 0;
}
goto exit;
}
if (lower_case_table_names)
{
......@@ -375,42 +385,30 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
my_casedn_str(files_charset_info, tmp_db);
db= tmp_db;
}
pthread_mutex_lock(&LOCK_open);
remove_db_from_cache(db);
pthread_mutex_unlock(&LOCK_open);
error = -1;
if ((deleted=mysql_rm_known_files(thd, dirp, db, path,0)) >= 0 && thd)
if (!silent && deleted>=0 && thd)
{
ha_drop_database(path);
query_cache_invalidate1(db);
if (!silent)
const char *query;
ulong query_length;
if (!thd->query)
{
const char *query;
ulong query_length;
if (!thd->query)
{
/* The client used the old obsolete mysql_drop_db() call */
query= path;
query_length = (uint) (strxmov(path,"drop database `", db, "`",
NullS)- path);
}
else
{
query=thd->query;
query_length=thd->query_length;
}
mysql_update_log.write(thd, query, query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, query, query_length, 0);
thd->clear_error();
mysql_bin_log.write(&qinfo);
}
send_ok(thd,(ulong) deleted);
/* The client used the old obsolete mysql_drop_db() call */
query= path;
query_length= (uint) (strxmov(path, "drop database `", db, "`",
NullS) - path);
}
else
{
query =thd->query;
query_length= thd->query_length;
}
mysql_update_log.write(thd, query, query_length);
if (mysql_bin_log.is_open())
{
Query_log_event qinfo(thd, query, query_length, 0);
thd->clear_error();
mysql_bin_log.write(&qinfo);
}
error = 0;
send_ok(thd, (ulong) deleted);
}
exit:
......
......@@ -199,7 +199,15 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
transactional_table= table->file->has_transactions();
log_delayed= (transactional_table || table->tmp_table);
if (deleted && (error <= 0 || !transactional_table))
/*
We write to the binary log even if we deleted no row, because maybe the
user is using this command to ensure that a table is clean on master *and
on slave*. Think of the case of a user having played separately with the
master's table and slave's table and wanting to take a fresh identical
start now.
error < 0 means "really no error". error <= 0 means "maybe some error".
*/
if ((deleted || (error < 0)) && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd,thd->query, thd->query_length);
if (mysql_bin_log.is_open())
......@@ -544,6 +552,8 @@ bool multi_delete::send_eof()
rows and we succeeded, or also in an error case when there
was a non-transaction-safe table involved, since
modifications in it cannot be rolled back.
Note that if we deleted nothing we don't write to the binlog (TODO:
fix this).
*/
if (deleted && (error <= 0 || normal_tables))
{
......
......@@ -254,7 +254,17 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
}
}
thd->tmp_table_used= tmp_table_deleted;
if (some_tables_deleted || tmp_table_deleted)
error= 0;
if (wrong_tables.length())
{
if (!foreign_key_error)
my_error(ER_BAD_TABLE_ERROR,MYF(0), wrong_tables.c_ptr());
else
my_error(ER_ROW_IS_REFERENCED, MYF(0));
error= 1;
}
if (some_tables_deleted || tmp_table_deleted || !error)
{
query_cache_invalidate3(thd, tables, 0);
if (!dont_log_query)
......@@ -262,7 +272,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
mysql_update_log.write(thd, thd->query,thd->query_length);
if (mysql_bin_log.is_open())
{
thd->clear_error();
if (!error)
thd->clear_error();
Query_log_event qinfo(thd, thd->query, thd->query_length,
tmp_table_deleted && !some_tables_deleted);
mysql_bin_log.write(&qinfo);
......@@ -271,15 +282,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
}
unlock_table_names(thd, tables);
error= 0;
if (wrong_tables.length())
{
if (!foreign_key_error)
my_error(ER_BAD_TABLE_ERROR,MYF(0),wrong_tables.c_ptr());
else
my_error(ER_ROW_IS_REFERENCED,MYF(0));
error= 1;
}
DBUG_RETURN(error);
}
......
......@@ -331,7 +331,7 @@ int mysql_update(THD *thd,
transactional_table= table->file->has_transactions();
log_delayed= (transactional_table || table->tmp_table);
if (updated && (error <= 0 || !transactional_table))
if ((updated || (error < 0)) && (error <= 0 || !transactional_table))
{
mysql_update_log.write(thd,thd->query,thd->query_length);
if (mysql_bin_log.is_open())
......@@ -1092,7 +1092,9 @@ bool multi_update::send_eof()
/*
Write the SQL statement to the binlog if we updated
rows and we succeeded or if we updated some non
transacational tables
transacational tables.
Note that if we updated nothing we don't write to the binlog (TODO:
fix this).
*/
if (updated && (local_error <= 0 || !trans_safe))
......
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