Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34212

InnoDB transaction recovery is incorrect




      Starting with MDEV-32042, we assume that the function buf_page_get_gen() is not being invoked while log is being applied during crash recovery. The idea is that any access to buffer pool pages during crash recovery must look up pages via recv_sys_t::recover(). This was being violated by the function trx_undo_mem_create_at_db_start() during startup.

      As far as I can tell, there are two possible outcomes of this:

      • (the lucky case): InnoDB refuses to start up and reports Data structure corruption.
        This causes occasional failures of the test innodb.table_flags and some other tests, including some mariabackup tests.
      • (the scary case): InnoDB recovers incorrect state of some transactions, and may cause permanent corruption.
        I have not reproduced this; this is my hypothesis.

      The fix is twofold:

      1. Add an assertion to buf_page_get_gen() to catch incorrect calls, and implement a special case for recv_sys.recover()
      2. Make recv_sys.recover() only buffer-fix pages, instead of acquiring shared latches. This is needed because there will be some recursive access to undo pages, and the shared latches are not recursive. A buffer-fix is sufficient, because at the early phase of startup there are no page modifications, other than by the application of the write-ahead log (ib_logfile0).


        Issue Links



              marko Marko Mäkelä
              marko Marko Mäkelä
              0 Vote for this issue
              5 Start watching this issue



                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.