mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge of 5.1-main into 5.1-maria. There were no changes to storage/myisam, or mysql-test/t/*myisam*.
However there were three new tests mysql-test/suite/parts/t/partition*myisam.test, of which I make here copies for Maria.
This commit is contained in:
@ -1039,7 +1039,7 @@ reopen_tables:
|
||||
correct order of statements. Otherwise, we use a TL_READ lock to
|
||||
improve performance.
|
||||
*/
|
||||
tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ;
|
||||
tl->lock_type= read_lock_type_for_table(thd, table);
|
||||
tl->updating= 0;
|
||||
/* Update TABLE::lock_type accordingly. */
|
||||
if (!tl->placeholder() && !using_lock_tables)
|
||||
@ -1076,11 +1076,14 @@ reopen_tables:
|
||||
}
|
||||
|
||||
/* now lock and fill tables */
|
||||
if (lock_tables(thd, table_list, table_count, &need_reopen))
|
||||
if (!thd->stmt_arena->is_stmt_prepare() &&
|
||||
lock_tables(thd, table_list, table_count, &need_reopen))
|
||||
{
|
||||
if (!need_reopen)
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
DBUG_PRINT("info", ("lock_tables failed, reopening"));
|
||||
|
||||
/*
|
||||
We have to reopen tables since some of them were altered or dropped
|
||||
during lock_tables() or something was done with their triggers.
|
||||
@ -1096,6 +1099,34 @@ reopen_tables:
|
||||
for (TABLE_LIST *tbl= table_list; tbl; tbl= tbl->next_global)
|
||||
tbl->cleanup_items();
|
||||
|
||||
/*
|
||||
To not to hog memory (as a result of the
|
||||
unit->reinit_exec_mechanism() call below):
|
||||
*/
|
||||
lex->unit.cleanup();
|
||||
|
||||
for (SELECT_LEX *sl= lex->all_selects_list;
|
||||
sl;
|
||||
sl= sl->next_select_in_list())
|
||||
{
|
||||
SELECT_LEX_UNIT *unit= sl->master_unit();
|
||||
unit->reinit_exec_mechanism(); // reset unit->prepared flags
|
||||
/*
|
||||
Reset 'clean' flag back to force normal execution of
|
||||
unit->cleanup() in Prepared_statement::cleanup_stmt()
|
||||
(call to lex->unit.cleanup() above sets this flag to TRUE).
|
||||
*/
|
||||
unit->unclean();
|
||||
}
|
||||
|
||||
/*
|
||||
Also we need to cleanup Natural_join_column::table_field items.
|
||||
To not to traverse a join tree we will cleanup whole
|
||||
thd->free_list (in PS execution mode that list may not contain
|
||||
items from 'fields' list, so the cleanup above is necessary to.
|
||||
*/
|
||||
cleanup_items(thd->free_list);
|
||||
|
||||
close_tables_for_reopen(thd, &table_list);
|
||||
goto reopen_tables;
|
||||
}
|
||||
|
Reference in New Issue
Block a user