Bug #119775 External locking should be removed
Submitted: 26 Jan 6:37
Reporter: Daniël van Eeden (OCA) Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:9.6.0 OS:Any
Assigned to: CPU Architecture:Any
Tags: external locking, external_locking

[26 Jan 6:37] Daniël van Eeden
Description:
Docs:
- https://dev.mysql.com/doc/refman/9.6/en/external-locking.html
- https://dev.mysql.com/doc/refman/9.6/en/server-options.html#option_mysqld_external-locking

The basic idea of external locking is:
1. Multiple servers sharing the same database directory (datadir)
2. With external locking enabled the data files (MYI, MYD) are locked with OS level locks.
3. The result is that both instances can use the same datadir without corrupting the files.
4. This only works with MyISAM, not with InnoDB.

This might be useful for situations where multiple servers use the same shared (NFS?) storage.

I think this is never a good option anymore as Group Replication is more reliable, InnoDB compatible and probably also faster.

And with the InnoDB Data Dictionary since 8.0, I don't think this option even works anymore.

Running myisamchk without stopping mysqld might still work, but for that running CHECK TABLE or REPAIR TABLE is clearly a better option.

How to repeat:
podman volume create mysql_shared

podman run -d --rm -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_ROOT_HOST='%' -v mysql_shared:/var/lib/mysql --name mysql1 -p 3306:3306 -p33060:33060 -it container-registry.oracle.com/mysql/community-server:latest --external-locking

podman run -d --rm -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_ROOT_HOST='%' -v mysql_shared:/var/lib/mysql --name mysql2 -p 3307:3306 -p33061:33060 -it container-registry.oracle.com/mysql/community-server:latest --external-locking

podman logs mysql2

---------------------
2026-01-26T06:22:12.932488Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2026-01-26T06:22:13.932812Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2026-01-26T06:22:14.932996Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2026-01-26T06:22:15.933222Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2026-01-26T06:22:16.933424Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
2026-01-26T06:22:17.933663Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11
---------------------

Suggested fix:
1. Remove the external locking option or at least deprecate it
2. Update the documentation