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

MyISAM: race in update_state_info() leaves stale row counts on disk

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      --source include/have_debug.inc
      --source include/have_debug_sync.inc
      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, a INT, KEY(a)) ENGINE=MyISAM;
      INSERT INTO t1 (a) VALUES (1),(2);
      DELETE FROM t1 WHERE pk > 0;
      --connect (con1,localhost,root,,)
      SET debug_dbug='+d,simulate_incorrect_share_wlock_value';
      SET DEBUG_SYNC='after_share_wlock_set_to_0 SIGNAL zeroed WAIT_FOR go';
      --send INSERT INTO t1 (a) SELECT 3
      --connect (con2,localhost,root,,)
      SET debug_dbug='+d,simulate_incorrect_share_wlock_value';
      SET DEBUG_SYNC='now WAIT_FOR zeroed';
      SET DEBUG_SYNC='after_share_wlock_increment SIGNAL incremented';
      --send DELETE FROM t1 WHERE pk > 0
      --connection default
      --disable_warnings
      SET DEBUG_SYNC='now WAIT_FOR incremented TIMEOUT 5';
      --enable_warnings
      SET DEBUG_SYNC='now SIGNAL go';
      --connection con1
      --reap
      --disconnect con1
      --connection con2
      --reap
      --disconnect con2
      --connection default
      FLUSH TABLES;
      let $msg= query_get_value(CHECK TABLE t1 EXTENDED, Msg_text, 1);
      if ($msg != OK)
      {
        --echo # CHECK TABLE t1 EXTENDED: $msg
        --die The MyISAM state header on disk missed the last DELETE, so the delete chain is longer than the deleted-row count
      }
      DROP TABLE t1;
      SET DEBUG_SYNC='RESET';
      

      Leads to:

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed             
      CS  10.11  dbg  261026  6a063120d4d3d451bff3ea84b3ffbee288b33be8  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1132
      CS  10.11  opt  261026  6a063120d4d3d451bff3ea84b3ffbee288b33be8  No bug found                  
      CS  11.4   dbg  261026  b6406d42c8e26be3d86a4a743180f6b415a4559b  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1141
      CS  11.4   opt  261026  b6406d42c8e26be3d86a4a743180f6b415a4559b  No bug found                  
      CS  11.8   dbg  261026  274dd0d8d90bc773090d13303b8d5e36d2390241  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1097
      CS  11.8   opt  261026  274dd0d8d90bc773090d13303b8d5e36d2390241  No bug found                  
      CS  12.3   dbg  261026  788a07c52132d9f42b6991e599510c62d1625c0f  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1097
      CS  12.3   opt  261026  788a07c52132d9f42b6991e599510c62d1625c0f  No bug found                  
      CS  13.0   dbg  261026  620a4b5624222048fece7fe1789978ae0675cae2  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1097
      CS  13.0   opt  261026  620a4b5624222048fece7fe1789978ae0675cae2  No bug found                  
      CS  13.2   dbg  261026  c894d97781b54fbf074677c9d67f81cd60a162ac  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1097
      CS  13.2   opt  261026  c894d97781b54fbf074677c9d67f81cd60a162ac  No bug found                  
      ES  10.6   dbg  261026  45fbb1583d8cdcc7da5a123a844b3bf512f31c9d  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1131
      ES  10.6   opt  261026  45fbb1583d8cdcc7da5a123a844b3bf512f31c9d  No bug found                  
      ES  11.4   dbg  261026  6b2ae48e6e2488060adfdd02a7114bb60d4d150c  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1096
      ES  11.4   opt  261026  6b2ae48e6e2488060adfdd02a7114bb60d4d150c  No bug found                  
      ES  11.8   dbg  261026  6e6ba60bdc2b3f478513c5afa3faa062d8e73736  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1097
      ES  11.8   opt  261026  6e6ba60bdc2b3f478513c5afa3faa062d8e73736  No bug found                  
      ES  12.3   dbg  261026  781803ca9943d806ecb4b3b3fb39264dfafe1cf0  GOT_ERROR|Got an error from thread_id=4, /test/X/storage/myisam/ha_myisam.cc:1097
      ES  12.3   opt  261026  781803ca9943d806ecb4b3b3fb39264dfafe1cf0  No bug found                  
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            saahil Saahil Alam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1h
                1h

                Git Integration

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