mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Fixed compiler warnings
Fixed compile-pentium64 scripts Fixed wrong estimate of update_with_key_prefix in sql-bench Merge bk-internal.mysql.com:/home/bk/mysql-5.1 into mysql.com:/home/my/mysql-5.1 Fixed unsafe define of uint4korr() Fixed that --extern works with mysql-test-run.pl Small trivial cleanups This also fixes a bug in counting number of rows that are updated when we have many simultanous queries Move all connection handling and command exectuion main loop from sql_parse.cc to sql_connection.cc Split handle_one_connection() into reusable sub functions. Split create_new_thread() into reusable sub functions. Added thread_scheduler; Preliminary interface code for future thread_handling code. Use 'my_thread_id' for internal thread id's Make thr_alarm_kill() to depend on thread_id instead of thread Make thr_abort_locks_for_thread() depend on thread_id instead of thread In store_globals(), set my_thread_var->id to be thd->thread_id. Use my_thread_var->id as basis for my_thread_name() The above changes makes the connection we have between THD and threads more soft. Added a lot of DBUG_PRINT() and DBUG_ASSERT() functions Fixed compiler warnings Fixed core dumps when running with --debug Removed setting of signal masks (was never used) Made event code call pthread_exit() (portability fix) Fixed that event code doesn't call DBUG_xxx functions before my_thread_init() is called. Made handling of thread_id and thd->variables.pseudo_thread_id uniform. Removed one common 'not freed memory' warning from mysqltest Fixed a couple of usage of not initialized warnings (unlikely cases) Suppress compiler warnings from bdb and (for the moment) warnings from ndb
This commit is contained in:
@@ -343,8 +343,9 @@ void thr_lock_delete(THR_LOCK *lock)
|
||||
|
||||
void thr_lock_info_init(THR_LOCK_INFO *info)
|
||||
{
|
||||
info->thread= pthread_self();
|
||||
info->thread_id= my_thread_id(); /* for debugging */
|
||||
struct st_my_thread_var *tmp= my_thread_var;
|
||||
info->thread= tmp->pthread_self;
|
||||
info->thread_id= tmp->id;
|
||||
info->n_cursors= 0;
|
||||
}
|
||||
|
||||
@@ -622,8 +623,10 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
|
||||
statistic_increment(locks_immediate,&THR_LOCK_lock);
|
||||
goto end;
|
||||
}
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("lock",("write locked by thread: 0x%lx",
|
||||
lock->write.data->owner->info->thread_id));
|
||||
/* purecov: end */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -658,7 +661,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_OWNER *owner,
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
DBUG_PRINT("lock",("write locked by thread: 0x%lx, type: %d",
|
||||
DBUG_PRINT("lock",("write locked by thread: 0x%lx type: %d",
|
||||
lock->read.data->owner->info->thread_id, data->type));
|
||||
}
|
||||
wait_queue= &lock->write_wait;
|
||||
@@ -720,8 +723,10 @@ static inline void free_all_read_locks(THR_LOCK *lock,
|
||||
}
|
||||
lock->read_no_write_count++;
|
||||
}
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("lock",("giving read lock to thread: 0x%lx",
|
||||
data->owner->info->thread_id));
|
||||
/* purecov: end */
|
||||
data->cond=0; /* Mark thread free */
|
||||
VOID(pthread_cond_signal(cond));
|
||||
} while ((data=data->next));
|
||||
@@ -806,8 +811,10 @@ void thr_unlock(THR_LOCK_DATA *data)
|
||||
if (data->type == TL_WRITE_CONCURRENT_INSERT &&
|
||||
(*lock->check_status)(data->status_param))
|
||||
data->type=TL_WRITE; /* Upgrade lock */
|
||||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("lock",("giving write lock of type %d to thread: 0x%lx",
|
||||
data->type, data->owner->info->thread_id));
|
||||
/* purecov: end */
|
||||
{
|
||||
pthread_cond_t *cond=data->cond;
|
||||
data->cond=0; /* Mark thread free */
|
||||
@@ -1006,7 +1013,7 @@ void thr_multi_unlock(THR_LOCK_DATA **data,uint count)
|
||||
thr_unlock(*pos);
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("lock",("Free lock: data: 0x%lx thread: %ld lock: 0x%lx",
|
||||
DBUG_PRINT("lock",("Free lock: data: 0x%lx thread: 0x%lx lock: 0x%lx",
|
||||
(long) *pos, (*pos)->owner->info->thread_id,
|
||||
(long) (*pos)->lock));
|
||||
}
|
||||
@@ -1054,7 +1061,7 @@ void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock)
|
||||
This is used to abort all locks for a specific thread
|
||||
*/
|
||||
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
|
||||
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, my_thread_id thread_id)
|
||||
{
|
||||
THR_LOCK_DATA *data;
|
||||
my_bool found= FALSE;
|
||||
@@ -1063,7 +1070,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
|
||||
pthread_mutex_lock(&lock->mutex);
|
||||
for (data= lock->read_wait.data; data ; data= data->next)
|
||||
{
|
||||
if (pthread_equal(thread, data->owner->info->thread))
|
||||
if (data->owner->info->thread_id == thread_id) /* purecov: tested */
|
||||
{
|
||||
DBUG_PRINT("info",("Aborting read-wait lock"));
|
||||
data->type= TL_UNLOCK; /* Mark killed */
|
||||
@@ -1080,7 +1087,7 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
|
||||
}
|
||||
for (data= lock->write_wait.data; data ; data= data->next)
|
||||
{
|
||||
if (pthread_equal(thread, data->owner->info->thread))
|
||||
if (data->owner->info->thread_id == thread_id) /* purecov: tested */
|
||||
{
|
||||
DBUG_PRINT("info",("Aborting write-wait lock"));
|
||||
data->type= TL_UNLOCK;
|
||||
@@ -1133,7 +1140,9 @@ void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
|
||||
enum thr_lock_type new_lock_type)
|
||||
{
|
||||
THR_LOCK *lock=in_data->lock;
|
||||
#ifndef DBUG_OFF
|
||||
enum thr_lock_type old_lock_type= in_data->type;
|
||||
#endif
|
||||
#ifdef TO_BE_REMOVED
|
||||
THR_LOCK_DATA *data, *next;
|
||||
bool start_writers= FALSE;
|
||||
@@ -1528,6 +1537,10 @@ static void test_get_status(void* param __attribute__((unused)),
|
||||
{
|
||||
}
|
||||
|
||||
static void test_update_status(void* param __attribute__((unused)))
|
||||
{
|
||||
}
|
||||
|
||||
static void test_copy_status(void* to __attribute__((unused)) ,
|
||||
void *from __attribute__((unused)))
|
||||
{
|
||||
@@ -1620,7 +1633,7 @@ int main(int argc __attribute__((unused)),char **argv __attribute__((unused)))
|
||||
{
|
||||
thr_lock_init(locks+i);
|
||||
locks[i].check_status= test_check_status;
|
||||
locks[i].update_status=test_get_status;
|
||||
locks[i].update_status=test_update_status;
|
||||
locks[i].copy_status= test_copy_status;
|
||||
locks[i].get_status= test_get_status;
|
||||
}
|
||||
|
Reference in New Issue
Block a user