Bug #114354 incorrect buffer pool instance in linear read-ahead
Submitted: 14 Mar 2024 14:00 Modified: 14 Mar 2024 14:11
Reporter: huahua xu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[14 Mar 2024 14:00] huahua xu
Description:
The innodb maybe use a incorrect buffer pool instance to detect out of order accessed pages, during applying linear read-ahead. I think that it may be a bug.

How to repeat:
see the detail of code in `buf_read_ahead_linear` (storage/innobase/buf/buf0rea.cc).

Suggested fix:
@@ -416,10 +416,13 @@ ulint buf_read_ahead_linear(const page_id_t &page_id,
   fail_count = 0;

   rw_lock_t *hash_lock;
+  buf_pool_t *cur_buf_pool;

   for (i = low; i < high; i++) {
-    bpage = buf_page_hash_get_s_locked(buf_pool, page_id_t(page_id.space(), i),
-                                       &hash_lock);
+    const page_id_t cur_page_id(page_id.space(), i);
+
+    cur_buf_pool = buf_pool_get(cur_page_id);
+    bpage = buf_page_hash_get_s_locked(cur_buf_pool, cur_page_id, &hash_lock);

     if (bpage == nullptr || buf_page_is_accessed(bpage) ==
                                 std::chrono::steady_clock::time_point{}) {
[14 Mar 2024 14:11] MySQL Verification Team
Hi Mr. xu,

Thank you for your bug report.

Initial analysis shows that you might be correct in your analysis.

Hence, we shall verify your report and it will be, thereafter, analysed in greater detail.

Thank you for your contribution.