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

Aria temptable used for grouping may have key longer than maria_max_key_length()

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.3(EOL), 10.4(EOL)
    • N/A
    • Storage Engine - Aria
    • None

    Description

      Consider this testcase:

      create table ten(a int primary key);
      insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
       
      create table one_k(a int primary key);
      insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
       
      create table t21 (
        a varchar(500) COLLATE utf8mb4_bin
      );
      insert into t21 select A.a+1000*B.a  from one_k A, one_k B;
       
      set max_heap_table_size=32000; # just some low value to overflow the heap table.
      

      Put a breakpoint in create_internal_tmp_table_from_heap, then run

      select conc_val, count(*) from  t21 group by conc_val ;
      

      when the Aria table is created, one can see:

      (gdb) p maria_max_key_length()
        $53 = 1000
      (gdb) p this
        $55 = (ha_maria * const) 0x7fff6c165f38
      (gdb) p table->key_info[0]
        $57 = {key_length = 2000, flags = 2083, user_defined_key_parts = 1, ...
      

      So, key_length larger than maria_max_key_length().

      I didn't see this produce any problem, except that it might be confusing for
      the users. How come GROUP BY code can use a unique key of this length, while
      SJ-Materialization is not applicable for such long keys?

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              psergei Sergei Petrunia
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.