Bug #74487 primary key missing for query_rewrite.rewrite_rules
Submitted: 21 Oct 2014 19:07 Modified: 16 Feb 2015 20:38
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.7.5-labs-preview OS:Any
Assigned to: CPU Architecture:Any
Tags: rewriter plugin

[21 Oct 2014 19:07] Daniël van Eeden
Description:
The rewrite_rules table as installed by the rewriter plugin doesn't contain a primary key.

Missing primary keys can cause: 
- Issues for group replication (GCS)
- Performance degradation for replication
- Performance degradation for InnoDB (http://blog.jcole.us/2013/05/02/how-does-innodb-behave-without-a-primary-key/)
- Issues for Galera based clusters

And this is a bad example for other applications/users.

How to repeat:
Install rewriter plugin and check table layout

Suggested fix:
Add primary key
[22 Oct 2014 14:21] MySQL Verification Team
Hello Daniël,

Thank you for the bug report.

Thanks,
Umesh
[22 Oct 2014 14:22] MySQL Verification Team
// - followed steps for installing plugin http://mysqlserverteam.com/the-query-rewrite-plugins/

[root@cluster-repo mysql-5.7.5-labs-preview]# bin/mysql -u root -p < lib/plugin/install_rewriter_plugin.sql
Enter password:
[root@cluster-repo mysql-5.7.5-labs-preview]# bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.5-labs-preview-log MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show create table  query_rewrite.rewrite_rules\G
*************************** 1. row ***************************
       Table: rewrite_rules
Create Table: CREATE TABLE `rewrite_rules` (
  `pattern` varchar(10000) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `pattern_database` varchar(20) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
  `replacement` varchar(10000) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `enabled` char(1) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'Y',
  `message` varchar(1000) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
[16 Feb 2015 20:38] Erlend Dahl
This has been fixed on the feature tree.