Skip to content
This repository was archived by the owner on Mar 1, 2026. It is now read-only.
This repository was archived by the owner on Mar 1, 2026. It is now read-only.

MyRocks invalid insert with multiple values partially passes when table is under write lock #251

Description

@tplavcic

The full example is below, if I remove the write lock on table then the values won't be inserted partially.
In each case the error is presented but in MyRocks with write lock it actually passes partially.

InnoDB:

mysql> create TABLE t1 (a int not null, b int not null, primary key(b));
Query OK, 0 rows affected (0.32 sec)

mysql> LOCK TABLE t1 WRITE;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO t1 VALUES (1,'a'), (2,'b');
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'

mysql> select * FROM t1;
Empty set (0.00 sec)

MyRocks:

mysql> create TABLE t1 (a int not null, b int not null, primary key(b));
Query OK, 0 rows affected (0.13 sec)

mysql> LOCK TABLE t1 WRITE;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO t1 VALUES (1,'a'), (2,'b');
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'

mysql> select * FROM t1;
+---+---+
| a | b |
+---+---+
| 1 | 0 |
+---+---+
1 row in set (0.00 sec)

MyRocks without the write lock:

mysql> create TABLE t1 (a int not null, b int not null, primary key(b));
Query OK, 0 rows affected (0.12 sec)

mysql> INSERT INTO t1 VALUES (1,'a'), (2,'b');
ERROR 1062 (23000): Duplicate entry '0' for key 'PRIMARY'

mysql> select * FROM t1;
Empty set (0.00 sec)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions