percona-server icon indicating copy to clipboard operation
percona-server copied to clipboard

PS-10098 Configurable Gap Lock Detection for MyRocks

Open akshaysuryawanshi opened this issue 5 months ago • 2 comments

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 avatar Jul 27 '25 03:07 akshaysuryawanshi

The newest version from Meta is split into 2 commits: https://github.com/facebook/mysql-5.6/commit/26bc9f518c6 https://github.com/facebook/mysql-5.6/commit/d2c1430bcf7

inikep avatar Sep 19 '25 09:09 inikep

@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?

akshaysuryawanshi avatar Sep 22 '25 16:09 akshaysuryawanshi