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

Some string functions in a virtual column lead the table corruption on @@max_allowed_packet change

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.11, 11.1, 11.2, 11.3, 11.4, 11.5
    • 11.5
    • Data types, Virtual Columns
    • None

    Description

      Some string functions cut the result length up to @@max_allowed_packet. A change in the variable value leads to the table corruption:

      SET GLOBAL max_allowed_packet=16777216*2;
      KILL CONNECTION_ID();
      CREATE OR REPLACE TABLE t1 (
        a VARCHAR(64),
        v INT GENERATED ALWAYS AS (LENGTH(REPEAT(a,16777216*2))),
        KEY(v)
      ) ENGINE=MyISAM;
      INSERT INTO t1 (a) VALUES ('a');
      SELECT * FROM t1;
      KILL CONNECTION_ID();
       
      SET GLOBAL max_allowed_packet=16777216;
      KILL CONNECTION_ID();
       
      CHECK TABLE t1;
      

      +---------+-------+----------+------------------------------------------------------------------------------+
      | Table   | Op    | Msg_type | Msg_text                                                                     |
      +---------+-------+----------+------------------------------------------------------------------------------+
      | test.t1 | check | error    | Checksum for key:  1 doesn't match checksum for records                      |
      | test.t1 | check | Warning  | Result of repeat() was larger than max_allowed_packet (16777216) - truncated |
      | test.t1 | check | error    | Corrupt                                                                      |
      +---------+-------+----------+------------------------------------------------------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              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.