ERROR MY-011542 Repl Plugin group_replication reported: 'Table repl_test does not have any PRIMARY KEY

1.1k Views Asked by At

I installed an InnoDB Cluster recently and trying to create a table without any primary key or equivalent to test the cluster index concept where "InnoDB internally generates a hidden clustered index named GEN_CLUST_INDEX on a synthetic column containing row ID values if the table has no PRIMARY KEY or suitable UNIQUE index".

I created table as below:

create table repl_test (Name varchar(10));

Checked for the creation of GEN_CLUST_INDEX:

select * from mysql.innodb_index_stats where database_name='test' and table_name = 'repl_test';

+---------------+------------+-----------------+---------------------+--------------+------------+-------------+-----------------------------------+
| database_name | table_name | index_name      | last_update         | stat_name    | stat_value | sample_size | stat_description                  |
+---------------+------------+-----------------+---------------------+--------------+------------+-------------+-----------------------------------+
| test      | repl_test  | GEN_CLUST_INDEX | 2019-02-22 06:29:26 | n_diff_pfx01 |          0 |           1 | DB_ROW_ID                         |
| test      | repl_test  | GEN_CLUST_INDEX | 2019-02-22 06:29:26 | n_leaf_pages |          1 |        NULL | Number of leaf pages in the index |
| test      | repl_test  | GEN_CLUST_INDEX | 2019-02-22 06:29:26 | size         |          1 |        NULL | Number of pages in the index      |
+---------------+------------+-----------------+---------------------+--------------+------------+-------------+-----------------------------------+
3 rows in set (0.00 sec)

But, when I try to insert row, I get the below error:

insert into repl_test values ('John');

ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin.

2019-02-22T14:32:53.177700Z 594022 [ERROR] [MY-011542] [Repl] Plugin group_replication reported: 'Table repl_test does not have any PRIMARY KEY. This is not compatible with Group Replication.'

Below is my conf file:

[client]
port            = 3306
socket          = /tmp/mysql.sock

[mysqld_safe]
socket          = /tmp/mysql.sock

[mysqld]

socket          = /tmp/mysql.sock
port            = 3306
basedir         = /mysql/product/8.0/TEST
datadir         = /mysql/data/TEST/innodb_data
log-error       = /mysql/admin/TEST/innodb_logs/mysql.log
log_bin         = /mysql/binlog/TEST/innodb_logs/mysql-bin
server-id=1
max_connections = 500
open_files_limit = 65535
expire_logs_days = 15

innodb_flush_log_at_trx_commit=1
sync_binlog=1

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
binlog_checksum = NONE
enforce_gtid_consistency = ON
gtid_mode = ON
relay-log=<<hostname>>-relay-bin

My MySQL version: mysql Ver 8.0.11 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)

1

There are 1 best solutions below

0
On BEST ANSWER

Auto-generation of the PK should work fine for non-clustered setups. However, InnoDB Cluster (Group Replication) and Galera need a user PK (or UNIQUE that can be promoted).

If you like, file a documentation bug with bugs.mysql.com complaining that this restriction is not clear. Be sure to point to the page that needs fixing.