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

InnoDB after ALTER TABLE…IMPORT TABLESPACE may not be crash safe




      Today, I got a local test failure that looks much like this old failure:

      10.6 cce994057bf7e2bdb62686075de03aeb

      CURRENT_TEST: innodb.import_corrupted
      mysqltest: At line 63: query 'ALTER TABLE t2 IMPORT TABLESPACE' failed with wrong errno <Unknown> (2013): 'Lost connection to server during query', instead of ER_NOT_KEYFILE (1034)...
      2022-02-09 21:18:29 79 [ERROR] InnoDB: Trying to read 16384 bytes at 376832 outside the bounds of the file: ./test/t2.ibd
      mariadbd: /home/buildbot/buildbot/build/mariadb-10.6.7/storage/innobase/buf/buf0flu.cc:2507: void buf_flush_validate_low(): Assertion `om == 1 || !bpage || __builtin_expect(recv_sys.recovery_on, (0)) || om >= bpage->oldest_modification()' failed.

      In the core dump of my local failure, the IMPORT thread was waiting in mtr_t::commit():

            if (UNIV_UNLIKELY(m_made_dirty)) /* This should be IMPORT TABLESPACE */

      The flush list validation was executing as part of a mtr_t::commit() in trx_purge_truncate_rseg_history(). That mini-transaction was only holding page latches on tablespace 0x44 (the tablespace that is being imported).

      The bpage in the assertion expression was page 344 in the system tablespace. The bpage->list.prev was page 13 in the tablespace that is being imported. Neither page was buffer-fixed or latched, and apparently no asynchronous page reads or writes were in progress:

      (gdb) p write_slots.m_cache.m_pos
      $4 = 0
      (gdb) p read_slots.m_cache.m_pos
      $5 = 0

      Notably, the status of the previous page (13 in tablespace 0x44 in my case) is buf_page_t::FREED. While searching for failures in the cross-reference, I found several hangs during a test, and also the following assertion failure that could share a root cause with this one:

      bb-10.8-merge ed204a5cf9ec524e00f9ae9680d68911599c8ae5

      2022-11-17 18:10:01 7 [Note] InnoDB: Phase II - Purge records from index `PRIMARY`
      Assertion failed: s > buf_page_t::FREED, file D:\Buildbot\amd64-windows\build\storage\innobase\mtr\mtr0mtr.cc, line 230


        Issue Links



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



                Git Integration

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