Commit a0d2a621 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Added detection if pthread_attr_getstacksize() exists

Fixed bug in RAND() usage in mysqlbinlog
parent fa195bc8
...@@ -1796,6 +1796,7 @@ AC_CHECK_FUNCS(alarm bmove \ ...@@ -1796,6 +1796,7 @@ AC_CHECK_FUNCS(alarm bmove \
sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \ sigset sigthreadmask pthread_sigmask pthread_setprio pthread_setprio_np \
pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \ pthread_setschedparam pthread_attr_setprio pthread_attr_setschedparam \
pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \ pthread_attr_create pthread_getsequence_np pthread_attr_setstacksize \
pthread_attr_getstacksize \
pthread_condattr_create rwlock_init pthread_rwlock_rdlock \ pthread_condattr_create rwlock_init pthread_rwlock_rdlock \
fchmod getpass getpassphrase initgroups mlockall) fchmod getpass getpassphrase initgroups mlockall)
......
...@@ -43,8 +43,8 @@ enum thr_lock_type { TL_IGNORE=-1, ...@@ -43,8 +43,8 @@ enum thr_lock_type { TL_IGNORE=-1,
*/ */
TL_WRITE_ALLOW_WRITE, TL_WRITE_ALLOW_WRITE,
/* /*
Write lock, but allow other threads to read / write. Write lock, but allow other threads to read.
Used by ALTER TABLE in MySQL to mark to allow readers Used by ALTER TABLE in MySQL to allow readers
to use the table until ALTER TABLE is finished. to use the table until ALTER TABLE is finished.
*/ */
TL_WRITE_ALLOW_READ, TL_WRITE_ALLOW_READ,
......
...@@ -972,14 +972,14 @@ int Rand_log_event::write_data(IO_CACHE* file) ...@@ -972,14 +972,14 @@ int Rand_log_event::write_data(IO_CACHE* file)
#ifdef MYSQL_CLIENT #ifdef MYSQL_CLIENT
void Rand_log_event::print(FILE* file, bool short_form, char* last_db) void Rand_log_event::print(FILE* file, bool short_form, char* last_db)
{ {
char llbuff[22]; char llbuff[22],llbuff2[22];
if (!short_form) if (!short_form)
{ {
print_header(file); print_header(file);
fprintf(file, "\tRand\n"); fprintf(file, "\tRand\n");
} }
fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s;\n", fprintf(file, "SET @@RAND_SEED1=%s, @@RAND_SEED2=%s;\n",
llstr(seed1, llbuff),llstr(seed2, llbuff)); llstr(seed1, llbuff),llstr(seed2, llbuff2));
fflush(file); fflush(file);
} }
#endif #endif
......
...@@ -2099,6 +2099,7 @@ int main(int argc, char **argv) ...@@ -2099,6 +2099,7 @@ int main(int argc, char **argv)
(void) pthread_attr_setdetachstate(&connection_attrib, (void) pthread_attr_setdetachstate(&connection_attrib,
PTHREAD_CREATE_DETACHED); PTHREAD_CREATE_DETACHED);
pthread_attr_setstacksize(&connection_attrib,thread_stack); pthread_attr_setstacksize(&connection_attrib,thread_stack);
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
{ {
/* Retrieve used stack size; Needed for checking stack overflows */ /* Retrieve used stack size; Needed for checking stack overflows */
size_t stack_size; size_t stack_size;
...@@ -2110,6 +2111,7 @@ int main(int argc, char **argv) ...@@ -2110,6 +2111,7 @@ int main(int argc, char **argv)
thread_stack= stack_size; thread_stack= stack_size;
} }
} }
#endif
if (!(opt_specialflag & SPECIAL_NO_PRIOR)) if (!(opt_specialflag & SPECIAL_NO_PRIOR))
my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR); my_pthread_attr_setprio(&connection_attrib,WAIT_PRIOR);
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM); pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
......
...@@ -57,13 +57,13 @@ static int init_failsafe_rpl_thread(THD* thd) ...@@ -57,13 +57,13 @@ static int init_failsafe_rpl_thread(THD* thd)
{ {
DBUG_ENTER("init_failsafe_rpl_thread"); DBUG_ENTER("init_failsafe_rpl_thread");
thd->system_thread = thd->bootstrap = 1; thd->system_thread = thd->bootstrap = 1;
thd->host_or_ip= "";
thd->client_capabilities = 0; thd->client_capabilities = 0;
my_net_init(&thd->net, 0); my_net_init(&thd->net, 0);
thd->net.read_timeout = slave_net_timeout; thd->net.read_timeout = slave_net_timeout;
thd->max_client_packet_length=thd->net.max_packet; thd->max_client_packet_length=thd->net.max_packet;
thd->master_access= ~0; thd->master_access= ~0;
thd->priv_user = 0; thd->priv_user = 0;
thd->system_thread = 1;
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
thd->thread_id = thread_id++; thd->thread_id = thread_id++;
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
......
...@@ -1783,6 +1783,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) ...@@ -1783,6 +1783,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
{ {
DBUG_ENTER("init_slave_thread"); DBUG_ENTER("init_slave_thread");
thd->system_thread = thd->bootstrap = 1; thd->system_thread = thd->bootstrap = 1;
thd->host_or_ip= "";
thd->client_capabilities = 0; thd->client_capabilities = 0;
my_net_init(&thd->net, 0); my_net_init(&thd->net, 0);
thd->net.read_timeout = slave_net_timeout; thd->net.read_timeout = slave_net_timeout;
...@@ -1790,7 +1791,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type) ...@@ -1790,7 +1791,6 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
thd->priv_user = 0; thd->priv_user = 0;
thd->slave_thread = 1; thd->slave_thread = 1;
thd->options = (((opt_log_slave_updates) ? OPTION_BIN_LOG:0) | OPTION_AUTO_IS_NULL) ; thd->options = (((opt_log_slave_updates) ? OPTION_BIN_LOG:0) | OPTION_AUTO_IS_NULL) ;
thd->system_thread = 1;
thd->client_capabilities = CLIENT_LOCAL_FILES; thd->client_capabilities = CLIENT_LOCAL_FILES;
thd->real_id=pthread_self(); thd->real_id=pthread_self();
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
......
...@@ -83,7 +83,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), ...@@ -83,7 +83,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
global_read_lock(0),bootstrap(0) global_read_lock(0),bootstrap(0)
{ {
host=user=priv_user=db=query=ip=0; host=user=priv_user=db=query=ip=0;
host_or_ip="unknown ip"; host_or_ip= "connecting host";
locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password= locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password=
query_start_used=safe_to_cache_query=0; query_start_used=safe_to_cache_query=0;
db_length=query_length=col_access=0; db_length=query_length=col_access=0;
......
...@@ -535,6 +535,7 @@ public: ...@@ -535,6 +535,7 @@ public:
bzero((char*) &thd.net,sizeof(thd.net)); // Safety bzero((char*) &thd.net,sizeof(thd.net)); // Safety
thd.system_thread=1; thd.system_thread=1;
thd.host_or_ip= "";
bzero((char*) &info,sizeof(info)); bzero((char*) &info,sizeof(info));
pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST); pthread_mutex_init(&mutex,MY_MUTEX_INIT_FAST);
pthread_cond_init(&cond,NULL); pthread_cond_init(&cond,NULL);
......
...@@ -1059,10 +1059,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) ...@@ -1059,10 +1059,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
thd_info->user=thd->strdup(tmp->user ? tmp->user : thd_info->user=thd->strdup(tmp->user ? tmp->user :
(tmp->system_thread ? (tmp->system_thread ?
"system user" : "unauthenticated user")); "system user" : "unauthenticated user"));
thd_info->host=thd->strdup(tmp->host ? tmp->host : thd_info->host= thd->strdup(tmp->host_or_ip);
(tmp->ip ? tmp->ip :
(tmp->system_thread ? "none" :
"connecting host")));
if ((thd_info->db=tmp->db)) // Safe test if ((thd_info->db=tmp->db)) // Safe test
thd_info->db=thd->strdup(thd_info->db); thd_info->db=thd->strdup(thd_info->db);
thd_info->command=(int) tmp->command; thd_info->command=(int) tmp->command;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment