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

OPTIMIZE causes strange errors and further data corruption with myisam_repair_threads and too small sort buffer

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5, 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
    • 10.5
    • None

    Description

      -- source include/have_sequence.inc
       
      CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY, a TEXT, b TEXT, KEY(id,a(64),b(64))) ENGINE=MyISAM;
      INSERT INTO t1 (a) SELECT REPEAT('e',65173) FROM seq_1_to_50;
      UPDATE t1 SET a = 'x';
      SET SESSION myisam_repair_threads= 6, myisam_sort_buffer_size= 131072;
      OPTIMIZE TABLE t1;
      INSERT INTO t1 (a) VALUES (NULL);
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 dc716da4

      OPTIMIZE TABLE t1;
      Table	Op	Msg_type	Msg_text
      test.t1	optimize	error	myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: 65536  rows: 162961  sort_length: 144
      test.t1	optimize	error	Found key at page -1 that points to record outside datafile
      test.t1	optimize	status	Operation failed
      INSERT INTO t1 (a) VALUES (NULL);
      bug.corrupt1                             [ fail ]
              Test ended at 2020-08-04 15:35:47
       
      CURRENT_TEST: bug.corrupt1
      mysqltest: At line 8: query 'INSERT INTO t1 (a) VALUES (NULL)' failed: 144: Table './test/t1' is marked as crashed and last (automatic?) repair failed
      

      Everything in OPTIMIZE output is strange: current myisam_sort_buffer_size is wrong, the number of rows has nothing to do with the table, and page -1 is obviously a problem. The warning in the error log isn't good either:

      2020-08-04 15:35:46 140051098892032 [Warning] Warning: Optimize table got errno 0 on test.t1, retrying
      

      And further the table is marked as crashed.

      Reproducible on 10.1-10.5.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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