1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

handlerton cleanup:

duplicate fields removed, st_mysql_storage_engine added to support
run-time handlerton initialization (no compiler warnings), handler API
is now tied to MySQL version, handlerton->plugin mapping added
(slot-based), dummy default_hton removed, plugin-type-specific
initialization generalized, built-in plugins are now initialized too,
--default-storage-engine no longer needs a list of storage engines
in handle_options().

mysql-test-run.pl bugfixes
This commit is contained in:
serg@sergbook.mysql.com
2006-05-28 14:51:01 +02:00
parent 9c26c629a2
commit fe97dbb587
35 changed files with 459 additions and 850 deletions

View File

@ -46,7 +46,7 @@ static void store_key_options(THD *thd, String *packet, TABLE *table,
KEY *key_info);
/***************************************************************************
** List all table types supported
** List all table types supported
***************************************************************************/
static my_bool show_handlerton(THD *thd, st_plugin_int *plugin,
@ -54,25 +54,25 @@ static my_bool show_handlerton(THD *thd, st_plugin_int *plugin,
{
handlerton *default_type= (handlerton *) arg;
Protocol *protocol= thd->protocol;
handlerton *hton= (handlerton *) plugin->plugin->info;
handlerton *hton= ((st_mysql_storage_engine *)plugin->plugin->info)->handlerton;
if (!(hton->flags & HTON_HIDDEN))
{
protocol->prepare_for_resend();
protocol->store(hton->name, system_charset_info);
protocol->store(plugin->plugin->name, system_charset_info);
const char *option_name= show_comp_option_name[(int) hton->state];
if (hton->state == SHOW_OPTION_YES && default_type == hton)
option_name= "DEFAULT";
protocol->store(option_name, system_charset_info);
protocol->store(hton->comment, system_charset_info);
protocol->store(plugin->plugin->descr, system_charset_info);
protocol->store(hton->commit ? "YES" : "NO", system_charset_info);
protocol->store(hton->prepare ? "YES" : "NO", system_charset_info);
protocol->store(hton->savepoint_set ? "YES" : "NO", system_charset_info);
return protocol->write() ? 1 : 0;
}
return 0;
return 0;
}
bool mysqld_show_storage_engines(THD *thd)
@ -92,7 +92,7 @@ bool mysqld_show_storage_engines(THD *thd)
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE);
if (plugin_foreach(thd, show_handlerton,
if (plugin_foreach(thd, show_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, thd->variables.table_type))
DBUG_RETURN(TRUE);
@ -3055,7 +3055,7 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
void *ptable)
{
TABLE *table= (TABLE *) ptable;
handlerton *hton= (handlerton *) plugin->plugin->info;
handlerton *hton= ((st_mysql_storage_engine *)plugin->plugin->info)->handlerton;
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
CHARSET_INFO *scs= system_charset_info;
DBUG_ENTER("iter_schema_engines");
@ -3063,21 +3063,26 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
if (!(hton->flags & HTON_HIDDEN))
{
if (!(wild && wild[0] &&
wild_case_compare(scs, hton->name,wild)))
wild_case_compare(scs, plugin->plugin->name,wild)))
{
const char *tmp;
LEX_STRING state[2]={{STRING_WITH_LEN("ENABLED")},
{STRING_WITH_LEN("DISABLED")}};
LEX_STRING yesno[2]={{STRING_WITH_LEN("NO")}, {STRING_WITH_LEN("YES")}};
LEX_STRING *tmp;
restore_record(table, s->default_values);
table->field[0]->store(hton->name, strlen(hton->name), scs);
tmp= hton->state ? "DISABLED" : "ENABLED";
table->field[1]->store( tmp, strlen(tmp), scs);
table->field[2]->store(hton->comment, strlen(hton->comment), scs);
tmp= hton->commit ? "YES" : "NO";
table->field[3]->store( tmp, strlen(tmp), scs);
tmp= hton->prepare ? "YES" : "NO";
table->field[4]->store( tmp, strlen(tmp), scs);
tmp= hton->savepoint_set ? "YES" : "NO";
table->field[5]->store( tmp, strlen(tmp), scs);
table->field[0]->store(plugin->plugin->name,
strlen(plugin->plugin->name), scs);
tmp= &state[test(hton->state)];
table->field[1]->store(tmp->str, tmp->length, scs);
table->field[2]->store(plugin->plugin->descr,
strlen(plugin->plugin->descr), scs);
tmp= &yesno[test(hton->commit)];
table->field[3]->store(tmp->str, tmp->length, scs);
tmp= &yesno[test(hton->prepare)];
table->field[4]->store(tmp->str, tmp->length, scs);
tmp= &yesno[test(hton->savepoint_set)];
table->field[5]->store(tmp->str, tmp->length, scs);
if (schema_table_store_record(thd, table))
DBUG_RETURN(1);
@ -3089,7 +3094,7 @@ static my_bool iter_schema_engines(THD *thd, st_plugin_int *plugin,
int fill_schema_engines(THD *thd, TABLE_LIST *tables, COND *cond)
{
return plugin_foreach(thd, iter_schema_engines,
return plugin_foreach(thd, iter_schema_engines,
MYSQL_STORAGE_ENGINE_PLUGIN, tables->table);
}
@ -3104,7 +3109,7 @@ int fill_schema_collation(THD *thd, TABLE_LIST *tables, COND *cond)
{
CHARSET_INFO **cl;
CHARSET_INFO *tmp_cs= cs[0];
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
(tmp_cs->state & MY_CS_HIDDEN) ||
!(tmp_cs->state & MY_CS_PRIMARY))
continue;
@ -4839,7 +4844,7 @@ static my_bool run_hton_fill_schema_files(THD *thd, st_plugin_int *plugin,
{
struct run_hton_fill_schema_files_args *args=
(run_hton_fill_schema_files_args *) arg;
handlerton *hton= (handlerton *) plugin->plugin->info;
handlerton *hton= ((st_mysql_storage_engine *)plugin->plugin->info)->handlerton;
if(hton->fill_files_table)
hton->fill_files_table(thd, args->tables, args->cond);
return false;