Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MW-267: followup to the original pull request, removed unnecessary cast.
Signed-off-by: Sachin Setiya <sachinsetia1001@gmail.com>
- Loading branch information
1 parent
3045b60
commit 86ec6c2
Showing
32 changed files
with
1,636 additions
and
1 deletion.
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,2 @@ | ||
| let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'ON'; | ||
| --source include/wait_condition.inc |
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,83 @@ | ||
|
|
||
| # | ||
| # Let's understand the topology. | ||
| # * Independent Master with server-id = 1 | ||
| # * Galera cluster with 2 nodes: node#1 and node#2 with server-id = 2, 3 | ||
| # node#1 act as slave to Independent Master with server-id = 1 | ||
| # * Independent Slave with server-id = 4 replicating from galera node#2 | ||
| # | ||
|
|
||
| # Use default setting for mysqld processes | ||
| !include include/default_mysqld.cnf | ||
|
|
||
| [mysqld] | ||
| log-slave-updates | ||
| log-bin=mysqld-bin | ||
| binlog-format=row | ||
| gtid-mode=on | ||
| enforce-gtid-consistency=true | ||
|
|
||
| [mysqld.1] | ||
| server-id=1 | ||
|
|
||
| [mysqld.2] | ||
| server-id=2 | ||
|
|
||
| wsrep_provider=@ENV.WSREP_PROVIDER | ||
| wsrep_cluster_address='gcomm://' | ||
| wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts=1;' | ||
|
|
||
| # enforce read-committed characteristics across the cluster | ||
| wsrep_causal_reads=ON | ||
| wsrep_sync_wait = 7 | ||
|
|
||
| wsrep_node_address=127.0.0.1 | ||
| wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port | ||
| wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port | ||
|
|
||
| # Required for Galera | ||
| innodb_autoinc_lock_mode=2 | ||
|
|
||
| innodb_flush_log_at_trx_commit=2 | ||
|
|
||
| [mysqld.3] | ||
| server-id=3 | ||
|
|
||
| wsrep_provider=@ENV.WSREP_PROVIDER | ||
| wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port' | ||
| wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts = 1;' | ||
|
|
||
| # enforce read-committed characteristics across the cluster | ||
| wsrep_causal_reads=ON | ||
| wsrep_sync_wait = 7 | ||
|
|
||
| wsrep_node_address=127.0.0.1 | ||
| wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port | ||
| wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port | ||
|
|
||
| # Required for Galera | ||
| innodb_autoinc_lock_mode=2 | ||
|
|
||
| innodb_flush_log_at_trx_commit=2 | ||
|
|
||
| [mysqld.4] | ||
| server-id=4 | ||
|
|
||
| [ENV] | ||
| NODE_MYPORT_1= @mysqld.1.port | ||
| NODE_MYSOCK_1= @mysqld.1.socket | ||
|
|
||
| NODE_MYPORT_2= @mysqld.2.port | ||
| NODE_MYSOCK_2= @mysqld.2.socket | ||
|
|
||
| NODE_MYPORT_3= @mysqld.3.port | ||
| NODE_MYSOCK_3= @mysqld.3.socket | ||
|
|
||
| NODE_MYPORT_4= @mysqld.4.port | ||
| NODE_MYSOCK_4= @mysqld.4.socket | ||
|
|
||
| NODE_GALERAPORT_2= @mysqld.2.#galera_port | ||
| NODE_GALERAPORT_3= @mysqld.3.#galera_port | ||
|
|
||
| NODE_SSTPORT_2= @mysqld.2.#sst_port | ||
| NODE_SSTPORT_3= @mysqld.3.#sst_port |
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,87 @@ | ||
| # | ||
| # This .cnf file creates a setup with a 2-node Galera cluster and one stand-alone MySQL server, to be used as a slave | ||
| # | ||
|
|
||
| # Use default setting for mysqld processes | ||
| !include include/default_mysqld.cnf | ||
|
|
||
| [mysqld] | ||
| default-storage-engine=InnoDB | ||
|
|
||
| [mysqld.1] | ||
| server-id=1 | ||
| binlog-format=row | ||
| log-bin=mysqld-bin | ||
| log_slave_updates | ||
| gtid-mode=on | ||
| enforce-gtid-consistency=true | ||
| event-scheduler=1 | ||
|
|
||
| wsrep_provider=@ENV.WSREP_PROVIDER | ||
| wsrep_cluster_address='gcomm://' | ||
| wsrep_provider_options='base_port=@mysqld.1.#galera_port' | ||
|
|
||
| # enforce read-committed characteristics across the cluster | ||
| wsrep_causal_reads=ON | ||
| wsrep_sync_wait = 7 | ||
|
|
||
| wsrep_node_address=127.0.0.1 | ||
| wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port | ||
| wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port | ||
|
|
||
| # Required for Galera | ||
| innodb_autoinc_lock_mode=2 | ||
|
|
||
| innodb_flush_log_at_trx_commit=2 | ||
|
|
||
| [mysqld.2] | ||
| server-id=2 | ||
| binlog-format=row | ||
| log-bin=mysqld-bin | ||
| log_slave_updates | ||
| gtid-mode=on | ||
| enforce-gtid-consistency=true | ||
| event-scheduler=1 | ||
|
|
||
| wsrep_provider=@ENV.WSREP_PROVIDER | ||
| wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' | ||
| wsrep_provider_options='base_port=@mysqld.2.#galera_port' | ||
|
|
||
| # enforce read-committed characteristics across the cluster | ||
| wsrep_causal_reads=ON | ||
| wsrep_sync_wait = 7 | ||
|
|
||
| wsrep_node_address=127.0.0.1 | ||
| wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port | ||
| wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port | ||
|
|
||
| # Required for Galera | ||
| innodb_autoinc_lock_mode=2 | ||
|
|
||
| innodb_flush_log_at_trx_commit=2 | ||
|
|
||
| [mysqld.3] | ||
| server-id=3 | ||
| replicate-ignore-db=test | ||
| replicate-wild-ignore-table=test.% | ||
| log-bin=mysqld-bin | ||
| log_slave_updates | ||
| gtid-mode=on | ||
| enforce-gtid-consistency=true | ||
| event-scheduler=1 | ||
|
|
||
| [ENV] | ||
| NODE_MYPORT_1= @mysqld.1.port | ||
| NODE_MYSOCK_1= @mysqld.1.socket | ||
|
|
||
| NODE_MYPORT_2= @mysqld.2.port | ||
| NODE_MYSOCK_2= @mysqld.2.socket | ||
|
|
||
| NODE_MYPORT_3= @mysqld.3.port | ||
| NODE_MYSOCK_3= @mysqld.3.socket | ||
|
|
||
| NODE_GALERAPORT_1= @mysqld.1.#galera_port | ||
| NODE_GALERAPORT_2= @mysqld.2.#galera_port | ||
|
|
||
| NODE_SSTPORT_1= @mysqld.1.#sst_port | ||
| NODE_SSTPORT_2= @mysqld.2.#sst_port |
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,162 @@ | ||
| SAVEPOINT in a stored function should be forbidden | ||
| CREATE FUNCTION f1 () RETURNS INT BEGIN | ||
| SAVEPOINT s; | ||
| RETURN 1; | ||
| END| | ||
| SELECT f1(); | ||
| f1() | ||
| 1 | ||
| DROP FUNCTION f1; | ||
| ROLLBACK TO SAVEPOINT in a stored function should be forbidden | ||
| CREATE FUNCTION f2 () RETURNS INT BEGIN | ||
| ROLLBACK TO SAVEPOINT s; | ||
| RETURN 1; | ||
| END| | ||
| BEGIN; | ||
| SAVEPOINT s; | ||
| SELECT f2(); | ||
| ERROR 42000: SAVEPOINT s does not exist | ||
| COMMIT; | ||
| DROP FUNCTION f2; | ||
| BEGIN; | ||
| SAVEPOINT S; | ||
| ROLLBACK TO SAVEPOINT S; | ||
| COMMIT; | ||
| CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; | ||
| CREATE TABLE t2 (a INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; | ||
| INSERT INTO t1 values (110), (111), (112), (113), (114); | ||
| Direct SAVEPOINT in a trigger should be forbidden | ||
| CREATE TRIGGER i1_t1 BEFORE INSERT ON t1 FOR EACH ROW SAVEPOINT s; | ||
| INSERT INTO t1 VALUES (1); | ||
| DROP TRIGGER i1_t1; | ||
| CREATE TRIGGER i2_t1 AFTER INSERT ON t1 FOR EACH ROW SAVEPOINT s; | ||
| INSERT INTO t1 VALUES (2); | ||
| DROP TRIGGER i2_t1; | ||
| INSERT INTO t1 VALUES (3); | ||
| CREATE TRIGGER u1_t1 BEFORE UPDATE ON t1 FOR EACH ROW SAVEPOINT s; | ||
| UPDATE t1 SET a=4 WHERE a=3; | ||
| DROP TRIGGER u1_t1; | ||
| CREATE TRIGGER u2_t1 AFTER UPDATE ON t1 FOR EACH ROW SAVEPOINT s; | ||
| UPDATE t1 SET a=4 WHERE a=3; | ||
| DROP TRIGGER u2_t1; | ||
| CREATE TRIGGER d1_t1 BEFORE DELETE ON t1 FOR EACH ROW SAVEPOINT s; | ||
| DELETE FROM t1; | ||
| DROP TRIGGER d1_t1; | ||
| CREATE TRIGGER d1_t1 AFTER DELETE ON t1 FOR EACH ROW SAVEPOINT s; | ||
| DELETE FROM t1; | ||
| DROP TRIGGER d1_t1; | ||
| SAVEPOINT in a compound statement in a trigger should be forbidden | ||
| CREATE TRIGGER i3_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN | ||
| SAVEPOINT s; | ||
| END| | ||
| INSERT INTO t1 VALUES (5); | ||
| DROP TRIGGER i3_t1; | ||
| SAVEPOINT in a PS call in a trigger should be forbidden | ||
| CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN | ||
| PREPARE set_savepoint FROM "SAVEPOINT s"; | ||
| EXECUTE set_savepoint; | ||
| DEALLOCATE PREPARE set_savepoint; | ||
| END| | ||
| ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger | ||
| SAVEPOINT in SP called from a trigger should be forbidden | ||
| CREATE PROCEDURE p1() BEGIN | ||
| SAVEPOINT s; | ||
| END| | ||
| CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1; | ||
| INSERT INTO t1 VALUES (6); | ||
| DROP TRIGGER i5_t1; | ||
| SAVEPOINT in a SP called from a PS called from a trigger be forbidden | ||
| PREPARE call_p1 FROM "CALL p1"; | ||
| CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW EXECUTE call_p1; | ||
| ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger | ||
| SAVEPOINT in a function called from a trigger should be forbidden | ||
| CREATE FUNCTION f1 () RETURNS INT BEGIN | ||
| SAVEPOINT s; | ||
| RETURN 1; | ||
| END| | ||
| CREATE TRIGGER i7_t1 BEFORE INSERT ON t1 FOR EACH ROW SET @foo = f1(); | ||
| INSERT INTO t1 VALUES (7); | ||
| DROP TRIGGER i7_t1; | ||
| SAVEPOINT in a SP called from a SP called from a trigger should be forbidden | ||
| CREATE PROCEDURE p2() BEGIN | ||
| CALL p1(); | ||
| END| | ||
| CREATE TRIGGER i8_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p2; | ||
| INSERT INTO t1 VALUES (8); | ||
| DROP TRIGGER i8_t1; | ||
| SAVEPOINT in a SP called from a trigger called from a SP should be forbidden | ||
| CREATE TRIGGER i9_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1; | ||
| CREATE PROCEDURE p3() BEGIN | ||
| INSERT INTO t1 VALUES (9); | ||
| END| | ||
| CALL p3(); | ||
| DROP TRIGGER i9_t1; | ||
| ROLLBACK TO SAVEPOINT in trigger as a trivial statement should be forbidden | ||
| CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW ROLLBACK TO SAVEPOINT s; | ||
| BEGIN; | ||
| SAVEPOINT s; | ||
| INSERT INTO t1 VALUES (5); | ||
| ERROR 42000: SAVEPOINT s does not exist | ||
| COMMIT; | ||
| DROP TRIGGER i4_t1; | ||
| ROLLBACK TO SAVEPOINT in a trigger in a SP call should be forbidden | ||
| CREATE PROCEDURE p4() BEGIN | ||
| ROLLBACK TO SAVEPOINT s; | ||
| END| | ||
| CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p4; | ||
| BEGIN; | ||
| SAVEPOINT s; | ||
| INSERT INTO t1 VALUES (6); | ||
| ERROR 42000: SAVEPOINT s does not exist | ||
| COMMIT; | ||
| DROP TRIGGER i5_t1; | ||
| SAVEPOINT in a SP next to a trigger should work | ||
| CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a = NEW.a + 1; | ||
| CREATE PROCEDURE p5() BEGIN | ||
| SAVEPOINT s; | ||
| INSERT INTO t1 VALUES (10); | ||
| ROLLBACK TO SAVEPOINT s; | ||
| END| | ||
| BEGIN; | ||
| CALL p5(); | ||
| COMMIT; | ||
| DROP TRIGGER i6_t1; | ||
| create trigger t1 before insert on t1 for each row | ||
| begin | ||
| insert into t2 values (NULL); | ||
| end| | ||
| INSERT INTO t1 VALUES (201), (202), (203); | ||
| SELECT * FROM t1; | ||
| a | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 201 | ||
| 202 | ||
| 203 | ||
| SELECT COUNT(*) FROM t2; | ||
| COUNT(*) | ||
| 3 | ||
| SELECT * FROM t1; | ||
| a | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 201 | ||
| 202 | ||
| 203 | ||
| SELECT COUNT(*) FROM t2; | ||
| COUNT(*) | ||
| 3 | ||
| DEALLOCATE PREPARE call_p1; | ||
| DROP TABLE t1, t2; | ||
| DROP PROCEDURE p1; | ||
| DROP PROCEDURE p2; | ||
| DROP PROCEDURE p3; | ||
| DROP PROCEDURE p4; | ||
| DROP PROCEDURE p5; | ||
| DROP FUNCTION f1; |
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 @@ | ||
| DROP TABLE IF EXISTS t1, t2; | ||
| DROP TABLE IF EXISTS x1, x2; | ||
| CREATE TABLE t1 (f1 INTEGER); | ||
| CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER); | ||
| SET GLOBAL wsrep_replicate_myisam = TRUE; | ||
| CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM; | ||
| CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM; | ||
| INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); | ||
| INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); | ||
| INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4; | ||
| INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); | ||
| # ANALYZE test | ||
| ANALYZE TABLE t1, t2; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 analyze status OK | ||
| test.t2 analyze status OK | ||
| # OPTIMIZE test | ||
| OPTIMIZE TABLE t1, t2; | ||
| Table Op Msg_type Msg_text | ||
| test.t1 optimize note Table does not support optimize, doing recreate + analyze instead | ||
| test.t1 optimize status OK | ||
| test.t2 optimize note Table does not support optimize, doing recreate + analyze instead | ||
| test.t2 optimize status OK | ||
| # REPAIR test | ||
| REPAIR TABLE x1, x2; | ||
| Table Op Msg_type Msg_text | ||
| test.x1 repair status OK | ||
| test.x2 repair status OK | ||
| SELECT COUNT(*) = 10 FROM t1; | ||
| COUNT(*) = 10 | ||
| 1 | ||
| SELECT COUNT(*) = 10 FROM x1; | ||
| COUNT(*) = 10 | ||
| 1 | ||
| SELECT COUNT(*) = 10000 FROM t2; | ||
| COUNT(*) = 10000 | ||
| 1 | ||
| SELECT COUNT(*) = 10 FROM x2; | ||
| COUNT(*) = 10 | ||
| 1 | ||
| DROP TABLE t1, t2; | ||
| DROP TABLE x1, x2; | ||
| SET GLOBAL wsrep_replicate_myisam = FALSE; |
Oops, something went wrong.