Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

innodb_force_primary_key=1 to mitigate downtimes (row based replication of big tables without index) #197

Description

@GETandSELECT

Hey

I created a table with 200'000 records and NO index.

record looks like this:

INSERT INTO test.test 
            (uuid, 
             clock, 
             testfield) 
VALUES      (UUID(), 
             NOW(), 
             SUBSTR(CONCAT(MD5(RAND()), MD5(RAND())), 1, 36))

Then I deleted all rows in that table DELETE FROM test.test;, which resulted that the cluster was down for almost one hour. All write operation timed out. During row based replication MariaDB had to do a full table scan for every record.

> show processlist;
+-----+-----------------------+-----------------+------+---------+------+-----------------------------------------+---------------------------+----------+
| Id  | User                  | Host            | db   | Command | Time | State                                   | Info                      | Progress |
+-----+-----------------------+-----------------+------+---------+------+-----------------------------------------+---------------------------+----------+
|   1 | system user           |                 | NULL | Sleep   | 5423 | wsrep aborter idle                      | NULL                      |    0.000 |
|   2 | system user           |                 | NULL | Sleep   |    0 | Delete_rows_log_event::find_row(637163) | NULL                      | 

more Info How the Lack of a Primary Key May Effectively Stop the Slave -> they write about Master/Slave, we could reproduce the same with Galera

What do you think about this (innodb_force_primary_key) possible mitigation for this issue? We are DBaaS provider.

From XtraDB/InnoDB Server System Variables

Description: If set to 1 (0 is default) CREATE TABLEs without a primary or unique key where all keyparts are NOT NULL will not be accepted, and will return an error.
Commandline: --innodb-force-primary-key
Scope: Global
Dynamic: Yes
Data Type: boolean
Default Value: OFF
Introduced: MariaDB 10.1.0 

thanks for feedback

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions