Fixed Bug#8042, "mysqld crashes on sighup".

parent e2268e55
...@@ -921,7 +921,7 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length); ...@@ -921,7 +921,7 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length);
void print_plan(JOIN* join, double read_time, double record_count, void print_plan(JOIN* join, double read_time, double record_count,
uint idx, const char *info); uint idx, const char *info);
#endif #endif
void mysql_print_status(THD *thd); void mysql_print_status();
/* key.cc */ /* key.cc */
int find_ref_key(TABLE *form,Field *field, uint *offset); int find_ref_key(TABLE *form,Field *field, uint *offset);
void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length); void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length);
......
...@@ -2143,7 +2143,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused))) ...@@ -2143,7 +2143,7 @@ extern "C" void *signal_hand(void *arg __attribute__((unused)))
case SIGHUP: case SIGHUP:
if (!abort_loop) if (!abort_loop)
{ {
mysql_print_status((THD*) 0); // Print some debug info mysql_print_status(); // Print some debug info
reload_acl_and_cache((THD*) 0, reload_acl_and_cache((THD*) 0,
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST | (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
REFRESH_GRANT | REFRESH_GRANT |
......
...@@ -1992,7 +1992,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1992,7 +1992,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
statistic_increment(thd->status_var.com_other, &LOCK_status); statistic_increment(thd->status_var.com_other, &LOCK_status);
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
break; /* purecov: inspected */ break; /* purecov: inspected */
mysql_print_status(thd); mysql_print_status();
mysql_log.write(thd,command,NullS); mysql_log.write(thd,command,NullS);
send_eof(thd); send_eof(thd);
break; break;
......
...@@ -436,29 +436,24 @@ reads: %10lu\n\n", ...@@ -436,29 +436,24 @@ reads: %10lu\n\n",
} }
void mysql_print_status(THD *thd) void mysql_print_status()
{ {
char current_dir[FN_REFLEN]; char current_dir[FN_REFLEN];
STATUS_VAR tmp;
calc_sum_of_all_status(&tmp);
printf("\nStatus information:\n\n"); printf("\nStatus information:\n\n");
my_getwd(current_dir, sizeof(current_dir),MYF(0)); my_getwd(current_dir, sizeof(current_dir),MYF(0));
printf("Current dir: %s\n", current_dir); printf("Current dir: %s\n", current_dir);
printf("Running threads: %d Stack size: %ld\n", thread_count, printf("Running threads: %d Stack size: %ld\n", thread_count,
(long) thread_stack); (long) thread_stack);
if (thd)
thd->proc_info="locks";
thr_print_locks(); // Write some debug info thr_print_locks(); // Write some debug info
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (thd)
thd->proc_info="table cache";
print_cached_tables(); print_cached_tables();
#endif #endif
/* Print key cache status */ /* Print key cache status */
if (thd)
thd->proc_info="key cache";
puts("\nKey caches:"); puts("\nKey caches:");
process_key_caches(print_key_cache_status); process_key_caches(print_key_cache_status);
if (thd)
thd->proc_info="status";
pthread_mutex_lock(&LOCK_status); pthread_mutex_lock(&LOCK_status);
printf("\nhandler status:\n\ printf("\nhandler status:\n\
read_key: %10lu\n\ read_key: %10lu\n\
...@@ -468,20 +463,20 @@ read_first: %10lu\n\ ...@@ -468,20 +463,20 @@ read_first: %10lu\n\
write: %10lu\n\ write: %10lu\n\
delete %10lu\n\ delete %10lu\n\
update: %10lu\n", update: %10lu\n",
thd->status_var.ha_read_key_count, tmp.ha_read_key_count,
thd->status_var.ha_read_next_count, tmp.ha_read_next_count,
thd->status_var.ha_read_rnd_count, tmp.ha_read_rnd_count,
thd->status_var.ha_read_first_count, tmp.ha_read_first_count,
thd->status_var.ha_write_count, tmp.ha_write_count,
thd->status_var.ha_delete_count, tmp.ha_delete_count,
thd->status_var.ha_update_count); tmp.ha_update_count);
pthread_mutex_unlock(&LOCK_status); pthread_mutex_unlock(&LOCK_status);
printf("\nTable status:\n\ printf("\nTable status:\n\
Opened tables: %10lu\n\ Opened tables: %10lu\n\
Open tables: %10lu\n\ Open tables: %10lu\n\
Open files: %10lu\n\ Open files: %10lu\n\
Open streams: %10lu\n", Open streams: %10lu\n",
thd->status_var.opened_tables, tmp.opened_tables,
(ulong) cached_tables(), (ulong) cached_tables(),
(ulong) my_file_opened, (ulong) my_file_opened,
(ulong) my_stream_opened); (ulong) my_stream_opened);
...@@ -499,8 +494,6 @@ Next alarm time: %lu\n", ...@@ -499,8 +494,6 @@ Next alarm time: %lu\n",
#endif #endif
display_table_locks(); display_table_locks();
fflush(stdout); fflush(stdout);
if (thd)
thd->proc_info="malloc";
my_checkmalloc(); my_checkmalloc();
TERMINATE(stdout); // Write malloc information TERMINATE(stdout); // Write malloc information
...@@ -531,6 +524,4 @@ Estimated memory (with thread stack): %ld\n", ...@@ -531,6 +524,4 @@ Estimated memory (with thread stack): %ld\n",
(long) (thread_count * thread_stack + info.hblkhd + info.arena)); (long) (thread_count * thread_stack + info.hblkhd + info.arena));
#endif #endif
puts(""); puts("");
if (thd)
thd->proc_info=0;
} }
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