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

Merge with MySQL 5.1.50

- Changed to still use bcmp() in certain cases becasue
  - Faster for short unaligneed strings than memcmp()
  - Bettern when using valgrind
- Changed to use my_sprintf() instead of sprintf() to get higher portability for old systems
- Changed code to use MariaDB version of select->skip_record()
- Removed -%::SCCS/s.% from Makefile.am:s to remove automake warnings
This commit is contained in:
Michael Widenius
2010-08-27 17:12:44 +03:00
246 changed files with 3488 additions and 1500 deletions

View File

@@ -747,6 +747,9 @@ THD::THD()
thr_lock_owner_init(&main_lock_id, &lock_info);
m_internal_handler= NULL;
current_user_used= FALSE;
memset(&invoker_user, 0, sizeof(invoker_user));
memset(&invoker_host, 0, sizeof(invoker_host));
}
@@ -1072,6 +1075,9 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
while (to != end)
*(to++)+= *(from++);
to_var->bytes_received+= from_var->bytes_received;
to_var->bytes_sent+= from_var->bytes_sent;
}
/*
@@ -1097,6 +1103,9 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
while (to != end)
*(to++)+= *(from++) - *(dec++);
to_var->bytes_received+= from_var->bytes_received - dec_var->bytes_received;;
to_var->bytes_sent+= from_var->bytes_sent - dec_var->bytes_sent;
}
#define SECONDS_TO_WAIT_FOR_KILL 2
@@ -1303,6 +1312,7 @@ void THD::cleanup_after_query()
where= THD::DEFAULT_WHERE;
/* reset table map for multi-table update */
table_map_for_update= 0;
clean_current_user_used();
}
@@ -3336,6 +3346,22 @@ void THD::set_query(char *query_arg, uint32 query_length_arg)
pthread_mutex_unlock(&LOCK_thd_data);
}
void THD::get_definer(LEX_USER *definer)
{
set_current_user_used();
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
if (slave_thread && has_invoker())
{
definer->user = invoker_user;
definer->host= invoker_host;
definer->password.str= NULL;
definer->password.length= 0;
}
else
#endif
get_default_definer(this, definer);
}
/**
Mark transaction to rollback and mark error as fatal to a sub-statement.
@@ -3434,9 +3460,13 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state)
bool xid_cache_insert(XID_STATE *xid_state)
{
pthread_mutex_lock(&LOCK_xid_cache);
DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(),
xid_state->xid.key_length())==0);
my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state);
if (hash_search(&xid_cache, xid_state->xid.key(), xid_state->xid.key_length()))
{
pthread_mutex_unlock(&LOCK_xid_cache);
my_error(ER_XAER_DUPID, MYF(0));
return TRUE;
}
my_bool res= my_hash_insert(&xid_cache, (uchar*)xid_state);
pthread_mutex_unlock(&LOCK_xid_cache);
return res;
}