-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-8464 : ALTER VIEW not replicated in some cases
In galera, like other DDLs, CREATE/ALTER VIEW commands are recreated and replicated during parsing. The ALGORITHM clause is internally set to VIEW_ALGORITHM_INHERIT if its not explicitly specified by the user. But since its not a valid type to be used in a command, it leads to an assertion failure. The solution is to not include the ALGORITHM clause in the command if its not explicitly specified (or INHERIT).
- Loading branch information
Nirbhay Choubey
committed
Jul 20, 2015
1 parent
71d1f35
commit af2f7ce
Showing
5 changed files
with
129 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
# MDEV-8464 : ALTER VIEW not replicated in some cases | ||
# | ||
# On node_1 | ||
USE test; | ||
CREATE TABLE t1(i INT) ENGINE=INNODB; | ||
CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT * FROM t1; | ||
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t1; | ||
CREATE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t1; | ||
CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1; | ||
# On node_2 | ||
USE test; | ||
SHOW CREATE VIEW v1; | ||
View Create View character_set_client collation_connection | ||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
SHOW CREATE VIEW v2; | ||
View Create View character_set_client collation_connection | ||
v2 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
SHOW CREATE VIEW v3; | ||
View Create View character_set_client collation_connection | ||
v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
SHOW CREATE VIEW v4; | ||
View Create View character_set_client collation_connection | ||
v4 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
# On node_1 | ||
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; | ||
ALTER ALGORITHM=UNDEFINED VIEW v2 AS SELECT * FROM t1; | ||
ALTER DEFINER=CURRENT_USER VIEW v3 AS SELECT * FROM t1; | ||
ALTER ALGORITHM=TEMPTABLE DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1; | ||
# On node_2 | ||
SHOW CREATE VIEW v1; | ||
View Create View character_set_client collation_connection | ||
v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
SHOW CREATE VIEW v2; | ||
View Create View character_set_client collation_connection | ||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
SHOW CREATE VIEW v3; | ||
View Create View character_set_client collation_connection | ||
v3 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
SHOW CREATE VIEW v4; | ||
View Create View character_set_client collation_connection | ||
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci | ||
# Cleanup | ||
DROP VIEW v1, v2, v3, v4; | ||
DROP TABLE t1; | ||
# End of tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--source include/galera_cluster.inc | ||
--source include/have_innodb.inc | ||
|
||
--echo # | ||
--echo # MDEV-8464 : ALTER VIEW not replicated in some cases | ||
--echo # | ||
--echo # On node_1 | ||
--connection node_1 | ||
USE test; | ||
CREATE TABLE t1(i INT) ENGINE=INNODB; | ||
CREATE DEFINER=CURRENT_USER VIEW v1 AS SELECT * FROM t1; | ||
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t1; | ||
CREATE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t1; | ||
CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1; | ||
|
||
--echo # On node_2 | ||
--connection node_2 | ||
USE test; | ||
SHOW CREATE VIEW v1; | ||
SHOW CREATE VIEW v2; | ||
SHOW CREATE VIEW v3; | ||
SHOW CREATE VIEW v4; | ||
|
||
--echo # On node_1 | ||
--connection node_1 | ||
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; | ||
ALTER ALGORITHM=UNDEFINED VIEW v2 AS SELECT * FROM t1; | ||
ALTER DEFINER=CURRENT_USER VIEW v3 AS SELECT * FROM t1; | ||
ALTER ALGORITHM=TEMPTABLE DEFINER=CURRENT_USER VIEW v4 AS SELECT * FROM t1; | ||
|
||
--echo # On node_2 | ||
--connection node_2 | ||
SHOW CREATE VIEW v1; | ||
SHOW CREATE VIEW v2; | ||
SHOW CREATE VIEW v3; | ||
SHOW CREATE VIEW v4; | ||
|
||
--echo # Cleanup | ||
DROP VIEW v1, v2, v3, v4; | ||
DROP TABLE t1; | ||
|
||
--echo # End of tests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters