Merge hezx.(none):/media/hda5/work/mysql/bkroot/mysql-5.1-new-rpl
into hezx.(none):/media/hda5/work/mysql/bkwork/bug#30998/5.1
This commit is contained in:
commit
127ef56129
27
mysql-test/suite/rpl/r/rpl_drop_view.result
Normal file
27
mysql-test/suite/rpl/r/rpl_drop_view.result
Normal file
@ -0,0 +1,27 @@
|
||||
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;
|
||||
drop table if exists t1, t2;
|
||||
drop view if exists v1, v2, v3, not_exist_view;
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create table t3 (c int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from t2;
|
||||
create view v3 as select * from t3;
|
||||
drop view not_exist_view;
|
||||
ERROR 42S02: Unknown table 'not_exist_view'
|
||||
drop view v1, not_exist_view;
|
||||
ERROR 42S02: Unknown table 'not_exist_view'
|
||||
select * from v1;
|
||||
ERROR 42S02: Table 'test.v1' doesn't exist
|
||||
drop view v2, v3;
|
||||
select * from v1;
|
||||
ERROR 42S02: Table 'test.v1' doesn't exist
|
||||
select * from v2;
|
||||
ERROR 42S02: Table 'test.v2' doesn't exist
|
||||
select * from v3;
|
||||
ERROR 42S02: Table 'test.v3' doesn't exist
|
31
mysql-test/suite/rpl/t/rpl_drop_view.test
Normal file
31
mysql-test/suite/rpl/t/rpl_drop_view.test
Normal file
@ -0,0 +1,31 @@
|
||||
# test case for bug#30998
|
||||
# Drop View breaks replication if view does not exist
|
||||
#
|
||||
|
||||
source include/master-slave.inc;
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
drop view if exists v1, v2, v3, not_exist_view;
|
||||
--enable_warnings
|
||||
create table t1 (a int);
|
||||
create table t2 (b int);
|
||||
create table t3 (c int);
|
||||
create view v1 as select * from t1;
|
||||
create view v2 as select * from t2;
|
||||
create view v3 as select * from t3;
|
||||
--error 1051
|
||||
drop view not_exist_view;
|
||||
--error 1051
|
||||
drop view v1, not_exist_view;
|
||||
--error 1146
|
||||
select * from v1;
|
||||
drop view v2, v3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
--error 1146
|
||||
select * from v1;
|
||||
--error 1146
|
||||
select * from v2;
|
||||
--error 1146
|
||||
select * from v3;
|
@ -1465,6 +1465,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||
char *wrong_object_db= NULL, *wrong_object_name= NULL;
|
||||
bool error= FALSE;
|
||||
enum legacy_db_type not_used;
|
||||
bool some_views_deleted= FALSE;
|
||||
bool something_wrong= FALSE;
|
||||
DBUG_ENTER("mysql_drop_view");
|
||||
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
@ -1506,6 +1508,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||
if (my_delete(path, MYF(MY_WME)))
|
||||
error= TRUE;
|
||||
|
||||
some_views_deleted= TRUE;
|
||||
|
||||
/*
|
||||
For a view, there is only one table_share object which should never
|
||||
be used outside of LOCK_open
|
||||
@ -1523,29 +1527,32 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
||||
sp_cache_invalidate();
|
||||
}
|
||||
|
||||
if (error)
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (wrong_object_name)
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name,
|
||||
"VIEW");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (non_existant_views.length())
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr());
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
write_bin_log(thd, TRUE, thd->query, thd->query_length);
|
||||
something_wrong= error || wrong_object_name || non_existant_views.length();
|
||||
if (some_views_deleted || !something_wrong)
|
||||
{
|
||||
/* if something goes wrong, bin-log with possible error code,
|
||||
otherwise bin-log with error code cleared.
|
||||
*/
|
||||
write_bin_log(thd, !something_wrong, thd->query, thd->query_length);
|
||||
}
|
||||
|
||||
send_ok(thd);
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
|
||||
if (something_wrong)
|
||||
{
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
send_ok(thd);
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user