Loading Docs/manual.texi +12 −6 Original line number Diff line number Diff line Loading @@ -7252,7 +7252,7 @@ MySQL. How well a certain platform is suited for a high-load mission critical MySQL server is determined by the following factors: @itemize @itemize @bullet @item General stability of the thread library. A platform may have excellent reputation otherwise, but if the thread library is unstable in the code Loading Loading @@ -7384,7 +7384,7 @@ If you want to configure @code{mysqld} with some extra features that are NOT in the standard binary distributions. Here is a list of the most common extra options that you may want to use: @itemize @itemize @bullet @item @code{--with-berkeley-db} @item @code{--with-innodb} @item @code{--with-raid} Loading Loading @@ -23950,7 +23950,7 @@ to it clean up. You should start by creating a wrapper library /module with the following functions: @itemize @itemize @bullet @item @code{safe_writer_connect()} @item Loading Loading @@ -26902,7 +26902,7 @@ flag again, the @code{SQL_MAX_JOIN_SIZE} variable will be ignored. You can set a default value for this variable by starting @code{mysqld} with @code{-O max_join_size=#}. @item SQL_SAFE_MODE = 0 | 1 @item SQL_SAFE_UPDATES = 0 | 1 If set to @code{1}, MySQL will abort if an @code{UPDATE} or @code{DELETE} is attempted that doesn't use a key or @code{LIMIT} in the @code{WHERE} clause. This makes it possible to catch wrong updates Loading Loading @@ -34893,7 +34893,7 @@ effectiveness. Modifying the default behavior will, in most cases, only make the search results worse. Do not alter the MySQL sources unless you know what you are doing! @itemize @itemize @bullet @item Minimal length of word to be indexed is defined in Loading Loading @@ -42849,7 +42849,7 @@ Unfortunately, we have not yet written full documentation for it - we plan to do this shortly. You can, however, look at our current test cases and use them as an example. The following points should help you get started: @itemize @itemize @bullet @item The tests are located in @code{mysql-test/t/*.test} Loading Loading @@ -46712,6 +46712,12 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.42 @itemize @bullet @item Fixed rare hang when doing @code{mysqladmin shutdown} when there was a lot of activity in other threads. @item Fixed problem with @code{INSERT DELAYED} where delay thread could be hanging on @code{upgrading locks} without any apparent reasons. @item Fixed problem with @code{myisampack} and @code{BLOB}. @item Fixes problem when one edited @code{.MRG} tables by hand. include/my_pthread.h +5 −3 Original line number Diff line number Diff line Loading @@ -575,12 +575,14 @@ extern int pthread_dummy(int); struct st_my_thread_var { int thr_errno; pthread_cond_t suspend, *current_cond; pthread_mutex_t mutex, *current_mutex; pthread_cond_t suspend; pthread_mutex_t mutex; pthread_mutex_t * volatile current_mutex; pthread_cond_t * volatile current_cond; pthread_t pthread_self; long id; int cmp_length; volatile int abort; int volatile abort; #ifndef DBUG_OFF gptr dbug; char name[THREAD_NAME_SIZE+1]; Loading mysys/thr_lock.c +22 −9 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ my_bool init_thr_lock() static uint found_errors=0; static int check_lock(struct st_lock_list *list, const char* lock_type, const char *where, my_bool same_thread) const char *where, my_bool same_thread, bool no_cond) { THR_LOCK_DATA *data,**prev; uint count=0; Loading Loading @@ -148,6 +148,13 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, lock_type,where); return 1; } if (no_cond && data->cond) { fprintf(stderr, "Warning: Found active lock with not reset cond %s: %s\n", lock_type,where); return 1; } prev= &data->next; } if (data) Loading @@ -172,10 +179,10 @@ static void check_locks(THR_LOCK *lock, const char *where, uint old_found_errors=found_errors; if (found_errors < MAX_FOUND_ERRORS) { if (check_lock(&lock->write,"write",where,1) | check_lock(&lock->write_wait,"write_wait",where,0) | check_lock(&lock->read,"read",where,0) | check_lock(&lock->read_wait,"read_wait",where,0)) if (check_lock(&lock->write,"write",where,1,1) | check_lock(&lock->write_wait,"write_wait",where,0,0) | check_lock(&lock->read,"read",where,0,1) | check_lock(&lock->read_wait,"read_wait",where,0,0)) found_errors++; if (found_errors < MAX_FOUND_ERRORS) Loading Loading @@ -326,6 +333,7 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, void *param) data->thread=pthread_self(); data->thread_id=my_thread_id(); /* for debugging */ data->status_param=param; data->cond=0; } Loading Loading @@ -366,16 +374,16 @@ static my_bool wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, } /* Set up control struct to allow others to abort locks */ pthread_mutex_lock(&thread_var->mutex); thread_var->current_mutex= &data->lock->mutex; thread_var->current_cond= cond; pthread_mutex_unlock(&thread_var->mutex); data->cond=cond; do while (!thread_var->abort || in_wait_list) { pthread_cond_wait(cond,&data->lock->mutex); } while (data->cond == cond && (!thread_var->abort || in_wait_list)); if (data->cond != cond) break; } if (data->cond || data->type == TL_UNLOCK) { Loading Loading @@ -416,6 +424,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) DBUG_ENTER("thr_lock"); data->next=0; data->cond=0; /* safety */ data->type=lock_type; data->thread=pthread_self(); /* Must be reset ! */ data->thread_id=my_thread_id(); /* Must be reset ! */ Loading Loading @@ -977,6 +986,10 @@ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data) lock->write_wait.data=data; check_locks(lock,"upgrading lock",0); } else { check_locks(lock,"waiting for lock",0); } DBUG_RETURN(wait_for_lock(&lock->write_wait,data,1)); } Loading sql/item_func.cc +5 −11 Original line number Diff line number Diff line Loading @@ -1500,11 +1500,9 @@ longlong Item_func_get_lock::val_int() /* structure is now initialized. Try to get the lock */ /* Set up control struct to allow others to abort locks */ pthread_mutex_lock(&thd->mysys_var->mutex); thd->proc_info="User lock"; thd->mysys_var->current_mutex= &LOCK_user_locks; thd->mysys_var->current_cond= &ull->cond; pthread_mutex_unlock(&thd->mysys_var->mutex); #ifdef HAVE_TIMESPEC_TS_SEC abstime.ts_sec=time((time_t*) 0)+(time_t) timeout; Loading @@ -1514,15 +1512,11 @@ longlong Item_func_get_lock::val_int() abstime.tv_nsec=0; #endif while ((error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime)) != ETIME && error != ETIMEDOUT && ull->locked) { if (thd->killed || abort_loop) { while (!thd->killed && (error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime)) != ETIME && error != ETIMEDOUT && ull->locked) ; if (thd->killed) error=EINTR; // Return NULL break; } } if (ull->locked) { if (!--ull->count) Loading sql/lock.cc +0 −2 Original line number Diff line number Diff line Loading @@ -65,11 +65,9 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count) } pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&thd->mysys_var->mutex); thd->mysys_var->current_mutex= &LOCK_open; thd->mysys_var->current_cond= &COND_refresh; thd->proc_info="Waiting for table"; pthread_mutex_unlock(&thd->mysys_var->mutex); while (global_read_lock && ! thd->killed && thd->version == refresh_version) Loading Loading
Docs/manual.texi +12 −6 Original line number Diff line number Diff line Loading @@ -7252,7 +7252,7 @@ MySQL. How well a certain platform is suited for a high-load mission critical MySQL server is determined by the following factors: @itemize @itemize @bullet @item General stability of the thread library. A platform may have excellent reputation otherwise, but if the thread library is unstable in the code Loading Loading @@ -7384,7 +7384,7 @@ If you want to configure @code{mysqld} with some extra features that are NOT in the standard binary distributions. Here is a list of the most common extra options that you may want to use: @itemize @itemize @bullet @item @code{--with-berkeley-db} @item @code{--with-innodb} @item @code{--with-raid} Loading Loading @@ -23950,7 +23950,7 @@ to it clean up. You should start by creating a wrapper library /module with the following functions: @itemize @itemize @bullet @item @code{safe_writer_connect()} @item Loading Loading @@ -26902,7 +26902,7 @@ flag again, the @code{SQL_MAX_JOIN_SIZE} variable will be ignored. You can set a default value for this variable by starting @code{mysqld} with @code{-O max_join_size=#}. @item SQL_SAFE_MODE = 0 | 1 @item SQL_SAFE_UPDATES = 0 | 1 If set to @code{1}, MySQL will abort if an @code{UPDATE} or @code{DELETE} is attempted that doesn't use a key or @code{LIMIT} in the @code{WHERE} clause. This makes it possible to catch wrong updates Loading Loading @@ -34893,7 +34893,7 @@ effectiveness. Modifying the default behavior will, in most cases, only make the search results worse. Do not alter the MySQL sources unless you know what you are doing! @itemize @itemize @bullet @item Minimal length of word to be indexed is defined in Loading Loading @@ -42849,7 +42849,7 @@ Unfortunately, we have not yet written full documentation for it - we plan to do this shortly. You can, however, look at our current test cases and use them as an example. The following points should help you get started: @itemize @itemize @bullet @item The tests are located in @code{mysql-test/t/*.test} Loading Loading @@ -46712,6 +46712,12 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.42 @itemize @bullet @item Fixed rare hang when doing @code{mysqladmin shutdown} when there was a lot of activity in other threads. @item Fixed problem with @code{INSERT DELAYED} where delay thread could be hanging on @code{upgrading locks} without any apparent reasons. @item Fixed problem with @code{myisampack} and @code{BLOB}. @item Fixes problem when one edited @code{.MRG} tables by hand.
include/my_pthread.h +5 −3 Original line number Diff line number Diff line Loading @@ -575,12 +575,14 @@ extern int pthread_dummy(int); struct st_my_thread_var { int thr_errno; pthread_cond_t suspend, *current_cond; pthread_mutex_t mutex, *current_mutex; pthread_cond_t suspend; pthread_mutex_t mutex; pthread_mutex_t * volatile current_mutex; pthread_cond_t * volatile current_cond; pthread_t pthread_self; long id; int cmp_length; volatile int abort; int volatile abort; #ifndef DBUG_OFF gptr dbug; char name[THREAD_NAME_SIZE+1]; Loading
mysys/thr_lock.c +22 −9 Original line number Diff line number Diff line Loading @@ -115,7 +115,7 @@ my_bool init_thr_lock() static uint found_errors=0; static int check_lock(struct st_lock_list *list, const char* lock_type, const char *where, my_bool same_thread) const char *where, my_bool same_thread, bool no_cond) { THR_LOCK_DATA *data,**prev; uint count=0; Loading Loading @@ -148,6 +148,13 @@ static int check_lock(struct st_lock_list *list, const char* lock_type, lock_type,where); return 1; } if (no_cond && data->cond) { fprintf(stderr, "Warning: Found active lock with not reset cond %s: %s\n", lock_type,where); return 1; } prev= &data->next; } if (data) Loading @@ -172,10 +179,10 @@ static void check_locks(THR_LOCK *lock, const char *where, uint old_found_errors=found_errors; if (found_errors < MAX_FOUND_ERRORS) { if (check_lock(&lock->write,"write",where,1) | check_lock(&lock->write_wait,"write_wait",where,0) | check_lock(&lock->read,"read",where,0) | check_lock(&lock->read_wait,"read_wait",where,0)) if (check_lock(&lock->write,"write",where,1,1) | check_lock(&lock->write_wait,"write_wait",where,0,0) | check_lock(&lock->read,"read",where,0,1) | check_lock(&lock->read_wait,"read_wait",where,0,0)) found_errors++; if (found_errors < MAX_FOUND_ERRORS) Loading Loading @@ -326,6 +333,7 @@ void thr_lock_data_init(THR_LOCK *lock,THR_LOCK_DATA *data, void *param) data->thread=pthread_self(); data->thread_id=my_thread_id(); /* for debugging */ data->status_param=param; data->cond=0; } Loading Loading @@ -366,16 +374,16 @@ static my_bool wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data, } /* Set up control struct to allow others to abort locks */ pthread_mutex_lock(&thread_var->mutex); thread_var->current_mutex= &data->lock->mutex; thread_var->current_cond= cond; pthread_mutex_unlock(&thread_var->mutex); data->cond=cond; do while (!thread_var->abort || in_wait_list) { pthread_cond_wait(cond,&data->lock->mutex); } while (data->cond == cond && (!thread_var->abort || in_wait_list)); if (data->cond != cond) break; } if (data->cond || data->type == TL_UNLOCK) { Loading Loading @@ -416,6 +424,7 @@ int thr_lock(THR_LOCK_DATA *data,enum thr_lock_type lock_type) DBUG_ENTER("thr_lock"); data->next=0; data->cond=0; /* safety */ data->type=lock_type; data->thread=pthread_self(); /* Must be reset ! */ data->thread_id=my_thread_id(); /* Must be reset ! */ Loading Loading @@ -977,6 +986,10 @@ my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data) lock->write_wait.data=data; check_locks(lock,"upgrading lock",0); } else { check_locks(lock,"waiting for lock",0); } DBUG_RETURN(wait_for_lock(&lock->write_wait,data,1)); } Loading
sql/item_func.cc +5 −11 Original line number Diff line number Diff line Loading @@ -1500,11 +1500,9 @@ longlong Item_func_get_lock::val_int() /* structure is now initialized. Try to get the lock */ /* Set up control struct to allow others to abort locks */ pthread_mutex_lock(&thd->mysys_var->mutex); thd->proc_info="User lock"; thd->mysys_var->current_mutex= &LOCK_user_locks; thd->mysys_var->current_cond= &ull->cond; pthread_mutex_unlock(&thd->mysys_var->mutex); #ifdef HAVE_TIMESPEC_TS_SEC abstime.ts_sec=time((time_t*) 0)+(time_t) timeout; Loading @@ -1514,15 +1512,11 @@ longlong Item_func_get_lock::val_int() abstime.tv_nsec=0; #endif while ((error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime)) != ETIME && error != ETIMEDOUT && ull->locked) { if (thd->killed || abort_loop) { while (!thd->killed && (error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime)) != ETIME && error != ETIMEDOUT && ull->locked) ; if (thd->killed) error=EINTR; // Return NULL break; } } if (ull->locked) { if (!--ull->count) Loading
sql/lock.cc +0 −2 Original line number Diff line number Diff line Loading @@ -65,11 +65,9 @@ MYSQL_LOCK *mysql_lock_tables(THD *thd,TABLE **tables,uint count) } pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&thd->mysys_var->mutex); thd->mysys_var->current_mutex= &LOCK_open; thd->mysys_var->current_cond= &COND_refresh; thd->proc_info="Waiting for table"; pthread_mutex_unlock(&thd->mysys_var->mutex); while (global_read_lock && ! thd->killed && thd->version == refresh_version) Loading