mariadb/storage/innobase/include
Marko Mäkelä b102872ad5 MDEV-31767 InnoDB tables are being flagged as corrupted on an I/O bound server
The main problem is that at ever since
commit aaef2e1d8c removed the
function buf_wait_for_read(), it is not safe to invoke
buf_page_get_low() with RW_NO_LATCH, that is, only buffer-fixing
the page. If a page read (or decryption or decompression) is in
progress, there would be a race condition when executing consistency
checks, and a page would wrongly be flagged as corrupted.

Furthermore, if the page is actually corrupted and the initial
access to it was with RW_NO_LATCH (only buffer-fixing), the
page read handler would likely end up in an infinite loop in
buf_pool_t::corrupted_evict(). It is not safe to invoke
mtr_t::upgrade_buffer_fix() on a block on which a page latch
was not initially acquired in buf_page_get_low().

btr_block_reget(): Remove the constant parameter rw_latch=RW_X_LATCH.

btr_block_get(): Assert that RW_NO_LATCH is not being used,
and change the parameter type of rw_latch.

btr_pcur_move_to_next_page(), innobase_table_is_empty(): Adjust for the
parameter type change of btr_block_get().

btr_root_block_get(): If mode==RW_NO_LATCH, do not check the integrity of
the page, because it is not safe to do so.

btr_page_alloc_low(), btr_page_free(): If the root page latch is not
previously held by the mini-transaction, invoke btr_root_block_get()
again with the proper latching mode.

btr_latch_prev(): Helper function to safely acquire a latch on a
preceding sibling page while holding a latch on a B-tree page.
To avoid deadlocks, we must not wait for the latch while holding
a latch on the current page, because another thread may be waiting
for our page latch when moving to the next page from our preceding
sibling page. If s_lock_try() or x_lock_try() on the preceding page fails,
we must release the current page latch, and wait for the latch on the
preceding page as well as the current page, in that order.
Page splits or merges will be prevented by the parent page latch
that we are holding.

btr_cur_t::search_leaf(): Make use of btr_latch_prev().

btr_cur_t::open_leaf(): Make use of btr_latch_prev(). Do not invoke
mtr_t::upgrade_buffer_fix() (when latch_mode == BTR_MODIFY_TREE),
because we will already have acquired all page latches upfront.

btr_cur_t::pessimistic_search_leaf(): Do acquire an exclusive index latch
before accessing the page. Make use of btr_latch_prev().
2023-07-25 11:40:58 +03:00
..
btr0btr.h MDEV-31767 InnoDB tables are being flagged as corrupted on an I/O bound server 2023-07-25 11:40:58 +03:00
btr0btr.inl MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
btr0bulk.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
btr0cur.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0cur.inl MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
btr0defragment.h MDEV-25791: Remove UNIV_INTERN 2021-05-27 13:28:08 +03:00
btr0pcur.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0pcur.inl MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
btr0sea.h MDEV-31559 btr_search_hash_table_validate() does not check if CHECK TABLE is killed 2023-06-30 17:07:21 +03:00
btr0sea.inl MDEV-27700 ASAN: Heap_use_after_free in btr_search_drop_page_hash_index() 2022-08-22 16:29:46 +05:30
btr0types.h MDEV-29835 InnoDB hang on B-tree split or merge 2023-03-16 15:52:42 +02: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 Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
buf0buf.h MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
buf0buf.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
buf0checksum.h MDEV-25105 Remove innodb_checksum_algorithm values none,innodb,... 2021-03-11 12:46:18 +02:00
buf0dblwr.h Merge 10.5 into 10.6 2023-04-25 13:10:33 +03:00
buf0dump.h
buf0flu.h MDEV-26827 Make page flushing even faster 2023-03-16 17:19: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 MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
buf0types.h MDEV-28845 InnoDB: Failing assertion: bpage->can_relocate() in buf0lru.cc 2022-06-15 17:00:05 +03:00
data0data.h MDEV-26294 Duplicate entries in unique index not detected when changing collation 2022-07-04 16:13:04 +03:00
data0data.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
data0type.h MDEV-26294 Duplicate entries in unique index not detected when changing collation 2022-07-04 16:13:04 +03:00
data0type.inl cleanup: un-inline dtype_get_mblen() 2022-04-13 17:50:00 +02:00
data0types.h
db0err.h Merge 10.5 into 10.6 2022-06-09 13:34:52 +03:00
dict0boot.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
dict0crea.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
dict0crea.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
dict0defrag_bg.h MDEV-25919 fixup: Acquire MDL also in defragmentation 2021-09-18 14:39:32 +03:00
dict0dict.h MDEV-29504/MDEV-29849 TRUNCATE breaks FOREIGN KEY locking 2022-11-08 17:34:34 +02:00
dict0dict.inl MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
dict0load.h MDEV-29504/MDEV-29849 TRUNCATE breaks FOREIGN KEY locking 2022-11-08 17:34:34 +02:00
dict0mem.h Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00
dict0mem.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
dict0pagecompress.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
dict0pagecompress.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
dict0stats.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
dict0stats.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
dict0stats_bg.h Merge 10.5 into 10.6 2022-04-26 15:21:20 +03:00
dict0types.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
dyn0buf.h MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
dyn0types.h
eval0eval.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
eval0eval.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
eval0proc.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
eval0proc.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
fil0crypt.h MDEV-13542: Do not crash on decryption failure 2022-06-08 09:48:12 +03:00
fil0crypt.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
fil0fil.h Merge 10.5 into 10.6 2023-06-26 17:11:38 +03:00
fil0pagecompress.h Merge 10.4 into 10.5 2021-08-18 18:22:35 +03:00
fsp0file.h MDEV-27014 InnoDB fails to restore page 0 from the doublewrite buffer 2021-12-12 09:58:54 +05:30
fsp0fsp.h Merge 10.5 into 10.6 2022-12-13 16:58:58 +02:00
fsp0space.h MDEV-25312 Replace fil_space_t::name with fil_space_t::name() 2021-04-07 18:01:13 +03:00
fsp0sysspace.h Cleanup: Make InnoDB page numbers uint32_t 2020-10-15 17:06:17 +03:00
fsp0types.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
fts0ast.h Merge 10.4 to 10.5 2020-10-22 17:08:49 +03:00
fts0blex.h
fts0fts.h MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
fts0opt.h
fts0pars.h
fts0plugin.h
fts0priv.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
fts0priv.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
fts0tlex.h
fts0tokenize.h
fts0types.h MDEV-30996 insert.. select in presence of full text index freezes all other commits at commit time 2023-04-24 11:06:56 +05:30
fts0types.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01: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
fut0lst.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
gis0geo.h MDEV-21924 Clean up InnoDB GIS record comparison 2020-03-12 18:13:53 +02:00
gis0rtree.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
gis0rtree.inl MDEV-21098: Assertion failure in rec_get_offsets_func() 2022-08-01 11:25:50 +03:00
gis0type.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
ha0ha.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ha0ha.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ha0storage.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ha0storage.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ha_prototypes.h MDEV-30413 : run sequence nextval got [Note] WSREP: MDL BF-BF conflict and [ERROR] Aborting 2023-03-30 13:32:44 +02:00
handler0alter.h Merge branch '10.2' into 10.3 2020-05-04 16:47:11 +02:00
hash0hash.h After-merge fixes 2022-03-08 09:04:03 +02:00
ibuf0ibuf.h Merge 10.5 into 10.6 2022-11-14 15:44:55 +02:00
ibuf0ibuf.inl MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
lock0iter.h
lock0lock.h MDEV-29311 Server Status Innodb_row_lock_time% is reported in seconds 2023-07-10 12:42:46 +03:00
lock0lock.inl MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
lock0prdt.h MDEV-20612: Partition lock_sys.latch 2021-02-12 17:44:32 +02:00
lock0priv.h After-merge fixes 2022-03-08 09:04:03 +02:00
lock0priv.inl After-merge fixes 2022-03-08 09:04:03 +02:00
lock0types.h MDEV-20612: Partition lock_sys.latch 2021-02-12 17:44:32 +02:00
log0crypt.h MDEV-25791: Remove UNIV_INTERN 2021-05-27 13:28:08 +03:00
log0log.h MDEV-31132 Deadlock between DDL and purge of InnoDB history 2023-04-26 12:08:59 +03:00
log0log.inl MDEV-31132 Deadlock between DDL and purge of InnoDB history 2023-04-26 12:08:59 +03:00
log0recv.h MDEV-31362 recv_sys_t::apply(bool): Assertion `!last_batch || recovered_lsn == scanned_lsn' failed 2023-05-30 17:21:49 +03: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 branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
mach0data.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
mariadb_stats.h MDEV-31558 Add InnoDB engine information to the slow query log 2023-07-07 12:53:18 +03:00
mem0mem.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
mem0mem.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
mtr0log.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
mtr0mtr.h MDEV-29593 Purge misses a chance to free not-yet-reused undo pages 2023-04-21 17:58:09 +03:00
mtr0types.h MDEV-30638 Deadlock between INSERT and InnoDB non-persistent statistics update 2023-02-16 08:30:20 +02:00
os0file.h MDEV-29911 InnoDB recovery and mariadb-backup --prepare fail to report detailed progress 2023-05-19 15:20:07 +03:00
os0file.inl MDEV-30132 Crash after recovery, with InnoDB: Tried to read ... 2022-11-30 10:54:03 +02:00
page0cur.h MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
page0cur.inl MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
page0page.h MDEV-28797 Assertion `page_rec_is_user_rec(rec)' failed in PageBulk::getSplitRec 2022-11-08 15:27:29 +05:30
page0page.inl MDEV-28797 Assertion `page_rec_is_user_rec(rec)' failed in PageBulk::getSplitRec 2022-11-08 15:27:29 +05:30
page0types.h MDEV-27924 page_zip_copy_recs() corrupts ROW_FORMAT=COMPRESSED block descriptor 2022-02-23 11:34:52 +02:00
page0zip.h MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
page0zip.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
pars0grm.h Cleanup: Remove pars_stored_procedure_call() 2021-07-29 15:37:35 +03:00
pars0opt.h
pars0pars.h MDEV-25919 preparation: Various cleanup 2021-08-31 13:54:20 +03:00
pars0sym.h
pars0types.h
que0que.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
que0que.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
que0types.h MDEV-23379 Deprecate&ignore InnoDB concurrency throttling parameters 2020-08-04 06:59:29 +03:00
read0types.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
rem0cmp.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
rem0cmp.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
rem0rec.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
rem0rec.inl MDEV-21098: Assertion failure in rec_get_offsets_func() 2022-08-01 11:25:50 +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 2022-01-30 09:46:52 +01:00
row0ext.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
row0ftsort.h Cleanup: Replace mysql_cond_t with pthread_cond_t 2021-02-07 13:21:18 +02:00
row0import.h
row0ins.h Merge 10.5 into 10.6 2023-03-28 15:25:52 +03:00
row0log.h MDEV-15250 UPSERT during ALTER TABLE results in 'Duplicate entry' error for alter 2022-04-26 16:22:56 +05:30
row0merge.h MDEV-26294 Duplicate entries in unique index not detected when changing collation 2022-07-04 16:13:04 +03:00
row0mysql.h MDEV-31558 Add InnoDB engine information to the slow query log 2023-07-07 12:53:18 +03:00
row0purge.h Simplify purge a little 2022-10-06 13:15:12 +03:00
row0quiesce.h
row0row.h MDEV-29603 btr_cur_open_at_index_side() is missing some consistency checks 2022-11-17 08:19:01 +02:00
row0row.inl Merge branch '10.3' into 10.4 2022-01-30 09:46:52 +01:00
row0sel.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
row0types.h Merge 10.4 into 10.5 2020-03-30 19:07:25 +03:00
row0uins.h
row0umod.h
row0undo.h
row0upd.h Merge 10.5 into 10.6 2023-01-03 18:13:11 +02:00
row0upd.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
row0vers.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
rw_lock.h MDEV-26781 InnoDB hangs when using SUX_LOCK_GENERIC 2022-04-06 12:51:27 +03:00
small_vector.h MDEV-30400 Assertion height == btr_page_get_level(...) on INSERT 2023-01-24 14:09:21 +02:00
srv0mon.h Merge branch '10.5' into 10.6 2022-05-18 10:30:47 +02:00
srv0mon.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
srv0srv.h MDEV-29311 Server Status Innodb_row_lock_time% is reported in seconds 2023-07-10 12:42:46 +03:00
srv0start.h Merge 10.5 into 10.6 2022-09-26 14:34:43 +03:00
srw_lock.h MDEV-26781 InnoDB hangs when using SUX_LOCK_GENERIC 2022-04-06 12:51:27 +03:00
sux_lock.h Cleanup: Remove os0thread 2022-04-19 13:49:52 +03:00
transactional_lock_guard.h MDEV-27956 hardware lock ellision on s390x/ppc64{,le} 2022-03-11 10:42:27 +11:00
trx0i_s.h Merge 10.2 into 10.3 2021-07-27 10:47:17 +03:00
trx0purge.h Merge 10.5 into 10.6 2023-06-08 10:42:56 +03:00
trx0rec.h MDEV-24402: InnoDB CHECK TABLE ... EXTENDED 2022-10-21 10:02:54 +03:00
trx0roll.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
trx0rseg.h MDEV-30863 Server freeze, all threads in trx_assign_rseg_low() 2023-04-18 14:54:40 +03:00
trx0sys.h Merge 10.5 into 10.6 2023-05-19 12:24:58 +03:00
trx0trx.h MDEV-30357 Performance regression in locking reads from secondary indexes 2023-03-16 16:00:45 +02:00
trx0trx.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
trx0types.h MDEV-25062: Reduce trx_rseg_t::mutex contention 2021-06-23 13:42:11 +03:00
trx0undo.h MDEV-31346 trx_purge_add_undo_to_history() is not optimal 2023-05-26 16:39:46 +03:00
trx0undo.inl MDEV-13542: Crashing on corrupted page is unhelpful 2022-06-06 14:03:22 +03:00
trx0xa.h
univ.i MDEV-21452 fixup: Remove PFS_NOT_INSTRUMENTED 2022-11-24 15:04:25 +02:00
ut0byte.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0byte.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0counter.h Cleanup: Remove os0thread 2022-04-19 13:49:52 +03:00
ut0crc32.h MDEV-19935 Create unified CRC-32 interface 2020-09-17 16:07:37 +02:00
ut0dbg.h
ut0list.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0list.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0lst.h Do not use C++11 before MariaDB 10.4 2022-10-14 11:54:05 +03:00
ut0mem.h Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0mem.inl Merge branch '10.4' into 10.5 2022-02-01 20:33:04 +01:00
ut0new.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
ut0pool.h MDEV-28836: Memory alignment cleanup 2022-06-21 16:59:49 +03:00
ut0rbt.h
ut0rnd.h Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
ut0rnd.inl Merge branch '10.5' into 10.6 2022-02-03 17:01:31 +01:00
ut0sort.h
ut0stage.h MDEV-21907: Fix most clang -Wconversion in InnoDB 2020-03-11 08:29:48 +02:00
ut0ut.h Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
ut0ut.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0vec.h MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0vec.inl MDEV-27494 Rename .ic files to .inl 2022-01-17 16:41:51 +01:00
ut0wqueue.h Merge 10.5 into 10.6 2021-10-21 16:06:34 +03:00