Commit 1907bf04 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6409 CREATE VIEW replication problem if error occurs in mysql_register_view

fix by Sriram Patil
parent c1049657
create table v1 (a int);
include/master-slave.inc
[connection master]
create table t1 (a int);
create view v1 as select * from t1;
ERROR 42S01: Table 'v1' already exists
show tables;
Tables_in_test
t1
v1
show tables;
Tables_in_test
t1
drop table if exists t1, v1;
include/rpl_end.inc
#
# MDEV-6409 CREATE VIEW replication problem if error occurs in mysql_register_view
#
#
#
# verify that failed CREATE VIEW is not replicated
create table v1 (a int);
source include/master-slave.inc;
connection master;
create table t1 (a int);
--error ER_TABLE_EXISTS_ERROR
create view v1 as select * from t1;
show tables;
sync_slave_with_master;
show tables;
connection master;
drop table if exists t1, v1;
--source include/rpl_end.inc
......@@ -39,8 +39,7 @@
const LEX_STRING view_type= { C_STRING_WITH_LEN("VIEW") };
static int mysql_register_view(THD *thd, TABLE_LIST *view,
enum_view_create_mode mode);
static int mysql_register_view(THD *, TABLE_LIST *, enum_view_create_mode);
/*
Make a unique name for an anonymous view column
......@@ -670,7 +669,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
res= mysql_register_view(thd, view, mode);
if (mysql_bin_log.is_open())
if (!res && mysql_bin_log.is_open())
{
String buff;
const LEX_STRING command[3]=
......
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