MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:June 22 2009 2:47pm
Subject:Re: GSoC Week 6 - I_S/P_S storage engine
View as plain text  
Hi, scut_tang!

I've just noticed the comment in your launchpad bugreport that explains
how to push the new branch of mysql-server. Check it, it may help:

On Jun 15, scut_tang wrote:
> ===================
> Clear about traditional CREATE and SELECT execution process. Although
> it is not very help for I_S storage engine, it make me know more about
> MySQL internal.

> ============
> INFORMATION_SCHEMA storage engine's tables definition is:
> open_table -> get_table_share_with_create ->ha_create_table_from_engine ->
> ha_discover 
> What I need to do is just implement discover for I_S storage engine.
> This function returns specified table's frm contents. Because our
> storage engine does not have frm files, I want to return frm contents
> accoding to ST_SCHEMA_TABLE structure. The core issus is how generate
> frm-like contents by ST_SCHEMA_TABLE structure. My idea and source
> code is to create HA_CREATE_INFO, KEY and Creat_field like function
> mysql_prepare_create_table, according to ST_SCHEMA_TABLE. After
> obtained HA_CREATE_INFO, KEY and Create_field, generates frm-like
> contents like function mysql_create_frm and returns them. But I think
> it is a little complicated. Do you think it is a good idea? 

I agree, it's "a little" complicated :)
I had a simpler suggestion in this my email:

but let me try to explain again. Currently discover() function returns a
binary frm image, which MySQL then reads into a TABLE_SHARE structure. I
think it's too difficult to use in a generic case for a storage engine.

I suggest to change discover() to return a TABLE_SHARE structure
directly. Engines that return binary frm image (that is, NDB) will
convert it to a TABLE_SHARE before returning (basically, calling
open_binary_frm via a wrapper). Other engines - your INFORMATION_SCHEMA
in particular - will be able to fill TABLE_SHARE without intermediate
binary frm image.

> Or give
> some advices of generating frm-like contents?  

How does the above look ?
Regards / Mit vielen Grüßen,

   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Engineer/Server Architect
/_/  /_/\_, /___/\___\_\___/  Sun Microsystems GmbH, HRB München 161028
       <___/                  Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Wolf Frenkel
Vorsitzender des Aufsichtsrates: Martin Häring