# Percona5.7+MyRocksDB. Gap Lock without full unique key

**URL:** <https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303>\
**Category:** Percona Server for MySQL 5.7\
**Created:** [November 24, 2020, 12:56pm UTC](https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303 "2020-11-24T12:56:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilya\_Azrieli](https://avatars.discourse-cdn.com/v4/letter/i/e9bcb4/32.png) [@Ilya\_Azrieli](https://forums.percona.com/u/Ilya_Azrieli)\
**Post date:** [November 24, 2020, 12:56pm UTC](https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303/1 "2020-11-24T12:56:34Z")

</div>

ISSUE: Using Gap Lock without full unique key in multi-table or multi-statement transactions is not allowed.

---

<div class="post-metadata">

**Author:** ![George\_Lorch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/george_lorch/32/1108_2.png) [@George\_Lorch](https://forums.percona.com/u/George_Lorch)\
**Post date:** [November 24, 2020, 1:34pm UTC](https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303/2 "2020-11-24T13:34:26Z")

</div>

Do you have a specific question on this? This is a known limitation of MyRocks in that it currently does not support Gap or Range locking (described here [https://dev.mysql.com/doc/refman/5.7/en/innodb-locking.html#innodb-gap-locks](https://dev.mysql.com/doc/refman/5.7/en/innodb-locking.html#innodb-gap-locks)). See [https://www.percona.com/doc/percona-server/5.7/myrocks/limitations.html](https://www.percona.com/doc/percona-server/5.7/myrocks/limitations.html) for the full list of limitations of MyRocks within Percona Server and here [https://github.com/facebook/mysql-5.6/wiki/Row-Locking](https://github.com/facebook/mysql-5.6/wiki/Row-Locking) for more information on MyRocks row locking in general.

–

George O. Lorch III

Director of Server Engineering, Percona Server for MySQL, Percona XtraDB Cluster, and Percona XtraBackup

---

<div class="post-metadata">

**Author:** ![Ilya\_Azrieli](https://avatars.discourse-cdn.com/v4/letter/i/e9bcb4/32.png) [@Ilya\_Azrieli](https://forums.percona.com/u/Ilya_Azrieli)\
**Post date:** [November 25, 2020, 9:50am UTC](https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303/3 "2020-11-25T09:50:03Z")

</div>

@George_Lorch

Hi George.

Thanks for the your answer. I want to ask, if exist any workaround for this issue.

---

<div class="post-metadata">

**Author:** ![George\_Lorch](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/george_lorch/32/1108_2.png) [@George\_Lorch](https://forums.percona.com/u/George_Lorch)\
**Post date:** [November 25, 2020, 12:13pm UTC](https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303/4 "2020-11-25T12:13:48Z")

</div>

Hello Illya,

There is not a simple or direct workaround. You have probably one of three choices:

1. Rewrite your queries to avoid situations that require gap locking.

2. Change your default Transaction Isolation Level from REPEATABLE-READ to READ-COMMITTED. This may have unwanted side effects on change visibility within transactional operations, see [https://dev.mysql.com/doc/refman/5.7/en/set-transaction.html](https://dev.mysql.com/doc/refman/5.7/en/set-transaction.html).

3. Stick with InnoDB if you need absolute InnoDB-like functionality.

–

George O. Lorch III

Director of Server Engineering, Percona Server for MySQL, Percona XtraDB Cluster, and Percona XtraBackup

---

<div class="post-metadata">

**Author:** ![Ilya\_Azrieli](https://avatars.discourse-cdn.com/v4/letter/i/e9bcb4/32.png) [@Ilya\_Azrieli](https://forums.percona.com/u/Ilya_Azrieli)\
**Post date:** [November 25, 2020, 1:12pm UTC](https://forums.percona.com/t/percona5-7-myrocksdb-gap-lock-without-full-unique-key/8303/5 "2020-11-25T13:12:41Z")

</div>

Thank you very much George for your full answer
