1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge dtrace patch with latest performance version

This commit is contained in:
Mikael Ronstrom
2008-12-20 11:53:27 +01:00
527 changed files with 193710 additions and 238418 deletions

View File

@@ -717,6 +717,11 @@ int mysql_update(THD *thd,
else
table->file->unlock_row();
thd->row_count++;
if (thd->is_error())
{
error= 1;
break;
}
}
dup_key_found= 0;
/*
@@ -1043,7 +1048,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)
@@ -1080,11 +1085,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.
@@ -1100,6 +1108,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;
}
@@ -1447,6 +1483,32 @@ multi_update::initialize_tables(JOIN *join)
}
table->prepare_for_position();
/*
enable uncacheable flag if we update a view with check option
and check option has a subselect, otherwise, the check option
can be evaluated after the subselect was freed as independent
(See full_local in JOIN::join_free()).
*/
if (table_ref->check_option && !join->select_lex->uncacheable)
{
SELECT_LEX_UNIT *tmp_unit;
SELECT_LEX *sl;
for (tmp_unit= join->select_lex->first_inner_unit();
tmp_unit;
tmp_unit= tmp_unit->next_unit())
{
for (sl= tmp_unit->first_select(); sl; sl= sl->next_select())
{
if (sl->master_unit()->item)
{
join->select_lex->uncacheable|= UNCACHEABLE_CHECKOPTION;
goto loop_end;
}
}
}
}
loop_end:
if (table == first_table_for_update && table_ref->check_option)
{
table_map unupdated_tables= table_ref->check_option->used_tables() &