mariadb/storage/innobase/include
Marko Mäkelä 358921ce32 MDEV-26938 Support descending indexes internally in InnoDB
This is loosely based on the InnoDB changes in
mysql/mysql-server@97fd8b1b69
that I had developed in 2015 or 2016.

For each B-tree key field, we will allow a flag ASC/DESC to be associated.
When PRIMARY KEY fields are internally appended to secondary indexes,
the ASC/DESC attribute will be inherited, so that covering index scans
will work as expected.

Note: Until the subsequent commit, the DESC attribute will be ignored
(no HA_REVERSE_SORT flag will be written to .frm files).

dict_field_t::descending: A new flag to denote descending order.

cmp_data(), cmp_dfield_dfield(): Add a new parameter descending.

cmp_dtuple_rec(), cmp_dtuple_rec_with_match(): Add a parameter "index".

dtuple_coll_eq(): Replaces dtuple_coll_cmp().

cmp_dfield_dfield_eq_prefix(): Replaces cmp_dfield_dfield_like_prefix().

dict_index_t::is_btree(): Check whether the index is a regular
B-tree index (not SPATIAL, FULLTEXT, or the ibuf.index,
or a corrupted index.

btr_cur_search_to_nth_level_func(): Only attempt to use
the adaptive hash index if index->is_btree().
This function may also be invoked on ibuf.index, and
cmp_dtuple_rec_with_match_bytes() will no longer work on ibuf.index
because it assumes that the index and record fields exactly match.
The ibuf.index is a special variadic index tree.

Thanks to Thirunarayanan Balathandayuthapani for fixing some bugs:
MDEV-27439, MDEV-27374/MDEV-27445.
2022-01-26 18:43:05 +01:00
..
btr0btr.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
btr0btr.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
btr0bulk.h Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
btr0cur.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
btr0cur.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
btr0defragment.h MDEV-25791: Remove UNIV_INTERN 2021-05-27 13:28:08 +03:00
btr0pcur.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
btr0pcur.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
btr0sea.h MDEV-26769 InnoDB does not support hardware lock elision 2021-10-22 12:38:45 +03:00
btr0sea.ic MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
btr0types.h Merge 10.3 into 10.4 2020-03-30 14:50:23 +03:00
buf0block_hint.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
buf0buddy.h MDEV-15053 fixup: MSAN use-of-uninitialized-value 2020-06-06 08:30:09 +03:00
buf0buf.h MDEV-27094 Debug builds include useless InnoDB "disabled" options 2021-11-19 17:46:16 +02:00
buf0buf.ic MDEV-25342: autosize innodb_buffer_pool_chunk_size 2022-01-18 14:20:57 +02:00
buf0checksum.h MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
buf0dblwr.h MDEV-23399 fixup: Use plain pthread_cond 2021-02-07 12:19:24 +02:00
buf0dump.h Make .clang-format work with clang-8 2019-11-15 18:09:30 +01:00
buf0flu.h Merge 10.6 into 10.7 2022-01-04 09:55:58 +02:00
buf0lru.h MDEV-26826 Duplicated computations of buf_pool.page_hash addresses 2021-10-22 12:33:37 +03:00
buf0rea.h Merge 10.6 into 10.7 2021-09-06 16:23:49 +03:00
buf0types.h Merge 10.6 into 10.7 2021-11-19 17:45:52 +02:00
data0data.h MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
data0data.ic Merge 10.4 into 10.5 2020-07-02 09:41:44 +03:00
data0type.h Cleanup: Simplify dict_table_schema_check() 2021-05-21 18:03:39 +03:00
data0type.ic Cleanup: Simplify dict_table_schema_check() 2021-05-21 18:03:39 +03:00
data0types.h Update FSF Address 2019-05-11 21:29:06 +03:00
db0err.h MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
dict0boot.h MDEV-26195: Use a 32-bit data type for some tablespace fields 2021-07-22 11:22:47 +03:00
dict0crea.h MDEV-25791: Remove UNIV_INTERN 2021-05-27 13:28:08 +03:00
dict0crea.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
dict0defrag_bg.h MDEV-25919 fixup: Acquire MDL also in defragmentation 2021-09-18 14:39:32 +03:00
dict0dict.h MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
dict0dict.ic Merge 10.6 into 10.7 2021-08-31 15:07:39 +03:00
dict0load.h MDEV-24258 Merge dict_sys.mutex into dict_sys.latch 2021-08-31 13:51:35 +03:00
dict0mem.h MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
dict0mem.ic MDEV-25506 (3 of 3): Do not delete .ibd files before commit 2021-06-09 17:06:07 +03:00
dict0pagecompress.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
dict0pagecompress.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
dict0stats.h MDEV-25919: Lock tables before acquiring dict_sys.latch 2021-08-31 13:54:44 +03:00
dict0stats.ic MDEV-25919 fixup: MSAN and Valgrind errors related to statistics 2021-09-04 19:08:14 +03:00
dict0stats_bg.h MDEV-27094 Debug builds include useless InnoDB "disabled" options 2021-11-19 17:46:16 +02:00
dict0types.h MDEV-26966: Remove innodb_force_load_corrupted 2021-11-04 09:55:35 +02:00
dyn0buf.h MDEV-24188: Merge 10.4 into 10.5 2020-11-13 22:06:50 +02:00
dyn0types.h MDEV-12353: Replace MLOG_REC_INSERT,MLOG_COMP_REC_INSERT 2020-02-13 18:19:14 +02:00
eval0eval.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
eval0eval.ic Remove InnoDB wrappers of <string.h> functions 2019-10-30 07:31:39 +02:00
eval0proc.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
eval0proc.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
fil0crypt.h Merge 10.6 into 10.7 2021-11-19 17:45:52 +02:00
fil0crypt.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
fil0fil.h MDEV-27199: Remove FIL_PAGE_FILE_FLUSH_LSN 2022-01-21 16:16:32 +02:00
fil0fil.ic MDEV-25312 Replace fil_space_t::name with fil_space_t::name() 2021-04-07 18:01:13 +03:00
fil0pagecompress.h Merge 10.6 into 10.7 2021-08-19 13:03:48 +03:00
fsp0file.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
fsp0fsp.h Merge 10.6 into 10.7 2021-11-19 17:45:52 +02:00
fsp0space.h MDEV-26195: Use a 32-bit data type for some tablespace fields 2021-07-22 11:22:47 +03:00
fsp0sysspace.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
fsp0types.h MDEV-12933 sort out the compression library chaos 2021-10-27 15:55:14 +02:00
fts0ast.h Merge 10.4 to 10.5 2020-10-22 17:08:49 +03:00
fts0blex.h Merge 10.1 into 10.2 2019-04-02 09:14:15 +03:00
fts0fts.h Merge 10.5 into 10.6 2021-10-21 16:06:34 +03:00
fts0opt.h Merge 10.1 to 10.2 2019-10-25 17:33:39 +03:00
fts0pars.h
fts0plugin.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
fts0priv.h MDEV-24258 Merge dict_sys.mutex into dict_sys.latch 2021-08-31 13:51:35 +03:00
fts0priv.ic MDEV-18867 Long Time to Stop and Start 2020-09-10 14:10:26 +05:30
fts0tlex.h Merge 10.1 into 10.2 2019-04-02 09:14:15 +03:00
fts0tokenize.h MDEV-21581 Helper functions and methods for CHARSET_INFO 2020-01-28 12:29:23 +04:00
fts0types.h Merge 10.5 into 10.6 2021-10-21 16:06:34 +03:00
fts0types.ic Merge 10.4 into 10.5 2020-05-20 17:46:05 +03:00
fts0vlc.h MDEV-19522 InnoDB commit fails when FTS_DOC_ID value is greater than 4294967295 2021-10-21 12:56:59 +03:00
fut0fut.h Merge 10.6 into 10.7 2021-11-19 17:45:52 +02:00
fut0lst.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
gis0geo.h MDEV-21924 Clean up InnoDB GIS record comparison 2020-03-12 18:13:53 +02:00
gis0rtree.h MDEV-24142: Remove __FILE__,__LINE__ related to buf_block_t::lock 2020-12-03 15:28:53 +02:00
gis0rtree.ic Merge 10.5 into 10.6 2021-04-14 12:32:27 +03:00
gis0type.h MDEV-21452: Replace ib_mutex_t with mysql_mutex_t 2020-12-15 17:56:18 +02:00
ha0ha.h MDEV-22871: Clean up btr_search_sys 2020-06-18 14:16:01 +03:00
ha0ha.ic MDEV-22871: Remove pointer indirection for InnoDB hash_table_t 2020-06-18 14:16:01 +03:00
ha0storage.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ha0storage.ic MDEV-22871: Remove pointer indirection for InnoDB hash_table_t 2020-06-18 14:16:01 +03:00
ha_prototypes.h MDEV-23328 Server hang due to Galera lock conflict resolution 2021-10-29 20:40:35 +02:00
handler0alter.h Merge branch '10.2' into 10.3 2020-05-04 16:47:11 +02:00
hash0hash.h MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock 2022-01-18 15:18:42 +03:00
ibuf0ibuf.h MDEV-26195: Use a 32-bit data type for some tablespace fields 2021-07-22 11:22:47 +03:00
ibuf0ibuf.ic MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
ibuf0types.h Update FSF Address 2019-05-11 21:29:06 +03:00
lock0iter.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
lock0lock.h MDEV-27025 insert-intention lock conflicts with waiting ORDINARY lock 2022-01-18 15:18:42 +03:00
lock0lock.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
lock0prdt.h MDEV-20612: Partition lock_sys.latch 2021-02-12 17:44:32 +02:00
lock0priv.h MDEV-26769 InnoDB does not support hardware lock elision 2021-10-22 12:38:45 +03:00
lock0priv.ic MDEV-26769 InnoDB does not support hardware lock elision 2021-10-22 12:38:45 +03:00
lock0types.h MDEV-20612: Partition lock_sys.latch 2021-02-12 17:44:32 +02:00
log0crypt.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
log0log.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
log0recv.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
log0types.h MDEV-22325 ib_logfile0 is too small for innodb_thread_concurrency=0. The size of ib_logfile0 should be bigger than 200 kB * innodb_thread_concurrency. 2020-06-09 03:15:31 +03:00
mach0data.h Merge 10.4 into 10.5 2021-10-21 15:26:25 +03:00
mach0data.ic MDEV-24142: Replace InnoDB rw_lock_t with sux_lock 2020-12-03 15:19:49 +02:00
mem0mem.h MDEV-22871: Clean up hash_table_t 2020-06-18 14:16:01 +03:00
mem0mem.ic MDEV-21452: Replace ib_mutex_t with mysql_mutex_t 2020-12-15 17:56:18 +02:00
mtr0log.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
mtr0mtr.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
mtr0mtr.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
mtr0types.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
os0file.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
os0file.ic MDEV-16264 fixup: Clean up asynchronous I/O 2020-10-26 17:53:54 +02:00
os0thread.h cleanup: os_thread_create -> std::thread 2021-03-19 11:44:28 +03:00
page0cur.h MDEV-25031 Not applying INSERT_*_REDUNDANT due to corruption on page 2021-03-11 14:21:28 +02:00
page0cur.ic MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
page0page.h MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
page0page.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
page0types.h MDEV-27058 fixup: GCC 11 -march=i686 -Warray-bounds 2021-12-04 12:55:26 +02:00
page0zip.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
page0zip.ic Merge 10.5 into 10.6 2022-01-04 09:26:38 +02:00
pars0grm.h Cleanup: Remove pars_stored_procedure_call() 2021-07-29 15:37:35 +03:00
pars0opt.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
pars0pars.h MDEV-25919 preparation: Various cleanup 2021-08-31 13:54:20 +03:00
pars0sym.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
pars0types.h Update FSF Address 2019-05-11 21:29:06 +03:00
que0que.h MDEV-25919 preparation: Various cleanup 2021-08-31 13:54:20 +03:00
que0que.ic MDEV-24671: Replace lock_wait_timeout_task with mysql_cond_timedwait() 2021-01-27 15:45:39 +02:00
que0types.h MDEV-23379 Deprecate&ignore InnoDB concurrency throttling parameters 2020-08-04 06:59:29 +03:00
read0types.h MDEV-515 Reduce InnoDB undo logging for insert into empty table 2021-01-25 18:41:27 +02:00
rem0cmp.h MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
rem0rec.h Merge 10.4 into 10.5 2021-04-14 11:35:39 +03:00
rem0rec.ic Merge 10.4 into 10.5 2020-07-02 09:41:44 +03:00
rem0types.h Merge 10.4 into 10.5 2020-05-05 21:16:22 +03:00
row0ext.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
row0ext.ic Update FSF Address 2019-05-11 21:29:06 +03:00
row0ftsort.h Cleanup: Replace mysql_cond_t with pthread_cond_t 2021-02-07 13:21:18 +02:00
row0import.h Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
row0ins.h MDEV-24818: Optimize multi-statement INSERT into an empty table 2021-03-16 15:21:34 +02:00
row0log.h Merge 10.5 into 10.6 2021-03-18 15:46:28 +02:00
row0log.ic MDEV-24142: Replace InnoDB rw_lock_t with sux_lock 2020-12-03 15:19:49 +02:00
row0merge.h MDEV-26938 Support descending indexes internally in InnoDB 2022-01-26 18:43:05 +01:00
row0mysql.h Merge 10.5 into 10.6 2021-10-28 09:08:58 +03:00
row0purge.h MDEV-25919: Lock tables before acquiring dict_sys.latch 2021-08-31 13:54:44 +03:00
row0quiesce.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
row0row.h Merge 10.3 into 10.4 2020-05-05 20:33:10 +03:00
row0row.ic Merge 10.3 into 10.4 2020-05-05 20:33:10 +03:00
row0sel.h MDEV-21907: Fix most clang -Wconversion in InnoDB 2020-03-11 08:29:48 +02:00
row0sel.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
row0types.h Merge 10.4 into 10.5 2020-03-30 19:07:25 +03:00
row0uins.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
row0umod.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
row0undo.h Merge branch '10.3' into 10.4 2019-05-19 20:55:37 +02:00
row0upd.h Merge 10.4 into 10.5 2020-08-26 12:02:07 +03:00
row0upd.ic Merge 10.3 into 10.4 2020-05-05 20:33:10 +03:00
row0vers.h MDEV-21452: Replace all direct use of os_event_t 2020-12-15 17:56:17 +02:00
rw_lock.h MDEV-26769 InnoDB does not support hardware lock elision 2021-10-22 12:38:45 +03:00
srv0mon.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
srv0mon.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
srv0srv.h MDEV-14425 Improve the redo log for concurrency 2022-01-21 16:03:47 +02:00
srv0start.h MDEV-22343 Remove SYS_TABLESPACES and SYS_DATAFILES 2020-11-11 11:15:11 +02:00
srw_lock.h Fix build failure on mac due to invalid access on private member from rw_lock 2021-11-24 17:52:51 +02:00
sux_lock.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
transactional_lock_guard.h Windows : fix clang-cl build. 2021-11-28 11:43:35 +01:00
trx0i_s.h Merge 10.2 into 10.3 2021-07-27 10:47:17 +03:00
trx0purge.h MDEV-27017 Assertion failure 'table->get_ref_count() == 0' on DDL that involves FULLTEXT INDEX 2022-01-05 20:09:50 +05:30
trx0rec.h MDEV-24621 In bulk insert, pre-sort and build indexes one page at a time 2021-10-26 15:01:44 +03:00
trx0rec.ic Merge 10.2 into 10.3 2019-05-14 17:18:46 +03:00
trx0roll.h MDEV-25297 Assertion: trx->roll_limit <= trx->undo_no in ROLLBACK TO SAVEPOINT 2021-04-09 09:18:07 +03:00
trx0rseg.h Merge 10.6 into 10.7 2021-11-19 17:45:52 +02:00
trx0rseg.ic MDEV-26195: Use a 32-bit data type for some tablespace fields 2021-07-22 11:22:47 +03:00
trx0sys.h MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
trx0trx.h MDEV-24621 In bulk insert, pre-sort and build indexes one page at a time 2021-10-26 15:01:44 +03:00
trx0trx.ic Merge 10.2 into 10.3 2021-07-27 10:47:17 +03:00
trx0types.h MDEV-26195: Use a 32-bit data type for some tablespace fields 2021-07-22 11:22:47 +03:00
trx0undo.h Merge 10.5 into 10.6 2021-06-21 17:49:33 +03:00
trx0undo.ic MDEV-27058: Reduce the size of buf_block_t and buf_page_t 2021-11-18 17:47:19 +02:00
trx0xa.h Update FSF Address 2019-05-11 21:29:06 +03:00
univ.i Merge 10.6 into 10.7 2022-01-12 13:14:58 +02:00
ut0byte.h Cleanup: Aligned InnoDB index page header access 2020-02-08 14:12:59 +02:00
ut0byte.ic Merge 10.2 into 10.3 2021-10-28 07:50:05 +03:00
ut0counter.h MDEV-25281: Switch to use non-atomic (vs atomic) distributed counter to 2021-03-29 16:15:28 +03:00
ut0dbg.h Merge 10.2 into 10.3 2019-05-29 11:32:46 +03:00
ut0list.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0list.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0lst.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0mem.h Cleanup: Remove unnecessary #include 2020-09-30 13:35:05 +03:00
ut0mem.ic Remove InnoDB wrappers of <string.h> functions 2019-10-30 07:31:39 +02:00
ut0new.h MDEV-26826 Duplicated computations of buf_pool.page_hash addresses 2021-10-22 12:33:37 +03:00
ut0pool.h MDEV-26882 InnoDB number of trx pools note improvement 2021-10-22 14:42:00 +03:00
ut0rbt.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0rnd.h MDEV-25905: Assertion table2==NULL in dict_sys_t::add() 2021-06-14 12:38:56 +03:00
ut0rnd.ic MDEV-25905: Assertion table2==NULL in dict_sys_t::add() 2021-06-14 12:38:56 +03:00
ut0sort.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0stage.h MDEV-21907: Fix most clang -Wconversion in InnoDB 2020-03-11 08:29:48 +02:00
ut0ut.h MDEV-27158: humanize the bytes in innodb info/error messages 2022-01-18 14:20:59 +02:00
ut0ut.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0vec.h Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0vec.ic Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
ut0wqueue.h Merge 10.5 into 10.6 2021-10-21 16:06:34 +03:00