Skip to content

Conversation

@akshaysuryawanshi
Copy link

https://perconadev.atlassian.net/browse/PS-10098

This patch implements a configurable gap_lock_raise_error system variable for MyRocks storage engine with three modes:

  • OFF (default): Disables gap lock error detection
  • WARNING: Issues warnings when gap locks would be used
  • ERROR: Throws errors when gap locks would be used

The feature leverages MyRocks' snapshot isolation to maintain REPEATABLE READ semantics while providing a migration path from InnoDB's gap locking behavior. Includes test coverage for all modes.

Patch inspired from the original commit from Upstream.

@akshaysuryawanshi akshaysuryawanshi force-pushed the PS-10098-Configurable-Gap-Lock-Detection-for-MyRocks branch from fff8cb5 to d47814d Compare July 27, 2025 18:31
@inikep
Copy link
Collaborator

inikep commented Sep 19, 2025

The newest version from Meta is split into 2 commits:
facebook/mysql-5.6@26bc9f518c6
facebook/mysql-5.6@d2c1430bcf7

@akshaysuryawanshi
Copy link
Author

@inikep thanks for finding these. Would Percona be interested in adopting these patches?

From usability perspective, gap_lock_raise_error is the most useful. For the file-related options, I have observed that using them is not as beneficial as returning the right error or warning to the user about the usage of Gap Locks. The ability to set it off is also useful when shadowing traffic to a MyRocks capable instance where the queries do not fail fatally with error but instead rely on Snapshot Isolation based MVCC.

Additionally the handling of warning in this port is less accommodating, in that it still returns a generic error but returns a specific warning. Maybe we can make the generic error go and away and solely generate the warning indicating usage of Gap Locks.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants