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)