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

Assertion `!page_rec_is_supremum(rec)' failed in btr_pcur_store_position or non-debug assertion failure in rem/rem0rec.cc upon HANDLER READ

Details

    Description

      10.4 test, does not fail on 10.3

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, c INT) ENGINE=InnoDB;
      INSERT INTO t1 VALUES (1,2);
      ALTER TABLE t1 ADD COLUMN f VARCHAR(255);
      ALTER TABLE t1 DROP COLUMN f;
      DELETE FROM t1;
      HANDLER t1 OPEN;
      HANDLER t1 READ `PRIMARY` <= (3);
       
      # Cleanup
      DROP TABLE t1;
      

      Much uglier test, fails on both 10.3 and 10.4

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (
        pk INT AUTO_INCREMENT,
        f1 CHAR(32),
        f2 CHAR(32),
        f3 CHAR(32),
        f4 INT,
        f5 CHAR(32),
        f6 INT,
        f7 INT,
        f8 INT,
        PRIMARY KEY (pk),
        UNIQUE (f6)
      ) ENGINE=InnoDB;
       
      INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES 
        ('reality', 'llt', 'within', -1996816384, 'j', 160, 7, -1822687232),
        ('h', 'j', 'j', 251, 'civilian', NULL, 211, NULL),
        ('ltq', 'b', 'mud', 111, 'v', 90, 0, NULL),
        ('toxic', 'breakfast', 'series', 2, 'x', NULL, 118, 2),
        ('h', 'n', 'vision', 84, 'n', NULL, 197, 103),
        ('h', 'tq', 'q', 6, 'bet', -1927151616, -446038016, 3),
        ('pocket', 'qjt', 'jtl', 0, 'blink', NULL, 12, 0),
        ('k', 'uv', 'exist', 37, 'g', 149, -1610219520, NULL),
        ('parent', 'motion', 'u', 70, 'promote', NULL, 178, NULL),
        ('get', 'convict', 'liquid', -780337152, 'd', NULL, 4, NULL),
        ('vp', 'px', 'xi', -631111680, 'support', NULL, 8, NULL),
        ('ck', 'z', 'minority', 8, 'k', NULL, 864878592, NULL),
        ('kxx', 'g', 'container', 1, 'cholesterol', NULL, 4, 1404436480),
        ('xxv', 'rail', 'j', 219, 'serious', NULL, -816119808, 62),
        ('x', 'v', 'vr', 146, 'm', 16, 170, -1765867520),
        ('age', 'm', 'q', -1251278848, 'rte', 6, 224, NULL),
        ('discrimination', 't', 'q', 31, 'exl', 0, 2, 244),
        ('water', 'x', 'ldb', 98, 'r', 235, 4, 63),
        ('d', 'db', 'p', 248, 'so-called', 102, -255524864, 198),
        ('last', 'bz', 'us', 0, 'experienced', 137, 240, 134),
        ('q', 'z', 'attract', 67, 'code', 67, 75, 1758920704),
        ('yellow', 'c', 'u', 6, 'v', 1731985408, 528154624, 2),
        ('cognitive', 'he', 'protective', 590020608, 'sentence', NULL, 4, 102),
        ('eih', 'l', 'ih', 1266024448, 'traditionally', NULL, 190, NULL),
        ('pine', 'i', 'y', 6, 'glimpse', 214, 7, -1486880768),
        ('jo', 'everyone', 'ol', 0, 'lj', NULL, 1, 0),
        ('blood', 'f', 'scientist', 54, 'j', 1341128704, 168, NULL),
        ('z', 'brief', 'ambassador', 115, 'ygp', 82, 129, NULL),
        ('gp', 'severe', 'consist', 7, 'p', -1829961728, 602669056, 154),
        ('admit', 'poetry', 'x', 116, 'enemy', 174, -2128543744, -407764992),
        ('s', 'norm', 'decide', 2055667712, 'rtz', NULL, 99, -1233715200),
        ('tzg', 'f', 'beg', 2016280576, 'w', NULL, -643825664, 137),
        ('zgg', 'x', 'f', 148, 'y', -987496448, -708116480, 8),
        ('attorney', 'perfectly', 's', 49, 'z', -1865285632, 56, -1518534656),
        ('concentrate', 's', 'k', -1028849664, 'tir', 83, -1592459264, 1820065792),
        ('t', 'sacrifice', 'ir', -2143879168, 'recipe', 156, 217, NULL),
        ('wdf', 'd', 'f', 137, 'empty', NULL, 188, NULL),
        ('o', 'customer', 'qd', -2135293952, 'z', 1527840768, 227, -1174929408),
        ('d', 'qow', 'o', 1472266240, 'whe', NULL, 7, 197),
        ('deny', 'reputation', 'dutch', 59, 'v', 124, 2, 191),
        ('m', 'liver', 'fv', 0, 'policy', 781582336, 198574080, 177),
        ('vk', 'kx', 'immigrant', -1452736512, 'x', 163, 76, 6) ,
        ('j', 'ru', 'r', 67, 'joke', NULL, 3, NULL),
        ('o', 'u', 'a', -569442304, 'uz', NULL, 933298176, NULL),
        ('g', 'zb', 'c', -1694760960, 'fish', 18, -390463488, 1),
        ('bb', 'o', 'b', 6, 'z', 9, 12, NULL),
        ('compelling', 'xe', 'debut', 89, 'e', -734724096, 119, 175),
        ('md', 'r', 'object', 1046478848, 'frequently', 915537920, 0, 1506410496),
        ('dwn', 'wnz', 'x', 1767571456, 'nz', 241, -882180096, 9),
        ('zvf', 'vfo', 'g', -844824576, 'w', NULL, 1, 9),
        ('w', 'pose', 'r', 1029308416, 'a', -48627712, 1756168192, NULL),
        ('o', 'jwp', 'patient', 172, 'i', 297140224, 45809664, 3),
        ('w', 'p', 'american', 450297856, 'z', 20, 4, 186),
        ('ridiculous', 'helpful', 'vy', -2022899712, 'conspiracy', NULL, 162, -264634368),
        ('t', 'g', 'spite', 289931264, 'y', 4, 13, NULL),
        ('performer', 'i', 'tomato', -1519386624, 'mz', 8, 87, 106),
        ('m', 'z', 'hang', 3, 'crowded', -537919488, 1, 2),
        ('fu', 'uot', 'j', 1, 'o', 179, 220, -2084569088),
        ('ts', 'n', 'su', 1, 'o', 198, 9, 68),
        ('ball', 'halfway', 'uf', 40, 'l', 145948672, 9, 149),
        ('hunting', 'n', 'teenager', 0, 'neat', 209, 2044461056, 68),
        ('independent', 'along', 'fpn', 5, 'pn', 3, 1353252864, 217),
        ('p', 'presumably', 'n', -1977548800, 'balanced', 1909260288, 197, NULL),
        ('pink', 'h', 'tear', 8, 'n', 254, 8, 1006305280),
        ('tyy', 'n', 'yyr', 1107820544, 'yr', NULL, 0, 219),
        ('u', 'retirement', 'thread', -2083192832, 'rx', -678232064, 209, 1048969216),
        ('xk', 'kb', 'z', 9, 'ba', 218, 7, 8),
        ('a', 'plenty', 'forget', 36, 'c', 215, 2027094016, NULL),
        ('i', 'compromise', 'n', -1090256896, 'o', 10, 66, 1872887808),
        ('x', 'disappointment', 'cognitive', 753860608, 'ua', 77, 123, 10),
        ('e', 'added', 'aub', 2, 'u', NULL, 9, 92),
        ('bc', 'h', 'n', 146, 'master', NULL, 1003945984, NULL),
        ('execution', 'f', 'cgp', 574423040, 'gp', 2, -518782976, -1189085184),
        ('pv', 'bad', 'v', 132, 'r', 195, 6, 5),
        ('modify', 'participation', 'vol', 237, 'j', -842924032, 88, -747765760),
        ('substantially', 'i', 'congressional', 2, 'edit', NULL, 1003159552, NULL),
        ('tell', 'forty', 'v', -910098432, 'd', 43, 3, NULL),
        ('crawl', 'ad', 'respect', -1851195392, 'p', 72, -1709047808, 1343225856),
        ('w', 'reception', 'fiber', 56, 's', NULL, 2, -993787904),
        ('successful', 'instruct', 'dug', 2, 'u', 7, -411500544, NULL),
        ('appointment', 'pregnant', 'weird', 2, 'r', NULL, -897384448, 76),
        ('g', 'j', 'thin', 663617536, 'oan', 1, 7, NULL),
        ('secretary', 'a', 'o', 103, 'nj', 1977745408, -1291124736, -1314521088),
        ('g', 'jq', 'q', 1875116032, 'blame', NULL, 1, 4),
        ('oj', 'j', 'breast', 150, 'c', NULL, 3, NULL),
        ('rd', 'm', 'comprehensive', 1723334656, 't', NULL, 155, -312344576) ,
        ('a', 'd', 'criminal', -1155137536, 'airplane', 242, -662896640, 1),
        ('fast', 'i', 'k', -386662400, 'zxe', NULL, 7, 119),
        ('xe', 'mouse', 'c', -205717504, 'ew', NULL, -729612288, 86),
        ('hang', 'j', 'o', 3, 'hungry', NULL, 200, 49),
        ('expense', 'z', 'sum', 2, 'gob', -472055808, -538181632, NULL),
        ('nest', 'o', 'k', 116, 'weak', NULL, 223, NULL);
      --error ER_DUP_ENTRY
      INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3);
       
      ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT '';
      SELECT * FROM t1 INTO OUTFILE 'load.data';
      UPDATE IGNORE t1 SET pk = 0;
      LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1;
      HANDLER t1 OPEN AS h;
      HANDLER h READ `PRIMARY` PREV WHERE 0;
       
      # Cleanup
      HANDLER h CLOSE;
      DROP TABLE t1;
      --let $datadir= `select @@datadir`
      --remove_file $datadir/test/load.data
      

      10.3 debug ac31ff627

      mysqld: /data/src/10.3/storage/innobase/btr/btr0pcur.cc:162: void btr_pcur_store_position(btr_pcur_t*, mtr_t*): Assertion `!page_rec_is_supremum(rec)' failed.
      181213  1:37:05 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc7db2c1ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055626ab1d063 in btr_pcur_store_position (cursor=0x7fc780071d60, mtr=0x7fc7d4605a00) at /data/src/10.3/storage/innobase/btr/btr0pcur.cc:162
      #9  0x000055626aa46998 in row_search_mvcc (buf=0x7fc7800a5240 "", mode=PAGE_CUR_L, prebuilt=0x7fc780071b98, match_mode=0, direction=2) at /data/src/10.3/storage/innobase/row/row0sel.cc:5595
      #10 0x000055626a8b2f59 in ha_innobase::general_fetch (this=0x7fc78006db98, buf=0x7fc7800a5240 "", direction=2, match_mode=0) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9534
      #11 0x000055626a8b323c in ha_innobase::index_prev (this=0x7fc78006db98, buf=0x7fc7800a5240 "") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9627
      #12 0x000055626a5918b7 in handler::ha_index_prev (this=0x7fc78006db98, buf=0x7fc7800a5240 "") at /data/src/10.3/sql/handler.cc:2894
      #13 0x000055626a25069d in mysql_ha_read (thd=0x7fc780000b00, tables=0x7fc780014e60, mode=RPREV, keyname=0x7fc7800154b0 "PRIMARY", key_expr=0x7fc780015dc8, ha_rkey_mode=HA_READ_KEY_EXACT, cond=0x7fc7800154d0, select_limit_cnt=1, offset_limit_cnt=0) at /data/src/10.3/sql/sql_handler.cc:925
      #14 0x000055626a299f30 in mysql_execute_command (thd=0x7fc780000b00) at /data/src/10.3/sql/sql_parse.cc:5756
      #15 0x000055626a2a0d8f in mysql_parse (thd=0x7fc780000b00, rawbuf=0x7fc780014cd8 "HANDLER h READ `PRIMARY` PREV WHERE 0", length=37, parser_state=0x7fc7d46075f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8091
      #16 0x000055626a28df43 in dispatch_command (command=COM_QUERY, thd=0x7fc780000b00, packet=0x7fc78000b1e1 "", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1850
      #17 0x000055626a28c967 in do_command (thd=0x7fc780000b00) at /data/src/10.3/sql/sql_parse.cc:1395
      #18 0x000055626a3f46a4 in do_handle_one_connection (connect=0x55626d0e6300) at /data/src/10.3/sql/sql_connect.cc:1402
      #19 0x000055626a3f4428 in handle_one_connection (arg=0x55626d0e6300) at /data/src/10.3/sql/sql_connect.cc:1308
      #20 0x000055626a88ea67 in pfs_spawn_thread (arg=0x55626d127ca0) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #21 0x00007fc7dcd7d494 in start_thread (arg=0x7fc7d4608700) at pthread_create.c:333
      #22 0x00007fc7db37e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.3 non-debug ac31ff627

      2018-12-13 01:38:00 0x7f6270176700  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/rem/rem0rec.cc line 1872
      InnoDB: We intentionally generate a memory trap.
       
      #4  0x00007f62765da3fa in abort () from /lib/x86_64-linux-gnu/libc.so.6
      #5  0x00005571215856fa in ut_dbg_assertion_failed (expr=expr@entry=0x0, file=file@entry=0x557121e95f20 "/data/src/10.3/storage/innobase/rem/rem0rec.cc", line=line@entry=1872) at /data/src/10.3/storage/innobase/ut/ut0dbg.cc:60
      #6  0x0000557121abf893 in rec_copy_prefix_to_buf (rec=0x7f626bcf0070 <error: Cannot access memory at address 0x7f626bcf0070>, index=0x7f62180701b0, n_fields=1, buf=0x7f6218071e20, buf_size=0x7f6218071e28) at /data/src/10.3/storage/innobase/rem/rem0rec.cc:1872
      #7  0x0000557121b8a7a5 in btr_pcur_store_position (cursor=cursor@entry=0x7f6218071d38, mtr=mtr@entry=0x7f621806e638) at /data/src/10.3/storage/innobase/btr/btr0pcur.cc:172
      #8  0x0000557121affa6e in row_search_mvcc (buf=buf@entry=0x7f621806e638 "", mode=PAGE_CUR_GE, mode@entry=PAGE_CUR_UNSUPP, prebuilt=<optimized out>, match_mode=match_mode@entry=0, direction=direction@entry=2) at /data/src/10.3/storage/innobase/row/row0sel.cc:5595
      #9  0x0000557121a34ffe in ha_innobase::general_fetch (this=0x7f62180667d0, buf=0x7f621806e638 "", direction=2, match_mode=0) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:9534
      #10 0x000055712182b113 in handler::ha_index_prev (this=0x7f62180667d0, buf=0x7f621806e638 "") at /data/src/10.3/sql/handler.cc:2894
      #11 0x0000557121625275 in mysql_ha_read (thd=0x7f62180009a8, tables=0x7f6218011808, mode=RFIRST, keyname=0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>, key_expr=0x0, ha_rkey_mode=1880564608, cond=0x7f6218011e78, select_limit_cnt=1, offset_limit_cnt=0) at /data/src/10.3/sql/sql_handler.cc:925
      #12 0x0000557121656915 in mysql_execute_command (thd=0x7f62180009a8) at /data/src/10.3/sql/sql_parse.cc:5756
      #13 0x000055712165ac29 in mysql_parse (thd=0x7f62180009a8, rawbuf=<optimized out>, length=37, parser_state=0x7f6270175630, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_parse.cc:8091
      #14 0x000055712165df7e in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f62180009a8, packet=packet@entry=0x7f6218009319 "", packet_length=packet_length@entry=37, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.3/sql/sql_parse.cc:1850
      #15 0x000055712165e620 in do_command (thd=0x7f62180009a8) at /data/src/10.3/sql/sql_parse.cc:1395
      #16 0x000055712172fe94 in do_handle_one_connection (connect=connect@entry=0x557123756078) at /data/src/10.3/sql/sql_connect.cc:1402
      #17 0x0000557121730034 in handle_one_connection (arg=arg@entry=0x557123756078) at /data/src/10.3/sql/sql_connect.cc:1308
      #18 0x0000557121a13714 in pfs_spawn_thread (arg=0x5571237c6df8) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #19 0x00007f627808d494 in start_thread (arg=0x7f6270176700) at pthread_create.c:333
      #20 0x00007f627668e93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Neither fails on 10.2.

      Attachments

        Issue Links

          Activity

            The 10.4 version of this is exposing a wrong assumption. Until MDEV-15562 it was not possible for the MDEV-11369 metadata record to be the only record in a table. If a table became empty after instant ADD COLUMN, it would be converted to the canocical format.

            In MDEV-15562, we can no longer convert empty tables to the canonical format, because there could exist other connections that have prepared cursors for accessing the table. The conversion would make these cursors invalid, because the mapping between index fields to table columns would change.

            The 10.3 version of this is triggering a bogus assertion. The page in question is the leftmost leaf page of the clustered index, and it only contains the hidden metadata record. But the page does have a right sibling that is not empty. We must relax the assertion.

            marko Marko Mäkelä added a comment - The 10.4 version of this is exposing a wrong assumption. Until MDEV-15562 it was not possible for the MDEV-11369 metadata record to be the only record in a table. If a table became empty after instant ADD COLUMN , it would be converted to the canocical format. In MDEV-15562 , we can no longer convert empty tables to the canonical format, because there could exist other connections that have prepared cursors for accessing the table. The conversion would make these cursors invalid, because the mapping between index fields to table columns would change. The 10.3 version of this is triggering a bogus assertion. The page in question is the leftmost leaf page of the clustered index, and it only contains the hidden metadata record. But the page does have a right sibling that is not empty. We must relax the assertion.

            People

              marko Marko Mäkelä
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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