| 1 |
# |
| 2 |
# Tests of the dedicated thread for refreshing the rules table. |
| 3 |
# |
| 4 |
SET sql_mode = 'PIPES_AS_CONCAT'; |
| 5 |
# Query rewrite plugin was installed. |
| 6 |
# |
| 7 |
# We will now test shutting down the server while refreshing rules. We |
| 8 |
# then restart the server and make sure it recovered. |
| 9 |
# |
| 10 |
# We will shut down the server while a session is waiting for a debug |
| 11 |
# sync signal. All debug sync points are released during shutdown, |
| 12 |
# so the plugin will proceed to try and read from a handler with a server |
| 13 |
# that has gone away. This will lead to a storage engine error. |
| 14 |
CALL mtr.add_suppression( "Got error from storage engine while refreshing " || |
| 15 |
"rewrite rules." ); |
| 16 |
INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) |
| 17 |
VALUES ( 'SELECT "Rewrite"', 'SELECT "Rewritten"' ); |
| 18 |
SET GLOBAL debug= '+d,dbug.block_do_refresh'; |
| 19 |
# Two root connections are supposed to show here |
| 20 |
SELECT COUNT(user) FROM information_schema.processlist WHERE user LIKE 'root'; |
| 21 |
COUNT(user) |
| 22 |
2 |
| 23 |
Warnings: |
| 24 |
Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead |
| 25 |
# We have to do this in order to avoid deadlock on the memory table's |
| 26 |
# mutex. |
| 27 |
SET @@global.rewriter_enabled = OFF; |
| 28 |
CALL query_rewrite.flush_rewrite_rules(); |
| 29 |
# We don't care if we time out here, as long as we manage to restart the |
| 30 |
# server. |
| 31 |
SET debug_sync = 'now WAIT_FOR parked'; |
| 32 |
# Two root connections are supposed to show here |
| 33 |
SELECT COUNT(user) FROM information_schema.processlist WHERE user LIKE 'root'; |
| 34 |
COUNT(user) |
| 35 |
2 |
| 36 |
Warnings: |
| 37 |
Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead |
| 38 |
# |
| 39 |
# Restart the server |
| 40 |
# |
| 41 |
SELECT 'Rewrite'; |
| 42 |
Rewritten |
| 43 |
Rewritten |
| 44 |
Warnings: |
| 45 |
Note 1105 Query 'SELECT 'Rewrite'' rewritten to 'SELECT "Rewritten"' by a query rewrite plugin |
| 46 |
# One root connection is supposed to show here, as the rewrite thread is now gone |
| 47 |
SELECT COUNT(user) FROM information_schema.processlist WHERE user LIKE 'root'; |
| 48 |
COUNT(user) |
| 49 |
1 |
| 50 |
Warnings: |
| 51 |
Warning 1287 'INFORMATION_SCHEMA.PROCESSLIST' is deprecated and will be removed in a future release. Please use performance_schema.processlist instead |
| 52 |
SET @@global.rewriter_enabled = DEFAULT; |
| 53 |
Warnings: |
| 54 |
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 55 |
# Query rewrite plugin was queued for uninstalling. |