summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2020-06-14 11:48:50 +0200
committerSergei Golubchik <serg@mariadb.org>2020-07-04 01:44:46 +0200
commitb014720b6c05c8f8c08ffad263aff3273ff3d253 (patch)
tree79403ae2af98a242db7612e32f7eb11e2e17a4a2
parentc55c292832e2776d37e06c43174ac006e00143a2 (diff)
downloadmariadb-git-b014720b6c05c8f8c08ffad263aff3273ff3d253.tar.gz
optimization: use hton->drop_table in few simple cases
-rw-r--r--sql/log.cc1
-rw-r--r--storage/blackhole/ha_blackhole.cc1
-rw-r--r--storage/example/ha_example.cc1
-rw-r--r--storage/federated/ha_federated.cc1
-rw-r--r--storage/federatedx/ha_federatedx.cc1
-rw-r--r--storage/heap/ha_heap.cc12
-rw-r--r--storage/myisam/ha_myisam.cc6
-rw-r--r--storage/oqgraph/ha_oqgraph.cc1
-rw-r--r--storage/perfschema/ha_perfschema.cc1
-rw-r--r--storage/sequence/sequence.cc1
-rw-r--r--storage/sphinx/ha_sphinx.cc1
11 files changed, 24 insertions, 3 deletions
diff --git a/sql/log.cc b/sql/log.cc
index abf22e7897a..b6778f34768 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -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;
diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc
index 98589f1d043..82ac9123d3b 100644
--- a/storage/blackhole/ha_blackhole.cc
+++ b/storage/blackhole/ha_blackhole.cc
@@ -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,
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index cf259a7e80d..f6760c06f2d 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -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);
}
diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc
index b62b74d12bb..766f9a2b790 100644
--- a/storage/federated/ha_federated.cc
+++ b/storage/federated/ha_federated.cc
@@ -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);
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 2370473236e..45029fdf17f 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -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;
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index f195264ce7f..0e61bff1d8d 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -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);
}
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index e7ca765351b..e58ee9e31e4 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -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;
diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc
index 20a3732ce95..8b219b20ec6 100644
--- a/storage/oqgraph/ha_oqgraph.cc
+++ b/storage/oqgraph/ha_oqgraph.cc
@@ -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;
diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc
index c4c59d109f5..d36a7d7322a 100644
--- a/storage/perfschema/ha_perfschema.cc
+++ b/storage/perfschema/ha_perfschema.cc
@@ -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 |
diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc
index 31522b8f3b7..ddebb1a1a8d 100644
--- a/storage/sequence/sequence.cc
+++ b/storage/sequence/sequence.cc
@@ -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;
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index d60a4d229e6..39e07290853 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -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
}