mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
d36f578130
can be not replicable. Now CREATE statements for writing in the binlog are created as follows: - the beginning of the statement is re-created; - the rest of the statement is copied from the original query. The problem appears when there is a version-specific comment (produced by mysqldump), started in the re-created part of the statement and closed in the copied part -- there is closing comment-parenthesis, but there is no opening one. The proper fix could be to re-create original statement, but we can not implement it in 5.0. So, for 5.0 the fix is just to cut closing comment-parenthesis. This technique is also used for SHOW CREATE PROCEDURE statement (so we are able to reuse existing code). mysql-test/r/rpl_sp.result: Updated result file. mysql-test/r/rpl_trigger.result: Updated result file. mysql-test/r/rpl_view.result: Updated result file. mysql-test/t/rpl_sp.test: Added test case for BUG#20438. mysql-test/t/rpl_trigger.test: Added test case for BUG#20438. mysql-test/t/rpl_view.test: Added test case for BUG#20438. sql/sp.cc: Trim comments at the end. sql/sp_head.cc: Moved this code to the separate function to be re-used. sql/sql_lex.cc: Added a new function. sql/sql_lex.h: Added a new function. sql/sql_trigger.cc: Trim comments at the end. sql/sql_view.cc: Trim comments at the end.
131 lines
2.4 KiB
Text
131 lines
2.4 KiB
Text
source include/master-slave.inc;
|
|
--disable_warnings
|
|
drop table if exists t1,v1;
|
|
drop view if exists t1,v1;
|
|
sync_slave_with_master;
|
|
reset master;
|
|
--enable_warnings
|
|
|
|
#
|
|
# Check that createion drop of view is replicated, also check replication of
|
|
# updating of view
|
|
#
|
|
connection master;
|
|
create table t1 (a int);
|
|
insert into t1 values (1);
|
|
create view v1 as select a from t1;
|
|
insert into v1 values (2);
|
|
select * from v1 order by a;
|
|
sync_slave_with_master;
|
|
# view already have to be on slave
|
|
select * from v1 order by a;
|
|
connection master;
|
|
update v1 set a=3 where a=1;
|
|
select * from v1 order by a;
|
|
sync_slave_with_master;
|
|
select * from v1 order by a;
|
|
connection master;
|
|
delete from v1 where a=2;
|
|
select * from v1 order by a;
|
|
sync_slave_with_master;
|
|
select * from v1 order by a;
|
|
connection master;
|
|
# 'alter view' internally maped to creation, but still check that it works
|
|
alter view v1 as select a as b from t1;
|
|
sync_slave_with_master;
|
|
select * from v1 order by 1;
|
|
connection master;
|
|
drop view v1;
|
|
sync_slave_with_master;
|
|
#error, because view have to be removed from slave
|
|
-- error 1146
|
|
select * from v1 order by a;
|
|
connection master;
|
|
drop table t1;
|
|
sync_slave_with_master;
|
|
--replace_column 2 # 5 #
|
|
show binlog events limit 1,100;
|
|
|
|
|
|
|
|
#
|
|
# BUG#20438: CREATE statements for views, stored routines and triggers can be
|
|
# not replicable.
|
|
#
|
|
|
|
--echo
|
|
--echo ---> Test for BUG#20438
|
|
|
|
# Prepare environment.
|
|
|
|
--echo
|
|
--echo ---> Preparing environment...
|
|
--echo ---> connection: master
|
|
--connection master
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1;
|
|
DROP VIEW IF EXISTS v1;
|
|
--enable_warnings
|
|
|
|
--echo
|
|
--echo ---> Synchronizing slave with master...
|
|
|
|
--save_master_pos
|
|
--connection slave
|
|
--sync_with_master
|
|
|
|
--echo
|
|
--echo ---> connection: master
|
|
--connection master
|
|
|
|
# Test.
|
|
|
|
--echo
|
|
--echo ---> Creating objects...
|
|
|
|
CREATE TABLE t1(c INT);
|
|
|
|
/*!50003 CREATE VIEW v1 AS SELECT * FROM t1 */;
|
|
|
|
--echo
|
|
--echo ---> Inserting value...
|
|
|
|
INSERT INTO t1 VALUES(1);
|
|
|
|
--echo
|
|
--echo ---> Checking on master...
|
|
|
|
SELECT * FROM t1;
|
|
|
|
--echo
|
|
--echo ---> Synchronizing slave with master...
|
|
|
|
--save_master_pos
|
|
--connection slave
|
|
--sync_with_master
|
|
|
|
--echo ---> connection: master
|
|
|
|
--echo
|
|
--echo ---> Checking on slave...
|
|
|
|
SELECT * FROM t1;
|
|
|
|
# Cleanup.
|
|
|
|
--echo
|
|
--echo ---> connection: master
|
|
--connection master
|
|
|
|
--echo
|
|
--echo ---> Cleaning up...
|
|
|
|
DROP VIEW v1;
|
|
DROP TABLE t1;
|
|
|
|
--save_master_pos
|
|
--connection slave
|
|
--sync_with_master
|
|
--connection master
|
|
|