Commit b014720b authored by Sergei Golubchik's avatar Sergei Golubchik

optimization: use hton->drop_table in few simple cases

parent c55c2928
......@@ -1692,6 +1692,7 @@ int binlog_init(void *p)
binlog_savepoint_rollback_can_release_mdl;
binlog_hton->commit= binlog_commit;
binlog_hton->rollback= binlog_rollback;
binlog_hton->drop_table= [](handlerton *, const char*) { return 0; };
if (WSREP_ON || opt_bin_log)
{
binlog_hton->prepare= binlog_prepare;
......
......@@ -399,6 +399,7 @@ static int blackhole_init(void *p)
blackhole_hton= (handlerton *)p;
blackhole_hton->db_type= DB_TYPE_BLACKHOLE_DB;
blackhole_hton->create= blackhole_create_handler;
blackhole_hton->drop_table= [](handlerton *, const char*) { return 0; };
blackhole_hton->flags= HTON_CAN_RECREATE | HTON_AUTOMATIC_DELETE_TABLE;
mysql_mutex_init(bh_key_mutex_blackhole,
......
......@@ -262,6 +262,7 @@ static int example_init_func(void *p)
example_hton->table_options= example_table_option_list;
example_hton->field_options= example_field_option_list;
example_hton->tablefile_extensions= ha_example_exts;
example_hton->drop_table= [](handlerton *, const char*) { return 0; };
DBUG_RETURN(0);
}
......
......@@ -484,6 +484,7 @@ int federated_db_init(void *p)
federated_hton->commit= federated_commit;
federated_hton->rollback= federated_rollback;
federated_hton->create= federated_create_handler;
federated_hton->drop_table= [](handlerton *, const char*) { return 0; };
federated_hton->flags= (HTON_ALTER_NOT_SUPPORTED | HTON_NO_PARTITION |
HTON_AUTOMATIC_DELETE_TABLE);
......
......@@ -438,6 +438,7 @@ int federatedx_db_init(void *p)
federatedx_hton->rollback= ha_federatedx::rollback;
federatedx_hton->discover_table_structure= ha_federatedx::discover_assisted;
federatedx_hton->create= federatedx_create_handler;
federatedx_hton->drop_table= [](handlerton *, const char*) { return 0; };
federatedx_hton->flags= (HTON_ALTER_NOT_SUPPORTED |
HTON_AUTOMATIC_DELETE_TABLE);
federatedx_hton->create_derived= create_federatedx_derived_handler;
......
......@@ -34,12 +34,18 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
HP_CREATE_INFO *hp_create_info);
int heap_panic(handlerton *hton, ha_panic_function flag)
static int heap_panic(handlerton *hton, ha_panic_function flag)
{
return hp_panic(flag);
}
static int heap_drop_table(handlerton *hton, const char *path)
{
int error= heap_delete_table(path);
return error == ENOENT ? 0 : error;
}
int heap_init(void *p)
{
handlerton *heap_hton;
......@@ -50,6 +56,7 @@ int heap_init(void *p)
heap_hton->db_type= DB_TYPE_HEAP;
heap_hton->create= heap_create_handler;
heap_hton->panic= heap_panic;
heap_hton->drop_table= heap_drop_table;
heap_hton->flags= HTON_CAN_RECREATE;
return 0;
......@@ -559,8 +566,7 @@ THR_LOCK_DATA **ha_heap::store_lock(THD *thd,
int ha_heap::delete_table(const char *name)
{
int error= heap_delete_table(name);
return error == ENOENT ? 0 : error;
return heap_drop_table(0, name);
}
......
......@@ -2512,6 +2512,11 @@ int myisam_panic(handlerton *hton, ha_panic_function flag)
return mi_panic(flag);
}
static int myisam_drop_table(handlerton *hton, const char *path)
{
return mi_delete_table(path);
}
static int myisam_init(void *p)
{
handlerton *hton;
......@@ -2529,6 +2534,7 @@ static int myisam_init(void *p)
hton= (handlerton *)p;
hton->db_type= DB_TYPE_MYISAM;
hton->create= myisam_create_handler;
hton->drop_table= myisam_drop_table;
hton->panic= myisam_panic;
hton->flags= HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES;
hton->tablefile_extensions= ha_myisam_exts;
......
......@@ -192,6 +192,7 @@ static int oqgraph_init(void *p)
hton->discover_table_structure= oqgraph_discover_table_structure;
hton->close_connection = oqgraph_close_connection;
hton->drop_table= [](handlerton *, const char*) { return 0; };
oqgraph_init_done= TRUE;
return 0;
......
......@@ -94,6 +94,7 @@ static int pfs_init_func(void *p)
pfs_hton= reinterpret_cast<handlerton *> (p);
pfs_hton->create= pfs_create_handler;
pfs_hton->drop_table= [](handlerton *, const char*) { return 0; };
pfs_hton->show_status= pfs_show_status;
pfs_hton->flags= (HTON_ALTER_NOT_SUPPORTED |
HTON_TEMPORARY_NOT_SUPPORTED |
......
......@@ -502,6 +502,7 @@ static int init(void *p)
handlerton *hton= (handlerton *)p;
sequence_hton= hton;
hton->create= create_handler;
hton->drop_table= [](handlerton *, const char*) { return 0; };
hton->discover_table= discover_table;
hton->discover_table_existence= discover_table_existence;
hton->commit= hton->rollback= dummy_commit_rollback;
......
......@@ -749,6 +749,7 @@ static int sphinx_init_func ( void * p )
hton->close_connection = sphinx_close_connection;
hton->show_status = sphinx_show_status;
hton->panic = sphinx_panic;
hton->drop_table= [](handlerton *, const char*) { return 0; };
hton->flags = HTON_CAN_RECREATE | HTON_AUTOMATIC_DELETE_TABLE;
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment