| 1 |
include/have_replication_observers_example_plugin.inc |
| 2 |
include/install_replication_observers_example.inc |
| 3 |
|
| 4 |
# 1. Establish 5 connections and create 2 tables |
| 5 |
[connection con1] |
| 6 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 7 |
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 8 |
|
| 9 |
# 2. Lock a table so one query will block, this one is not counted |
| 10 |
[connection con2] |
| 11 |
LOCK TABLE t1 WRITE; |
| 12 |
[connection con3] |
| 13 |
INSERT INTO t1 VALUES (2);; |
| 14 |
|
| 15 |
# 3. Leave a transaction open without commit (counted) |
| 16 |
[connection con4] |
| 17 |
BEGIN; |
| 18 |
INSERT INTO t2 VALUES(1); |
| 19 |
|
| 20 |
# 4. Leave a transaction stuck on after commit |
| 21 |
[connection con5] |
| 22 |
SET @@GLOBAL.DEBUG='+d,bgc_after_after_commit_stage'; |
| 23 |
INSERT INTO t2 VALUES (3);; |
| 24 |
[connection con1] |
| 25 |
SET @@GLOBAL.DEBUG='-d,bgc_after_after_commit_stage'; |
| 26 |
# |
| 27 |
# 5. Execute a query that on a server hook will count the number of |
| 28 |
# queries |
| 29 |
SET @@GLOBAL.DEBUG= '+d,validate_replication_observers_plugin_counts_transactions'; |
| 30 |
INSERT INTO t2 VALUES (10);; |
| 31 |
[connection con6] |
| 32 |
SET @@GLOBAL.DEBUG= '-d,validate_replication_observers_plugin_counts_transactions'; |
| 33 |
# |
| 34 |
# 6. Clean up |
| 35 |
[connection con2] |
| 36 |
UNLOCK TABLES; |
| 37 |
[connection con4] |
| 38 |
SET DEBUG_SYNC='now SIGNAL continue_commit'; |
| 39 |
COMMIT; |
| 40 |
[connection con3] |
| 41 |
[connection con1] |
| 42 |
[connection con5] |
| 43 |
[connection con1] |
| 44 |
DROP TABLE t1; |
| 45 |
DROP TABLE t2; |
| 46 |
SET @@GLOBAL.DEBUG= '-d,validate_replication_observers_plugin_counts_transactions'; |
| 47 |
include/uninstall_replication_observers_example.inc |