| 1 |
# |
| 2 |
# The purpose of this test is to verify the correct functionality of |
| 3 |
# the before_dml hook. |
| 4 |
# |
| 5 |
# If the hook is not executed by any reason, this test must fail. |
| 6 |
# |
| 7 |
# |
| 8 |
|
| 9 |
--source include/not_group_replication_plugin.inc |
| 10 |
--source include/have_debug.inc |
| 11 |
--source include/have_binlog_format_mixed.inc |
| 12 |
--source include/have_replication_observers_example_plugin.inc |
| 13 |
|
| 14 |
--source include/install_replication_observers_example.inc |
| 15 |
|
| 16 |
--echo # |
| 17 |
--echo # Verify that the DML hook is in place and working |
| 18 |
--echo # |
| 19 |
|
| 20 |
CREATE TABLE t2 (c1 char(50) NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 21 |
CREATE TABLE tn (cn char(50) NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 22 |
|
| 23 |
SET @debug_saved= @@GLOBAL.DEBUG; |
| 24 |
SET @@GLOBAL.DEBUG= '+d,cause_failure_in_before_dml_hook'; |
| 25 |
|
| 26 |
#Test the INSERT instruction |
| 27 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 28 |
--eval INSERT INTO t2 VALUES('a') |
| 29 |
|
| 30 |
#Test the UPDATE instruction |
| 31 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 32 |
--eval UPDATE t2 SET c1 = 'a' |
| 33 |
|
| 34 |
#Test the INSERT...SELECT instruction |
| 35 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 36 |
--eval INSERT INTO t2 (c1) SELECT tn.cn FROM tn |
| 37 |
|
| 38 |
#Test the DELETE instruction |
| 39 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 40 |
--eval DELETE FROM t2 |
| 41 |
|
| 42 |
#Test the load instruction |
| 43 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 44 |
--eval LOAD DATA INFILE '../../std_data/words.dat' INTO TABLE t2 |
| 45 |
|
| 46 |
#Test the REPLACE instruction |
| 47 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 48 |
--eval REPLACE INTO t2 VALUES('a') |
| 49 |
|
| 50 |
#Test the REPLACE...SELECT instruction |
| 51 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 52 |
--eval REPLACE INTO t2 (c1) SELECT tn.cn FROM tn |
| 53 |
|
| 54 |
#Test the DELETE_MULTI instruction |
| 55 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 56 |
--eval DELETE t2, tn FROM t2, tn |
| 57 |
|
| 58 |
#Test the UPDATE_MULTI instruction |
| 59 |
--error ER_BEFORE_DML_VALIDATION_ERROR |
| 60 |
--eval UPDATE t2, tn SET c1 = 'a' |
| 61 |
|
| 62 |
--echo # |
| 63 |
--echo # Cleanup |
| 64 |
--echo # |
| 65 |
|
| 66 |
SET @@GLOBAL.DEBUG= @debug_saved; |
| 67 |
DROP TABLE t2; |
| 68 |
DROP TABLE tn; |
| 69 |
|
| 70 |
--source include/uninstall_replication_observers_example.inc |
| 71 |
|
| 72 |
--echo End of test |