Silent conversion from Dynamic to Fixed row_format for certain values of key_block_size

Bug #784464 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
percona-projects-qa
Fix Released
Undecided
Alexey Kopytov

Bug Description

The following table

CREATE TABLE t1 ( f1 VARCHAR(32), f2 VARCHAR(32), f3 VARCHAR(32), f4 VARCHAR(32), PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC ;

Is silently converted into row_format = Fixed for certain values of KEY_BLOCK_SIZE, which does not correspond to any published limitations. Tables that have a smaller number of fields with the same total field length are not affected.

For this table:
- KEY_BLOCK_SIZE = 33 or below results in "Incorrect usage/placement of 'key_block_size'". This is due to insufficient space to hold the PK;
- KEY BLOCK SIZE between 34 and 133 inclusive results in row_format = Fixed
- KEY BLOCK SIZE above 133 results in row_format = Dynamic

For the following approximately equivalent table:

CREATE TABLE t1 ( f1 VARCHAR(32), f2 VARCHAR(96) PRIMARY KEY (f1)) ENGINE=HEAP ROW_FORMAT=DYNAMIC ;

no such boundary is observed. The table is created as dynamic for all values of KEY BLOCK SIZE => 34;

Changed in percona-projects-qa:
milestone: none → 5.5.13-eb
Changed in percona-projects-qa:
assignee: nobody → Valentine Gostev (core-longbow)
Changed in percona-projects-qa:
assignee: Valentine Gostev (longbow) → Alexey Kopytov (akopytov)
Revision history for this message
Alexey Kopytov (akopytov) wrote :

  The description in hp_dspace.c says that "Heap Engine will revert to
  fixed_size allocation if key_block_size provides no memory
  benefits". The problem was that the code implementing it in
  heap_create() was (1) buggy and (2) implementing a slightly different
  logic.

  Fixed the code so that reverting to fixed-size format only happens when
  a record in the fixed-size format would always take less space than the
  first chunk in the dynamic row format, i.e. when there are certainly
  no benefits from using the dynamic row format with the specified
  key_block_size.

Changed in percona-projects-qa:
status: New → Fix Committed
Changed in percona-projects-qa:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.