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

Assertion failure in lock_move_rec_list_start() after instant ADD COLUMN

    XMLWordPrintable

    Details

      Description

      This issue was first found during the development of MDEV-12894. As mentioned in MDEV-13900, a part of innodb.instant_alter test would crash when the test is run with special parameters. With these parameters, MDEV-12894 is adding a hidden column to the PRIMARY KEY and converting certain UPDATE to UPDATE and INSERT.
      The test below reproduces the problem in plain MariaDB 10.3 when system versioning is not used.

      --source include/have_innodb.inc
       
      CREATE TABLE t2
      (id INT, foo INT DEFAULT 0, c1 VARCHAR(4000),
       p GEOMETRY NOT NULL DEFAULT ST_GeomFromText('LINESTRING(0 0,0 1,1 1)'),
       PRIMARY KEY(id,foo))
      ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
       
      INSERT INTO t2 (id,c1) VALUES (1, REPEAT('a', 4000)), (2, REPEAT('a', 4000));
      ALTER TABLE t2 ADD COLUMN d1 INT;
       
      BEGIN;
      UPDATE t2 SET c1 = repeat('1', 4000), foo=1 WHERE id=1;
      INSERT INTO t2 (id,c1) VALUES (1, REPEAT('a', 4000));
      UPDATE t2 SET c1 = repeat('2', 4000), foo=1 WHERE id=2;
      ROLLBACK;
       
      BEGIN;
      UPDATE t2 SET d1 = 1,foo=2 WHERE id=1;
      INSERT INTO t2 (id,foo,c1) VALUES (1, 1, REPEAT('1', 4000));
      COMMIT;
       
      DROP TABLE t2;
      

      The last INSERT that crashes must for some reason be in the same transaction as the UPDATE. I have optimized away an INSERT from the first (rolled-back) transaction, because the crash reproduces also without it:

      stack trace

      lock/lock0lock.cc:3836(lock_move_rec_list_start(buf_block_t const*, buf_block_t const*, unsigned char const*, unsigned char const*))[0x1c98ce3]
      page/page0page.cc:940(page_copy_rec_list_start(buf_block_t*, buf_block_t*, unsigned char*, dict_index_t*, mtr_t*))[0x1d99991]
      page/page0page.cc:1402(page_move_rec_list_start(buf_block_t*, buf_block_t*, unsigned char*, dict_index_t*, mtr_t*))[0x1d9c9f5]
      btr/btr0btr.cc:3165(btr_page_split_and_insert(unsigned long, btr_cur_t*, unsigned long**, mem_block_info_t**, dtuple_t const*, unsigned long, mtr_t*))[0x21a523d]
      btr/btr0cur.cc:3463(btr_cur_pessimistic_insert(unsigned long, btr_cur_t*, unsigned long**, mem_block_info_t**, dtuple_t*, unsigned char**, big_rec_t**, unsigned long, que_thr_t*, mtr_t*))[0x21fec97]
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: