MDEV-24813 Signal full scan to storage engines.#3487
Conversation
|
|
701924a to
075f597
Compare
|
Also, I've tried this testcase create table t10 (a int, b varchar(100), index(a));
insert into t10 select seq, uuid() from seq_1_to_10000;
create table t11(a int);
explain insert into t11 select a from t10;
insert into t11 select a from t10;and init_read_record() isn't invoked for it. The index scan on t10 is initialized here: |
|
With this patch, we have "Using where with pushed condition" all over the place: |
075f597 to
97830d0
Compare
You are right. I had forgotten to make the call in join_read_first (and join_read_last). Added the calls to ha_extra in a new commit now. |
No longer the case with the new patch that does not comment out the cond_push if condition |
e9cd6a5 to
d0acb8e
Compare
d0acb8e to
654010e
Compare
When starting to do a full table/index scan without a WHERE or JOIN condition, tell the storage engine so and the corresponding ulong-truncated LIMIT. Include an innodb implementation: added an innodb switch table_lock_on_full_scan, so that when the switch is on, on receiving the full scan signal from the sql layer, if the truncated LIMIT is ULONG_MAX (likely no LIMIT), attempt to acquire a table lock. Updated tests that have different results with the switch on. (Comment and code edited by Sergei Petrunia)
654010e to
829a5e1
Compare
iMineLink
left a comment
There was a problem hiding this comment.
Please check my few minor comments, especially the ones around innodb_full_scan.test, thanks.
| int join_init_read_record(JOIN_TAB *tab) | ||
| { | ||
| bool need_unpacking= FALSE; | ||
| /* TODO: s/tab->join/join/g in this function */ |
829a5e1 to
be946e6
Compare
The three deadlock_*_race tests cannot reach their DEBUG_SYNC race under a table lock (it degenerates to a timeout), and the three I_S tests only restate a lock-mode change already covered by innodb_full_scan.test. - Addressed review comments
be946e6 to
5cd6733
Compare
This is an initial patch for discussion.
Will work in the following minimal example
--source include/have_innodb.inc
CREATE TABLE t (a INT PRIMARY KEY) ENGINE=InnoDB;
insert into t values (42);
BEGIN;
SELECT * FROM t LOCK IN SHARE MODE; # will acquire S lock
COMMIT;
DROP TABLE t;