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

Race condition between DROP TABLE and purge of SYS_INDEXES record




      The fix of MDEV-24589 introduced a regression that happened to observe once today. Attempts to reproduce it have failed:

      10.6 from yesterday or today with some changes

      CURRENT_TEST: stress.ddl_innodb
      mysqltest: In included file "./suite/stress/include/ddl7.inc": 
      included from /mariadb/10.6-merge/mysql-test/suite/stress/t/ddl_innodb.test at line 43:
      At line 272: query 'DROP TABLE t1' failed: 2013: Lost connection to server during query
      2021-04-22  9:32:55 0 [Note] InnoDB: trying to read page [page id: space=17886, page number=366] in nonexisting or being-dropped tablespace
      2021-04-22  9:32:55 0 [Note] InnoDB: trying to read page [page id: space=17886, page number=366] in nonexisting or being-dropped tablespace
      2021-04-22  9:32:55 0 [ERROR] [FATAL] InnoDB: Unable to read page [page id: space=17886, page number=366] into the buffer pool after 100. The most probable cause of this error may be that the table has been corrupted. See https://mariadb.com/kb/en/library/innodb-recovery-modes/
      #7  0x0000560d25c3dab5 in buf_page_get_gen (page_id=<optimized out>, page_id@entry={m_id = 76819785056622}, zip_size=<optimized out>, zip_size@entry=0, rw_latch=<optimized out>, rw_latch@entry=2, guess=<optimized out>, guess@entry=0x0, mode=<optimized out>, mode@entry=10, mtr=<optimized out>, mtr@entry=0x7fdd19ffa238, err=0x0, allow_ibuf_merge=<optimized out>) at /mariadb/10.6-merge/storage/innobase/buf/buf0buf.cc:3104
      #8  0x0000560d25bd2ec1 in btr_free_root_check (page_id=page_id@entry={m_id = 76819785056622}, zip_size=0, index_id=30915, mtr=0x7fdd19ffa238, mtr@entry=0x78c3) at /mariadb/10.6-merge/storage/innobase/btr/btr0btr.cc:963
      #9  btr_free_if_exists (page_id=page_id@entry={m_id = 76819785056622}, zip_size=0, index_id=30915, mtr=mtr@entry=0x7fdd19ffa238) at /mariadb/10.6-merge/storage/innobase/btr/btr0btr.cc:1240
      #10 0x0000560d25c6d5bd in dict_drop_index_tree (pcur=<optimized out>, pcur@entry=0x560d27652e68, trx=trx@entry=0x0, mtr=mtr@entry=0x7fdd19ffa238) at /mariadb/10.6-merge/storage/innobase/dict/dict0crea.cc:955
      #11 0x0000560d25b3b62b in row_purge_remove_clust_if_poss_low (node=node@entry=0x560d27652dc8, mode=mode@entry=2) at /mariadb/10.6-merge/storage/innobase/row/row0purge.cc:125
      #12 0x0000560d25b36204 in row_purge_remove_clust_if_poss (node=<optimized out>) at /mariadb/10.6-merge/storage/innobase/row/row0purge.cc:204

      During this time, DROP TABLE had set the STOPPING flag, which caused buf_page_get_gen(…, BUF_GET, …) to fail like that:

      #2  0x0000560d25cbfa9b in std::this_thread::sleep_for<long, std::ratio<1l, 1000l> > (__rtime=<optimized out>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:401
      #3  fil_check_pending_operations (id=<optimized out>, id@entry=17886, truncate=false, path=path@entry=0x7fddc84ac830) at /mariadb/10.6-merge/storage/innobase/fil/fil0fil.cc:1664
      #4  0x0000560d25cc0533 in fil_delete_tablespace (id=17886, if_exists=false, detached_handles=detached_handles@entry=0x7fddc84ace10) at /mariadb/10.6-merge/storage/innobase/fil/fil0fil.cc:1765
      #5  0x0000560d25b15cde in row_drop_table_for_mysql (name=<optimized out>, name@entry=0x7fddc84ad600 "test/t1", trx=trx@entry=0x7fddc87643d8, sqlcom=sqlcom@entry=SQLCOM_DROP_TABLE, create_failed=<optimized out>, nonatomic=<optimized out>) at /mariadb/10.6-merge/storage/innobase/row/row0mysql.cc:3674

      It is entirely possible that the tablespace will be marked inaccessible (the fil_space_t::STOPPING flag will be set) at the very moment when purge is processing a SYS_INDEXES for the same table.

      MDEV-24589 must remain in 10.6.0 because it blocks MDEV-25180, which is targeting 10.6.0.

      Fixing and validating the regression will require substantial development and testing effort. We will do it after the 10.6.0 release.


        Issue Links



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



                Git Integration

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