diff options
author | unknown <ramil@ndbmaster.mysql.com> | 2005-11-06 08:29:03 +0100 |
---|---|---|
committer | unknown <ramil@ndbmaster.mysql.com> | 2005-11-06 08:29:03 +0100 |
commit | 89288fac18e6b32efa7155f54eb9ab6e75b72c53 (patch) | |
tree | 6f23a2bb49cbac7859890493620202b75435bc0e /sql | |
parent | efe3703aaca1736455541e8be8d832a6a2f65e40 (diff) | |
download | mariadb-git-89288fac18e6b32efa7155f54eb9ab6e75b72c53.tar.gz |
WL #528: Faster free_tmp_table
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_heap.cc | 8 | ||||
-rw-r--r-- | sql/ha_heap.h | 1 | ||||
-rw-r--r-- | sql/handler.cc | 8 | ||||
-rw-r--r-- | sql/handler.h | 1 | ||||
-rw-r--r-- | sql/sql_select.cc | 12 |
5 files changed, 20 insertions, 10 deletions
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index ab13f03825d..adce6bdc102 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -477,6 +477,14 @@ int ha_heap::delete_table(const char *name) return error == ENOENT ? 0 : error; } + +void ha_heap::drop_table(const char *name) +{ + heap_drop_table(file); + close(); +} + + int ha_heap::rename_table(const char * from, const char * to) { return heap_rename(from,to); diff --git a/sql/ha_heap.h b/sql/ha_heap.h index 4a01b3317f1..9b93936b573 100644 --- a/sql/ha_heap.h +++ b/sql/ha_heap.h @@ -94,6 +94,7 @@ public: int indexes_are_disabled(void); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); int delete_table(const char *from); + void drop_table(const char *name); int rename_table(const char * from, const char * to); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); void update_create_info(HA_CREATE_INFO *create_info); diff --git a/sql/handler.cc b/sql/handler.cc index 1b2cae7f7f2..fd1be7638b0 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2062,6 +2062,14 @@ int handler::rename_table(const char * from, const char * to) return error; } + +void handler::drop_table(const char *name) +{ + close(); + delete_table(name); +} + + /* Tell the storage engine that it is allowed to "disable transaction" in the handler. It is a hint that ACID is not required - it is used in NDB for diff --git a/sql/handler.h b/sql/handler.h index f5f0afa00d5..bb48b119e45 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1288,6 +1288,7 @@ public: */ virtual int rename_table(const char *from, const char *to); virtual int delete_table(const char *name); + virtual void drop_table(const char *name); virtual int create(const char *name, TABLE *form, HA_CREATE_INFO *info)=0; virtual int create_handler_files(const char *name) { return FALSE;} diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 360b161a78a..6552164a8e8 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8848,16 +8848,8 @@ free_tmp_table(THD *thd, TABLE *entry) if (entry->file) { if (entry->db_stat) - { - (void) entry->file->close(); - } - /* - We can't call ha_delete_table here as the table may created in mixed case - here and we have to ensure that delete_table gets the table name in - the original case. - */ - if (!(test_flags & TEST_KEEP_TMP_TABLES) || - entry->s->db_type == DB_TYPE_HEAP) + entry->file->drop_table(entry->s->table_name); + else entry->file->delete_table(entry->s->table_name); delete entry->file; } |