Bug #115474 Query rewrite plugin not working
Submitted: 1 Jul 13:20 Modified: 1 Jul 13:30
Reporter: Mathava Selvan Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[1 Jul 13:20] Mathava Selvan
Description:
with reference to the bug 115437, raising the issue below

Thanks , I don't have entry for autocommit variables in my cnf file. After disabling read_only mode pattern_digest got updated, even though query rewrite is still hot happening. 

localhost:[(none)]> INSERT INTO query_rewrite.rewrite_rules (pattern, replacement) VALUES ('SELECT ?', 'SELECT ? + 1');
Query OK, 1 row affected (0.00 sec)

localhost:[(none)]> call query_rewrite.flush_rewrite_rules();
Query OK, 1 row affected (0.00 sec)

localhost:[(none)]> select * from query_rewrite.rewrite_rules;
+----+----------+------------------+--------------+---------+---------+----------------+--------------------+
| id | pattern  | pattern_database | replacement  | enabled | message | pattern_digest | normalized_pattern |
+----+----------+------------------+--------------+---------+---------+----------------+--------------------+
|  1 | SELECT ? | NULL             | SELECT ? + 1 | YES     | NULL    | NULL           | NULL               |
+----+----------+------------------+--------------+---------+---------+----------------+--------------------+
1 row in set (0.00 sec)

localhost:[(none)]> show global variables like 'read_only';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| read_only     | ON    |
+---------------+-------+
1 row in set (0.00 sec)

localhost:[(none)]> set global read_only=0;
Query OK, 0 rows affected (0.00 sec)

localhost:[(none)]> call query_rewrite.flush_rewrite_rules();
Query OK, 1 row affected (0.00 sec)

localhost:[(none)]> select * from query_rewrite.rewrite_rules;
+----+----------+------------------+--------------+---------+---------+------------------------------------------------------------------+--------------------+
| id | pattern  | pattern_database | replacement  | enabled | message | pattern_digest                                                   | normalized_pattern |
+----+----------+------------------+--------------+---------+---------+------------------------------------------------------------------+--------------------+
|  1 | SELECT ? | NULL             | SELECT ? + 1 | YES     | NULL    | d1b44b0c19af710b5a679907e284acd2ddc285201794bc69a2389d77baedddae | select ?           |
+----+----------+------------------+--------------+---------+---------+------------------------------------------------------------------+--------------------+
1 row in set (0.00 sec)

localhost:[(none)]> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

How to repeat:
localhost:[(none)]> INSERT INTO query_rewrite.rewrite_rules (pattern, replacement) VALUES ('SELECT ?', 'SELECT ? + 1');
Query OK, 1 row affected (0.00 sec)

localhost:[(none)]> call query_rewrite.flush_rewrite_rules();
Query OK, 1 row affected (0.00 sec)

localhost:[(none)]> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)
[1 Jul 13:30] MySQL Verification Team
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

the original bug for this report is:

https://bugs.mysql.com/bug.php?id=115437

Thank you for your interest in MySQL.

When autocommit is set to ON, we can NOT reproduce your problem.

Hence, we can not continue with looking at the problem that we are not able to reproduce.