Details
Description
This task is inspired by MDEV-5399. There, TokuDB got confused because the query engine first said that it will do an index-covering scan, but then it did a table scan, so TokuDB didn't produce any data.
It makes sense to make the query engine be more strict with respect to what it asks from the storage engine (SE). Currently the query engine assumes that the SE would ignore the keyread mode when a table scan is opened. Currently the query engine uses two separate booleans to specify what kind of access to do with respect to index scans:
- bool TABLE::key_read
- bool TABLE::no_keyread
A proposal from Serg is to:
- Replace the two flags above with an enum that specifies if a keyread is possible, and if it should be done on the next index access:
- enum covering_scan {NEVER, POSSIBLE, CHOSEN, ENABLED}
- NEVER - do not use a covering index scan either because it is not possible, or because we don't want it. We do not want to use an index-only scan for instance for delete/update statements.
- POSSIBLE - index-only scan is possible to use.
- CHOSEN - the optimizer decided to use an index-only scan when a particular index is scanned.
- ENABLED - the execution engine should perform the scan as index-only.
- Remove file->extra(HA_EXTRA_KEYREAD) from everywhere in the source code, and add:
- one file->extra(HA_EXTRA_KEYREAD) into handler::ha_index_init, and
- one file->extra(HA_NO_EXTRA_KEYREAD) into handler::ha_rnd_init
(both look at this TABLE enum variable and change it accordingly)
- probably, remove all file->extra(HA_NO_EXTRA_KEYREAD) and add one to ha_external_lock(F_UNLCK)
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Two questions re the above idea: