Bug #115244 apply an redo on page in file mysql.ibd caused crashes
Submitted: 6 Jun 2024 10:37 Modified: 6 Jun 2024 11:00
Reporter: gang liu Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S1 (Critical)
Version:8.0.32 OS:Any
Assigned to: CPU Architecture:Any
Tags: clone plugin, page-tracking

[6 Jun 2024 10:37] gang liu
Description:
after 'clone instance...' success, recover the mysql instance using the clone data will cause crashes because it cannot apply redo on one page in file mysql.ibd. 

How to repeat:
1. add receipt_currency.test in directory `mysql-test/suite/clone/t/`;

2. run `./mtr  clone.monitor_progress clone.receipt_courrency  clone.remote_compress clone.remote_ddl_alter_copy --record` with debug version.

From error log:

2024-06-06T07:07:29.612201Z 1 [Note] [MY-012533] [InnoDB] 60%
2024-06-06T07:07:29.672459Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: page0page.ic:533:page_offset(rec) <= page_header_get_field(page, PAGE_HEAP_TOP) thread 140266961839872
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2024-06-06T07:07:29Z UTC - mysqld got signal 6 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=94e2e89670d7fbd1f9f9ed9567fcddb329b4f729
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x100000
2024-06-06T07:07:29.673586Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: page0page.ic:533:page_offset(rec) <= page_header_get_field(page, PAGE_HEAP_TOP) thread 140266951350016
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2024-06-06T07:07:29.675369Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: page0cur.cc:1330:rec_get_status(current_rec) <= REC_STATUS_INFIMUM thread 140266940860160
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2024-06-06T07:07:29.678292Z 0 [ERROR] [MY-013183] [InnoDB] Assertion failure: page0cur.cc:1323:current_rec != insert_rec thread 140266652563200
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2024-06-06T07:07:29.682672Z 1 [Note] [MY-012533] [InnoDB] 70%
mysqld(my_print_stacktrace(unsigned char const*, unsigned long)+0x59) [0x55d894a90d52]
mysqld(print_fatal_signal(int)+0x38e) [0x55d8934d2c43]
mysqld(my_server_abort()+0x78) [0x55d8934d2ef9]
mysqld(my_abort()+0x11) [0x55d894a86c33]
mysqld(ut_dbg_assertion_failed(char const*, char const*, unsigned long)+0x1e7) [0x55d894f9891a]
mysqld(+0x531bbbb) [0x55d894ddabbb]
mysqld(+0x531b788) [0x55d894dda788]
mysqld(page_cur_delete_rec(page_cur_t*, dict_index_t const*, unsigned long const*, mtr_t*)+0x1ad) [0x55d894de29cd]
mysqld(page_cur_parse_delete_rec(unsigned char*, unsigned char*, buf_block_t*, dict_index_t*, mtr_t*)+0x233) [0x55d894de27e0]
mysqld(+0x52bdd61) [0x55d894d7cd61]
mysqld(recv_recover_page_func(bool, buf_block_t*)+0x8a7) [0x55d894d7e486]
mysqld(+0x5581f63) [0x55d895040f63]
mysqld(buf_page_io_complete(buf_page_t*, bool)+0x814) [0x55d8950536d9]
mysqld(fil_aio_wait(unsigned long)+0x23d) [0x55d8951eadbc]

Suggested fix:
if apply the diff:
```
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index cc510f3c461..f9ffd5abea2 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1353,7 +1353,7 @@ bool buf_flush_page(buf_pool_t *buf_pool, buf_page_t *bpage,
       lsn_t frame_lsn = mach_read_from_8(frame + FIL_PAGE_LSN);
 
       arch_page_sys->track_page(bpage, buf_pool->track_page_lsn, frame_lsn,
-                                false);
+                                true);
     }

```
 `./mtr  clone.monitor_progress clone.receipt_courrency  clone.remote_compress clone.remote_ddl_alter_copy --record` will be sucess.

the diff will make page-tracking system track the same pageID many times.
[6 Jun 2024 10:48] MySQL Verification Team
Hi Mr. liu,

Thank you for your bug report.

Please, let us inform you that this is a forum for the bug reports in MySQL database, make by Oracle incorporated.

Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

This bug is a duplicate of your previous bug:

https://bugs.mysql.com/bug.php?id=115240

Also, we do not have receipt_currency.test in any of our distributions, so please let us know from which MySQL distribution should we add it.

If it is a test of your own make, you can add this test to the original bug report.

Thanks in advance.

Thank you for your interest in MySQL.
[6 Jun 2024 11:00] gang liu
I am sorry,in bug:https://bugs.mysql.com/bug.php?id=115240 ,I provide error informaiton. 

`receipt_currency.test` is that I add test script. however, it should not cause core.
[6 Jun 2024 11:20] MySQL Verification Team
Hi Mr. liu,

We did nto get any core ........

The test was not even started, since MySQL does not have a test of that name.