#At file:///opt/local/work/mysql-next-30977-1/ based on revid:tor.didriksen@stripped
2873 Konstantin Osipov 2009-08-21
Interim commit
modified:
sql/sql_base.cc
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2009-08-14 19:52:00 +0000
+++ b/sql/sql_base.cc 2009-08-21 18:50:50 +0000
@@ -3723,13 +3723,14 @@ thr_lock_type read_lock_type_for_table(T
static bool
open_routines(THD *thd, Query_tables_list *prelocking_ctx,
- Sroutine_hash_entry *start,
+ Sroutine_hash_entry ***start,
Prelocking_strategy *prelocking_strategy,
bool *need_prelocking)
{
+ Sroutine_hash_entry *prev= NULL;
DBUG_ENTER("open_routines");
- for (Sroutine_hash_entry *rt= start; rt; rt= rt->next)
+ for (Sroutine_hash_entry *rt= **start; rt; prev=rt, rt= rt->next)
{
int type= rt->key.str[0];
@@ -3758,6 +3759,14 @@ open_routines(THD *thd, Query_tables_lis
DBUG_ASSERT(0);
}
}
+ /*
+ If prev is set, it points at the last Sroutine_hash_entry element
+ in the list. Update the pointer to point to next element
+ of it, so that we can reuse this pointer to resume open_routines()
+ using this pointer when we need it.
+ */
+ if (prev)
+ *start= &prev->next;
DBUG_RETURN(FALSE);
}
@@ -3795,6 +3804,7 @@ bool open_tables(THD *thd, TABLE_LIST **
Prelocking_strategy *prelocking_strategy)
{
TABLE_LIST *tables= NULL;
+ Sroutine_hash_entry **sroutine= NULL;
Open_table_context ot_ctx(thd);
bool error= FALSE;
MEM_ROOT new_frm_mem;
@@ -3811,6 +3821,7 @@ bool open_tables(THD *thd, TABLE_LIST **
thd->current_tablenr= 0;
restart:
+ sroutine= (Sroutine_hash_entry**) &thd->lex->sroutines_list.first;
*counter= 0;
query_tables_last_own= 0;
thd_proc_info(thd, "Opening tables");
@@ -3843,7 +3854,7 @@ bool open_tables(THD *thd, TABLE_LIST **
DBUG_ASSERT(thd->lex->query_tables == *start);
error= open_routines(thd, thd->lex,
- (Sroutine_hash_entry *)thd->lex->sroutines_list.first,
+ &sroutine,
prelocking_strategy, &need_prelocking);
if (error)
{
@@ -4036,9 +4047,6 @@ bool open_tables(THD *thd, TABLE_LIST **
bool need_prelocking= FALSE;
bool not_used;
TABLE_LIST **save_query_tables_last= thd->lex->query_tables_last;
- Sroutine_hash_entry **sroutines_next=
- (Sroutine_hash_entry **)thd->lex->sroutines_list.next;
-
/*
Extend statement's table list and the prelocking set with
tables and routines according to the current prelocking
@@ -4065,7 +4073,7 @@ bool open_tables(THD *thd, TABLE_LIST **
prelocking strategy prescribes so, add tables it uses to the table
list and routines it might invoke to the prelocking set.
*/
- error= open_routines(thd, thd->lex, *sroutines_next, prelocking_strategy,
+ error= open_routines(thd, thd->lex, &sroutine, prelocking_strategy,
¬_used);
if (error)
goto err;
@@ -4114,8 +4122,6 @@ process_view_routines:
bool need_prelocking= FALSE;
bool not_used;
TABLE_LIST **save_query_tables_last= thd->lex->query_tables_last;
- Sroutine_hash_entry **sroutines_next=
- (Sroutine_hash_entry **)thd->lex->sroutines_list.next;
error= prelocking_strategy->handle_view(thd, thd->lex, tables,
&need_prelocking);
@@ -4126,7 +4132,7 @@ process_view_routines:
if (error)
goto err;
- error= open_routines(thd, thd->lex, *sroutines_next, prelocking_strategy,
+ error= open_routines(thd, thd->lex, &sroutine, prelocking_strategy,
¬_used);
if (error)
Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20090821185050-y4iy5j7x382gsokk.bundle
| Thread |
|---|
| • bzr commit into mysql-5.4 branch (kostja:2873) | Konstantin Osipov | 21 Aug |