mariadb/storage
Marko Mäkelä 9593cccf28 MDEV-26055: Improve adaptive flushing
Adaptive flushing is enabled by setting innodb_max_dirty_pages_pct_lwm>0
(not default) and innodb_adaptive_flushing=ON (default).
There is also the parameter innodb_adaptive_flushing_lwm
(default: 10 per cent of the log capacity). It should enable some
adaptive flushing even when innodb_max_dirty_pages_pct_lwm=0.
That is not being changed here.

This idea was first presented by Inaam Rana several years ago,
and I discussed it with Jean-François Gagné at FOSDEM 2023.

buf_flush_page_cleaner(): When we are not near the log capacity limit
(neither buf_flush_async_lsn nor buf_flush_sync_lsn are set),
also try to move clean blocks from the buf_pool.LRU list to buf_pool.free
or initiate writes (but not the eviction) of dirty blocks, until
the remaining I/O capacity has been consumed.

buf_flush_LRU_list_batch(): Add the parameter bool evict, to specify
whether dirty least recently used pages (from buf_pool.LRU) should
be evicted immediately after they have been written out. Callers outside
buf_flush_page_cleaner() will pass evict=true, to retain the existing
behaviour.

buf_do_LRU_batch(): Add the parameter bool evict.
Return counts of evicted and flushed pages.

buf_flush_LRU(): Add the parameter bool evict.
Assume that the caller holds buf_pool.mutex and
will invoke buf_dblwr.flush_buffered_writes() afterwards.

buf_flush_list_holding_mutex(): A low-level variant of buf_flush_list()
whose caller must hold buf_pool.mutex and invoke
buf_dblwr.flush_buffered_writes() afterwards.

buf_flush_wait_batch_end_acquiring_mutex(): Remove. It is enough to have
buf_flush_wait_batch_end().

page_cleaner_flush_pages_recommendation(): Avoid some floating-point
arithmetics.

buf_flush_page(), buf_flush_check_neighbor(), buf_flush_check_neighbors(),
buf_flush_try_neighbors(): Rename the parameter "bool lru" to "bool evict".

buf_free_from_unzip_LRU_list_batch(): Remove the parameter.
Only actual page writes will contribute towards the limit.

buf_LRU_free_page(): Evict freed pages of temporary tables.

buf_pool.done_free: Broadcast whenever a block is freed
(and buf_pool.try_LRU_scan is set).

buf_pool_t::io_buf_t::reserve(): Retry indefinitely.
During the test encryption.innochecksum we easily run out of
these buffers for PAGE_COMPRESSED or ENCRYPTED pages.

Tested by Matthias Leich and Axel Schwenke
2023-03-16 17:09:08 +02:00
..
archive Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
blackhole Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
columnstore Merge branch '10.5' into 10.6 2023-01-31 09:31:42 +01:00
connect Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
csv Merge branch 'bb-10.4-release' into bb-10.5-release 2021-02-15 16:43:15 +01:00
example Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
federated Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
federatedx Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
heap Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
innobase MDEV-26055: Improve adaptive flushing 2023-03-16 17:09:08 +02:00
maria Merge 10.5 into 10.6 2023-02-28 16:05:21 +02:00
mroonga Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
myisam Merge 10.5 into 10.6 2023-02-28 16:05:21 +02:00
myisammrg Reduce usage of strlen() 2021-05-19 22:27:48 +02:00
oqgraph Merge 10.5 into 10.6 2022-01-18 12:59:50 +02:00
perfschema Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
rocksdb Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
sequence Merge 10.4 into 10.5 2023-02-10 12:02:11 +02:00
sphinx Merge branch '10.5' into 10.6 2022-11-02 14:33:20 +01:00
spider Merge 10.5 into 10.6 2023-02-10 13:03:01 +02:00
test_sql_discovery Merge 10.5 into 10.6 2022-09-20 16:53:20 +03:00