diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-04-20 17:52:33 +0200 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-04-20 17:52:33 +0200 |
commit | bd92ea43116b8ce606de5e6fc825e1a8b87a7740 (patch) | |
tree | 6909873a2b00805bf2a43dffb077f8115662e92f /sql/handler.cc | |
parent | e0887df8e1127c0f1410b9d4ad61647cb5f93be2 (diff) | |
download | mariadb-git-bd92ea43116b8ce606de5e6fc825e1a8b87a7740.tar.gz |
Bug#11766249 bug#59316: PARTITIONING AND INDEX_MERGE MEMORY LEAK
Update for previous patch according to reviewers comments.
Updated the constructors for ha_partitions to use the common
init_handler_variables functions
Added use of defines for size and offset to get better readability for the code that reads
and writes the .par file. Also refactored the get_from_handler_file function.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 8adb8e061a3..718529fa5fc 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2045,14 +2045,21 @@ handler *handler::clone(const char *name, MEM_ROOT *mem_root) on this->table->mem_root and we will not be able to reclaim that memory when the clone handler object is destroyed. */ - if (!(new_handler->ref= (uchar*) alloc_root(mem_root, ALIGN_SIZE(ref_length)*2))) - return NULL; - if (new_handler && !new_handler->ha_open(table, - name, - table->db_stat, - HA_OPEN_IGNORE_IF_LOCKED)) - return new_handler; - return NULL; + if (new_handler && + !(new_handler->ref= (uchar*) alloc_root(mem_root, + ALIGN_SIZE(ref_length)*2))) + new_handler= NULL; + /* + TODO: Implement a more efficient way to have more than one index open for + the same table instance. The ha_open call is not cachable for clone. + */ + if (new_handler && new_handler->ha_open(table, + name, + table->db_stat, + HA_OPEN_IGNORE_IF_LOCKED)) + new_handler= NULL; + + return new_handler; } |