MySQL InnoDB Gap Locks: What Gets Locked When the Row Doesn't Exist
Why InnoDB locks gaps between index records under REPEATABLE READ, why check-then-insert with FOR SHARE can deadlock, and what READ COMMITTED gives up. Based on the MySQL 8.4 manual.
mysqlinnodbdatabaseconcurrencylocking