Brian "Krow" Aker (krow) wrote,
Brian "Krow" Aker

Engine Discovery

(I am writing this as a note to myself, more then as a note to

The MySQL Engine API supports a concept of "discovery". Discovery
allows an engine to say "yes this table exists, and here is the

To implement this, you need to create the following function in your

int archive_discover(handlerton *hton, THD* thd, const char *db,
const char *name,
const void** frmblob,
uint* frmlen);

This is a function for the handlerton, and is not a method of the
handler class.

Table discovery flow of execution is simple. Whenever a table is
opened, MySQL looks for a corresponding table or view definition. If
neither exists then the discovery functions are called for each of
the engines that have registered a discovery function. In the
discovery an engine can return either 1 if the table is not found, or
zero if it is found.

The engine must return the binary form of the table (aka the FRM).
The server will take responsibility for the memory associated with
the frm. The limitation to this is that you must have an FRM in the
first place.
  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded