[MDEV-31236] Assertion `prebuilt->select_lock_type == LOCK_NONE || (index)->is_spatial()' failed in row_search_mvcc Created: 2023-05-10 Updated: 2023-11-28 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Locking, Storage Engine - InnoDB, Stored routines |
| Affects Version/s: | 10.6, 10.8, 10.9, 10.10, 10.11, 11.0 |
| Fix Version/s: | 10.6, 10.11, 11.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Daniel Black |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | regression-10.6 | ||
| Issue Links: |
|
||||||||
| Description |
|
The failure is non-deterministic, run with --repeat=N. It usually fails for me in ~10 attempts on a debug build, but it can vary on different machines and builds.
Reproducible on 10.6+, including earlier minor releases. |
| Comments |
| Comment by Marko Mäkelä [ 2023-05-11 ] | |||||||||||||
|
I can fairly easily reproduce a core dump of this, but I had no luck with rr. SKIP LOCKED was implemented in Perhaps it would be helpful to make the procedure run multiple SELECT statements, and the connection default to do the same. With an rr replay trace it should be easier to understand what is going here and how it should be fixed. | |||||||||||||
| Comment by Daniel Black [ 2023-05-19 ] | |||||||||||||
|
The assertion cause is select_lock_type is LOCK_X. Confirmed it is lock_trx_handle_wait a few lines above (under the skipped locked condition) returning DB_SUCCESS with clust_rec = NULL. It looks odd purely on description, that lock_trx_handle_wait returns DB_SUCCESS rather than seemingly more accurate DB_SUCCESS_LOCKED_REC, however if it did, the case below where it fails would assert on clust_rec != NULL. The one other caller of lock_trx_handle_wait process DB_SUCCESS as the success on a deadlock resolution. At the moment I'm of the opinion that its just the assertion that is incorrect now that SKIP LOCKED is there. This is largely based on the comments that "the record doesn't exist in the read view" means the only real action is to go to the next record. So a fix of the form below, that may need to be extended for the "LOCK IN SHARE MODE" after I manufacture a similar test case around that too.
Also possible improvement at this point lock_trx_handle_wait could mark a SKIP LOCK query as a deadlock victim returning DB_DEADLOCK. It should be possible to skip to next record here? What needs to be done to trx to make this happen? |