diff options
author | unknown <svoj@april.(none)> | 2006-09-12 18:25:35 +0500 |
---|---|---|
committer | unknown <svoj@april.(none)> | 2006-09-12 18:25:35 +0500 |
commit | fa1436bf1f87cbe627d42e75b5e84cf7eb40b6b8 (patch) | |
tree | f55c1bef77080c8bc784fbe2aac8f150441acea5 /sql/handler.cc | |
parent | 86ce30966e8cd3c1d662c34f488a1c26f640b8f7 (diff) | |
download | mariadb-git-fa1436bf1f87cbe627d42e75b5e84cf7eb40b6b8.tar.gz |
BUG#20256 - LOCK WRITE - MyISAM
Only MyISAM tables locked with LOCK TABLES ... WRITE were affected.
A query that is optimized with index_merge doesn't reflect rows
inserted within LOCK TABLES.
MyISAM doesn't flush a state within LOCK TABLES. index_merge
optimization creates a copy of the handler, which thus gets
outdated MyISAM state.
New handler->clone() method is introduced to fix this problem.
For non-MyISAM storage engines it allocates a handler and opens
it with ha_open(). For MyISAM it additionally copies MyISAM state
pointer to cloned handler.
mysql-test/r/index_merge.result:
A test case for bug#20256.
mysql-test/t/index_merge.test:
A test case for bug#20256.
sql/ha_myisam.cc:
clone method added to handler class.
sql/ha_myisam.h:
clone method added to handler class.
sql/handler.cc:
clone method added to handler class.
sql/handler.h:
clone method added to handler class.
sql/opt_range.cc:
Use handler clone method.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r-- | sql/handler.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 01aa7491383..81981a5dcc6 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1372,6 +1372,15 @@ int ha_delete_table(THD *thd, enum db_type table_type, const char *path, /**************************************************************************** ** General handler functions ****************************************************************************/ +handler *handler::clone(MEM_ROOT *mem_root) +{ + handler *new_handler= get_new_handler(table, mem_root, table->s->db_type); + if (new_handler && !new_handler->ha_open(table->s->path, table->db_stat, + HA_OPEN_IGNORE_IF_LOCKED)) + return new_handler; + return NULL; +} + /* Open database-handler. Try O_RDONLY if can't open as O_RDWR */ /* Don't wait for locks if not HA_OPEN_WAIT_IF_LOCKED is set */ |