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

Assertion `0' or Assertion `btr_validate_index(index, 0)' failed in row_upd_sec_index_entry or error code 126: Index is corrupted upon UPDATE with TIMESTAMP..ON UPDATE

    XMLWordPrintable

Details

    Description

      The server crashes with a stack trace similar to MDEV-18153. However, here the problem is not related to a change in sql_mode. Possibly, virtual columns containing references to non-virtual TIMESTAMP..ON UPDATE columns, do not catch changes imposed by the ON UPDATE clause.

      SET SQL_MODE= DEFAULT;
      CREATE OR REPLACE TABLE t1 ( 
        t TIMESTAMP(4),
        d DATETIME,
        v TIMESTAMP(4) AS (t) VIRTUAL,
        KEY(v,d)
      );
      INSERT IGNORE INTO t1 (t,d) VALUES ('2006-03-01 23:59:59.9999','2029-10-10 21:27:53');
      UPDATE IGNORE t1 SET d = '2019-08-22 05:42:30.9999';
      UPDATE IGNORE t1 SET d = '2006-04-01 23:59:59.9999';
      

      #3  0x00007ffff76eba26 in __assert_fail () from /lib64/libc.so.6
      #4  0x0000000000eff83a in row_upd_sec_index_entry (node=0x7fff60077c48, 
          thr=0x7fff6007b428)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:2429
      #5  0x0000000000effeac in row_upd_sec_step (node=0x7fff60077c48, 
          thr=0x7fff6007b428)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:2543
      #6  0x0000000000f025c4 in row_upd (node=0x7fff60077c48, thr=0x7fff6007b428)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:3319
      #7  0x0000000000f0292b in row_upd_step (thr=0x7fff6007b428)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0upd.cc:3434
      #8  0x0000000000eb63da in row_update_for_mysql (prebuilt=0x7fff60077118)
          at /home/bar/maria-git/server.10.4/storage/innobase/row/row0mysql.cc:1885
      #9  0x0000000000d60769 in ha_innobase::update_row (this=0x7fff6006f6b8, 
          old_row=0x7fff60073028 "\371]]\363T\"V\231\243\354Z\236]]\363T\"V\245\245\245\245\245\245`0\a`\377\177", 
          new_row=0x7fff60073010 "\371]]\363T\"\227\231x\203~\373]]\363T\"V\245\245\245\245\245\245\371]]\363T\"V\231\243\354Z\236]]\363T\"V\245\245\245\245\245\245`0\a`\377\177")
          at /home/bar/maria-git/server.10.4/storage/innobase/handler/ha_innodb.cc:8849
      #10 0x0000000000b4bad6 in handler::ha_update_row (this=0x7fff6006f6b8, 
          old_data=0x7fff60073028 "\371]]\363T\"V\231\243\354Z\236]]\363T\"V\245\245\245\245\245\245`0\a`\377\177", 
          new_data=0x7fff60073010 "\371]]\363T\"\227\231x\203~\373]]\363T\"V\245\245\245\245\245\245\371]]\363T\"V\231\243\354Z\236]]\363T\"V\245\245\245\245\245\245`0\a`\377\177") at /home/bar/maria-git/server.10.4/sql/handler.cc:6727
      #11 0x000000000091baab in mysql_update (thd=0x7fff60000d60, 
          table_list=0x7fff60014280, fields=..., values=..., conds=0x0, order_num=0, 
          order=0x0, limit=18446744073709551615, ignore=true, 
          found_return=0x7ffff41d6218, updated_return=0x7ffff41d6210)
          at /home/bar/maria-git/server.10.4/sql/sql_update.cc:1045
      

      If I add the DEFAULT clause into the column t, the problem goes away:

      SET SQL_MODE= DEFAULT;
      CREATE OR REPLACE TABLE t1 ( 
        t TIMESTAMP(4) DEFAULT '2001-01-01 10:20:30',
        d DATETIME,
        v TIMESTAMP(4) AS (t) VIRTUAL,
        KEY(v,d)
      );
      INSERT IGNORE INTO t1 (t,d) VALUES ('2006-03-01 23:59:59.9999','2029-10-10 21:27:53');
      UPDATE IGNORE t1 SET d = '2019-08-22 05:42:30.9999';
      UPDATE IGNORE t1 SET d = '2006-04-01 23:59:59.9999';
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.