1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge with 5.0

This commit is contained in:
monty@mysql.com
2004-03-26 13:20:05 +02:00
4 changed files with 16 additions and 2 deletions

View File

@ -878,6 +878,7 @@ extern bool using_update_log, opt_large_files;
extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log; extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
extern bool opt_disable_networking, opt_skip_show_db; extern bool opt_disable_networking, opt_skip_show_db;
extern bool volatile abort_loop, shutdown_in_progress, grant_option; extern bool volatile abort_loop, shutdown_in_progress, grant_option;
extern bool mysql_proc_table_exists;
extern uint volatile thread_count, thread_running, global_read_lock; extern uint volatile thread_count, thread_running, global_read_lock;
extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names; extern my_bool opt_safe_show_db, opt_local_infile, lower_case_table_names;

View File

@ -1347,7 +1347,7 @@ static int get_index_merge_params(PARAM *param, key_map& needed_reg,
else else
{ {
double n_blocks= double n_blocks=
ceil((double)(longlong)param->table->file->data_file_length / IO_SIZE); ceil((double) ((longlong)param->table->file->data_file_length / IO_SIZE));
double busy_blocks= double busy_blocks=
n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, (double) records_for_unique)); n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, (double) records_for_unique));

View File

@ -57,6 +57,8 @@ enum
MYSQL_PROC_FIELD_COUNT MYSQL_PROC_FIELD_COUNT
}; };
bool mysql_proc_table_exists= 1;
/* *opened=true means we opened ourselves */ /* *opened=true means we opened ourselves */
static int static int
db_find_routine_aux(THD *thd, int type, sp_name *name, db_find_routine_aux(THD *thd, int type, sp_name *name,
@ -69,6 +71,14 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
DBUG_PRINT("enter", ("type: %d name: %*s", DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str)); type, name->m_name.length, name->m_name.str));
/*
Speed up things if mysql.proc doesn't exists
mysql_proc_table_exists is set when on creates a stored procedure
or on flush privileges
*/
if (!mysql_proc_table_exists && ltype == TL_READ)
DBUG_RETURN(SP_OPEN_TABLE_FAILED);
// Put the key used to read the row together // Put the key used to read the row together
keylen= name->m_db.length; keylen= name->m_db.length;
if (keylen > 64) if (keylen > 64)
@ -99,10 +109,12 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
if (! (table= open_ltable(thd, &tables, ltype))) if (! (table= open_ltable(thd, &tables, ltype)))
{ {
*tablep= NULL; *tablep= NULL;
mysql_proc_table_exists= 0;
DBUG_RETURN(SP_OPEN_TABLE_FAILED); DBUG_RETURN(SP_OPEN_TABLE_FAILED);
} }
*opened= TRUE; *opened= TRUE;
} }
mysql_proc_table_exists= 1;
if (table->file->index_read_idx(table->record[0], 0, if (table->file->index_read_idx(table->record[0], 0,
key, keylen, key, keylen,
@ -852,6 +864,7 @@ sp_function_exists(THD *thd, sp_name *name)
ret= TRUE; ret= TRUE;
if (opened) if (opened)
close_thread_tables(thd, 0, 1); close_thread_tables(thd, 0, 1);
thd->clear_error();
DBUG_RETURN(ret); DBUG_RETURN(ret);
} }

View File

@ -140,7 +140,6 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
MYSQL_LOCK *lock; MYSQL_LOCK *lock;
my_bool return_val=1; my_bool return_val=1;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE; bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
DBUG_ENTER("acl_init"); DBUG_ENTER("acl_init");
if (!acl_cache) if (!acl_cache)
@ -153,6 +152,7 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
} }
priv_version++; /* Privileges updated */ priv_version++; /* Privileges updated */
mysql_proc_table_exists= 1; // Assume mysql.proc exists
/* /*
To be able to run this from boot, we allocate a temporary THD To be able to run this from boot, we allocate a temporary THD