mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user