Thanks Sergei , this solved the mystery.
Regards 
sachin

On Wed, Mar 23, 2016 at 12:03 AM, Sergei Golubchik <serg@mariadb.org> wrote:
Hi, Sachin!

On Mar 22, Sachin Setia wrote:
> 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),
>           &keyseg,
>           (share->key_parts + share->keys) * sizeof(HA_KEYSEG),
>                                                ^ here why this
>           NullS)))
>
>     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
> something
>     Regards
>     sachin

The last key segment of every key is the row id. For dynamic row format
it's the offset in the MYD file. For static row format (all rows have
the same length as in your example above) it's the row number.

Regards,
Sergei
Chief Architect MariaDB
and security@mariadb.org