Skip to content

Commit

Permalink
PS-9462: The trx_sys->max_trx_id maintained during the startup phase …
Browse files Browse the repository at this point in the history
…of InnoDB may be incorrect.

1. Reading max_trx_id from page [0,5] may before page application. In this way, the read max_trx_id may be smaller than the true value.
2. This may cause the trx_id in the data record to be greater than trx_sys->max_trx_id. In the debug version, it will crash in ReadView::check_trx_id_sanity.
  • Loading branch information
xingying.1024 committed Oct 16, 2024
1 parent 813837b commit 385b144
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions storage/innobase/srv/srv0start.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2581,8 +2581,6 @@ innobase_start_or_create_for_mysql(void)
if (err != DB_SUCCESS)
return(srv_init_abort(err));

purge_queue = trx_sys_init_at_db_start();

if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
/* Apply the hashed log records to the
respective file pages, for the last batch of
Expand All @@ -2591,9 +2589,13 @@ innobase_start_or_create_for_mysql(void)
recv_apply_hashed_log_recs(TRUE);
DBUG_PRINT("ib_log", ("apply completed"));

purge_queue = trx_sys_init_at_db_start();

if (recv_needed_recovery) {
trx_sys_print_mysql_binlog_offset();
}
} else {
purge_queue = trx_sys_init_at_db_start();
}

if (recv_sys->found_corrupt_log) {
Expand Down

0 comments on commit 385b144

Please sign in to comment.