summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2011-04-20 19:53:08 +0200
committerMattias Jonsson <mattias.jonsson@oracle.com>2011-04-20 19:53:08 +0200
commit0d857c2c84376a976410c9ee2474d7abcd2336f2 (patch)
treefa51d3c04c53ac900a866138d59e1b6796fe2d52 /sql/handler.cc
parent2f972fef46de74ecab999879421f42b2d67609f4 (diff)
parent482c0b7d421aa3f4eec2c3ca49be4ce3795fe191 (diff)
downloadmariadb-git-0d857c2c84376a976410c9ee2474d7abcd2336f2.tar.gz
Manual merge from 5.1
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index fefc0553c88..445e1ec5a3c 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2076,22 +2076,29 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path,
/****************************************************************************
** General handler functions
****************************************************************************/
-handler *handler::clone(MEM_ROOT *mem_root)
+handler *handler::clone(const char *name, MEM_ROOT *mem_root)
{
- handler *new_handler= get_new_handler(table->s, mem_root, table->s->db_type());
+ handler *new_handler= get_new_handler(table->s, mem_root, ht);
/*
Allocate handler->ref here because otherwise ha_open will allocate it
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,
- table->s->normalized_path.str,
- 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;
}