← Back to team overview

maria-developers team mailing list archive

More memory allocation for key seg


Hello Devlopers
I was debugging the source code of mariadb. My query was
MariaDB [sachin]> create table pro2(abc int primary key,xyz int ,
ass int ,unique(xyz,ass))engine=myisam;

In table2myisam function of file ha_myisam.cc i found that
we are allocating more memory for keysegments

if (!(my_multi_malloc(MYF(MY_WME),
          recinfo_out, (share->fields * 2 + 2) * sizeof(MI_COLUMNDEF),
          keydef_out, share->keys * sizeof(MI_KEYDEF),
          (share->key_parts + share->keys) * sizeof(HA_KEYSEG),
                                               ^ here why this

    And we donot use these extra key segments because
    suceeding for loop use only total number of share->key_parts
    keysegments. And same in ha_maria file.Is this a bug or I am missing

Follow ups