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

Assertion failed or btr_validate_index(..) in row_upd_sec_index_entry on a time_zone change

    XMLWordPrintable

Details

    • Bug
    • Status: In Progress (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2, 10.3, 10.4, 10.5, 10.6
    • 10.5, 10.6
    • Temporal Types
    • None

    Description

      This bug is reported to fix the crash in InnoDB.

      The root cause of the problem is however in the server, which allows to use in indexed virtual columns unsafe expressions depending on the session varianbles. For details see:

      The following scripts demonstrate the crash in InnoDB on @@time_zone change. However, a similar crash can also happen on @@div_precision_increment and @@max_allowed_packet. This needs to be checked.

      This script demonstrates the crash:

      SET time_zone='+00:00';
      CREATE OR REPLACE TABLE t1 (
        a DATETIME,
        v TIMESTAMP GENERATED ALWAYS AS (a),
        KEY(v)
      );
      INSERT INTO t1 (a) VALUES ('2001-01-01 10:20:30');
      SET time_zone='+10:00';
      UPDATE t1 SET a='2000-01-01 10:20:30';
      

      crashes with the following stack trace:

      #3  0x00007ffff76eba26 in __assert_fail () from /lib64/libc.so.6
      #4  0x0000000000f9eede in row_upd_sec_index_entry (node=0x7fff68070158, 
          thr=0x7fff68073798)
          at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:2425
      #5  0x0000000000f9f6c9 in row_upd_sec_step (node=0x7fff68070158, 
          thr=0x7fff68073798)
          at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:2539
      #6  0x0000000000fa256e in row_upd (node=0x7fff68070158, thr=0x7fff68073798)
          at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:3315
      #7  0x0000000000fa29d5 in row_upd_step (thr=0x7fff68073798)
          at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0upd.cc:3430
      #8  0x0000000000f4134b in row_update_for_mysql (prebuilt=0x7fff6806f678)
          at /home/bar/maria-git/server.10.4.frac2/storage/innobase/row/row0mysql.cc:1889
      #9  0x0000000000da6a72 in ha_innobase::update_row (this=0x7fff6806dd88, 
          old_row=0x7fff680698e0 "\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177", 
          new_row=0x7fff680698d0 "\371\231dB\245\036\070mHN\245\245\245\245\245\245\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177")
          at /home/bar/maria-git/server.10.4.frac2/storage/innobase/handler/ha_innodb.cc:8841
      #10 0x0000000000b7195f in handler::ha_update_row (this=0x7fff6806dd88, 
          old_data=0x7fff680698e0 "\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177", 
          new_data=0x7fff680698d0 "\371\231dB\245\036\070mHN\245\245\245\245\245\245\371\231g\202\245\036:O\315N\245\245\245\245\245\245\b\231\006h\377\177")
          at /home/bar/maria-git/server.10.4.frac2/sql/handler.cc:6719
      #11 0x00000000009242f6 in mysql_update (thd=0x7fff68000d60, 
          table_list=0x7fff68014250, fields=..., values=..., conds=0x0, order_num=0, 
          order=0x0, limit=18446744073709551615, ignore=false, 
          found_return=0x7ffff41d6218, updated_return=0x7ffff41d6210)
          at /home/bar/maria-git/server.10.4.frac2/sql/sql_update.cc:1047
      

      This happens because DATETIME -> TIMESTAMP conversion depends in the @@time_zone system variable.

      The same problem is repeatable with TIMESTAMP->DATETIME conversion:

      SET time_zone='+00:00';
      CREATE OR REPLACE TABLE t1 (
        a TIMESTAMP,
        v DATETIME GENERATED ALWAYS AS (a),
        KEY(v)
      );
      INSERT INTO t1 (a) VALUES ('2001-01-01 10:20:30');
      SET time_zone='+10:00';
      UPDATE t1 SET a='2000-01-01 10:20:30';
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.