summaryrefslogtreecommitdiff
path: root/storage/myisammrg/ha_myisammrg.h
diff options
context:
space:
mode:
authorV Narayanan <v.narayanan@sun.com>2009-02-12 16:42:07 +0530
committerV Narayanan <v.narayanan@sun.com>2009-02-12 16:42:07 +0530
commite80537b7912b4790817e3afb6fc3f84f3a82d224 (patch)
treeeadede7bdbf9164b8ea749edcec117563b12822a /storage/myisammrg/ha_myisammrg.h
parentccca4feca8c4134ef00ca1acaba32ff553c4c947 (diff)
downloadmariadb-git-e80537b7912b4790817e3afb6fc3f84f3a82d224.tar.gz
Bug#40675 MySQL 5.1 crash with index merge algorithm and Merge tables
A Query in the MyISAM merge table was crashing if the index merge algorithm was being used Index Merge optimization requires the reading of multiple indexes at the same time. Reading multiple indexes at once with current SE API means that we need to have handler instance for each to-be-read index. This is done by creating clones of the handlers instances. The clone internally does a open of the handler. The open for a MERGE engine is handled in the following phases 1) open parent table 2) generate list of underlying table 3) attach underlying tables But the current implementation does only the first phase (i.e.) open parent table. The current patch fixes this at the MERGE engine level, by handling the clone operation within the MERGE engine rather than in the storage engine API. It opens and attaches the MyISAM tables on the MyISAM storage engine interface directly within the MERGE engine. The new MyISAM table instances, as well as the MERGE clone itself, are not visible in the table cache. This is not a problem because all locking is handled by the original MERGE table from which this is cloned of. mysql-test/r/merge.result: updated the result file to reflect the new tests added to test the fix mysql-test/t/merge.test: Added new tests to verify that the index merge algorithm does not crash in the merge engine. storage/myisammrg/ha_myisammrg.cc: Implement the clone method, that handles 1) Cloning the handler 2) Opening underlying MYISAM child tables 3) Copies the state of the original handler and the children into the cloned instances 4) Sets the appropriate flags storage/myisammrg/ha_myisammrg.h: Added a flag that is set to indicate that the current instance is cloned. Also added the prototype or the clone method. storage/myisammrg/myrg_open.c: Since we do now again use myrg_open() in the server removed the comments marking this as deadcode.
Diffstat (limited to 'storage/myisammrg/ha_myisammrg.h')
-rw-r--r--storage/myisammrg/ha_myisammrg.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h
index 4e7ddebb836..21d41c9d75a 100644
--- a/storage/myisammrg/ha_myisammrg.h
+++ b/storage/myisammrg/ha_myisammrg.h
@@ -25,6 +25,7 @@
class ha_myisammrg: public handler
{
MYRG_INFO *file;
+ my_bool is_cloned; /* This instance has been cloned */
public:
TABLE_LIST *next_child_attach; /* next child to attach */
@@ -60,6 +61,7 @@ class ha_myisammrg: public handler
int open(const char *name, int mode, uint test_if_locked);
int attach_children(void);
int detach_children(void);
+ virtual handler *clone(MEM_ROOT *mem_root);
int close(void);
int write_row(uchar * buf);
int update_row(const uchar * old_data, uchar * new_data);