224
224
static bool volatile ready_to_exit;
225
225
static bool opt_debugging= 0, opt_console= 0;
226
226
static uint kill_cached_threads, wake_thread;
227
static ulong killed_threads, thread_created;
228
static ulong max_used_connections;
229
static volatile ulong cached_thread_count= 0;
227
static uint32_t killed_threads, thread_created;
228
static uint32_t max_used_connections;
229
static volatile uint32_t cached_thread_count= 0;
230
230
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
231
231
static char *opt_init_slave, *language_ptr, *opt_init_connect;
232
232
static char *default_character_set_name;
296
296
TYPELIB binlog_format_typelib=
297
297
{ array_elements(binlog_format_names) - 1, "",
298
298
binlog_format_names, NULL };
299
ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC;
299
uint32_t opt_binlog_format_id= (uint32_t) BINLOG_FORMAT_UNSPEC;
300
300
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id];
301
301
#ifdef HAVE_INITGROUPS
302
302
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
311
311
ulong back_log, connect_timeout, server_id;
312
312
ulong table_cache_size, table_def_size;
313
313
ulong what_to_log;
314
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
315
ulong open_files_limit, max_binlog_size, max_relay_log_size;
316
ulong slave_net_timeout, slave_trans_retries;
314
ulong slow_launch_time, slave_open_temp_tables;
315
ulong open_files_limit;
316
ulong max_binlog_size;
317
ulong max_relay_log_size;
318
ulong slave_net_timeout;
319
ulong slave_trans_retries;
317
320
bool slave_allow_batching;
318
321
ulong slave_exec_mode_options;
319
322
const char *slave_exec_mode_str= "STRICT";
320
ulong thread_cache_size=0, thread_pool_size= 0;
321
ulong binlog_cache_size=0, max_binlog_cache_size=0;
322
ulong refresh_version; /* Increments on each reload */
323
ulong thread_cache_size= 0;
324
ulong thread_pool_size= 0;
325
ulong binlog_cache_size= 0;
326
ulong max_binlog_cache_size= 0;
327
uint32_t refresh_version; /* Increments on each reload */
323
328
query_id_t global_query_id;
324
ulong aborted_threads, aborted_connects;
326
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
327
ulong max_connections, max_connect_errors;
329
ulong aborted_threads;
330
ulong aborted_connects;
331
ulong specialflag= 0;
332
ulong binlog_cache_use= 0;
333
ulong binlog_cache_disk_use= 0;
334
ulong max_connections;
335
ulong max_connect_errors;
328
336
uint max_user_connections= 0;
329
ulong thread_id=1L,current_pid;
330
ulong slow_launch_threads = 0, sync_binlog_period;
339
ulong slow_launch_threads = 0;
340
ulong sync_binlog_period;
331
341
ulong expire_logs_days = 0;
332
342
ulong rpl_recovery_rank=0;
333
343
const char *log_output_str= "FILE";
459
469
static bool opt_do_pstack;
460
470
#endif /* HAVE_STACK_TRACE_ON_SEGV */
461
471
static int cleanup_done;
462
static ulong opt_myisam_block_size;
472
static uint32_t opt_myisam_block_size;
463
473
static char *opt_binlog_index_name;
464
474
static char *opt_tc_heuristic_recover;
465
475
static char *mysql_home_ptr, *pidfile_name_ptr;
498
508
void handle_connections_sockets();
499
509
pthread_handler_t kill_server_thread(void *arg);
500
510
pthread_handler_t handle_slave(void *arg);
501
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
502
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
511
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib);
512
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
503
513
const char *option);
504
514
static void clean_up(bool print_message);
1446
1456
"will hopefully help diagnose\n"
1447
1457
"the problem, but since we have already crashed, "
1448
1458
"something is definitely wrong\nand this may fail.\n\n"));
1449
fprintf(stderr, "key_buffer_size=%lu\n",
1450
(ulong) dflt_key_cache->key_cache_mem_size);
1459
fprintf(stderr, "key_buffer_size=%u\n",
1460
(uint32_t) dflt_key_cache->key_cache_mem_size);
1451
1461
fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
1452
fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
1462
fprintf(stderr, "max_used_connections=%u\n", max_used_connections);
1453
1463
fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
1454
1464
fprintf(stderr, "thread_count=%u\n", thread_count);
1455
1465
fprintf(stderr, "connection_count=%u\n", connection_count);
1459
1469
"bytes of memory\n"
1460
1470
"Hope that's ok; if not, decrease some variables in the "
1461
1471
"equation.\n\n"),
1462
((ulong) dflt_key_cache->key_cache_mem_size +
1472
((uint32_t) dflt_key_cache->key_cache_mem_size +
1463
1473
(global_system_variables.read_buff_size +
1464
1474
global_system_variables.sortbuff_size) *
1465
1475
thread_scheduler.max_threads +
1503
1513
"Some pointers may be invalid and cause the "
1504
1514
"dump to abort...\n"));
1505
1515
safe_print_str("thd->query", thd->query, 1024);
1506
fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
1516
fprintf(stderr, "thd->thread_id=%lu\n", (uint32_t) thd->thread_id);
1507
1517
fprintf(stderr, "thd->killed=%s\n", kreason);
1509
1519
fflush(stderr);
1719
1729
#ifdef HAVE_STACK_TRACE_ON_SEGV
1720
1730
if (opt_do_pstack)
1722
sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (ulong)getpid());
1732
sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (uint32_t)getpid());
1723
1733
pstack_install_segv_action(pstack_file_name);
1725
1735
#endif /* HAVE_STACK_TRACE_ON_SEGV */
2111
2121
can't get max_connections*5 but still got no less than was
2112
2122
requested (value of wanted_files).
2114
max_open_files= max(max((ulong)wanted_files, max_connections*5),
2124
max_open_files= max(max((uint32_t)wanted_files, max_connections*5),
2115
2125
open_files_limit);
2116
2126
files= my_set_max_open_files(max_open_files);
2123
2133
If we have requested too much file handles than we bring
2124
2134
max_connections in supported bounds.
2126
max_connections= (ulong) min((ulong)files-10-TABLE_OPEN_CACHE_MIN*2,
2136
max_connections= (uint32_t) min((uint32_t)files-10-TABLE_OPEN_CACHE_MIN*2,
2127
2137
max_connections);
2129
2139
Decrease table_cache_size according to max_connections, but
2131
2141
never increase table_cache_size automatically (that could
2132
2142
happen if max_connections is decreased above).
2134
table_cache_size= (ulong) min(max((files-10-max_connections)/2,
2135
(ulong)TABLE_OPEN_CACHE_MIN),
2144
table_cache_size= (uint32_t) min(max((files-10-max_connections)/2,
2145
(uint32_t)TABLE_OPEN_CACHE_MIN),
2136
2146
table_cache_size);
2137
2147
if (global_system_variables.log_warnings)
2138
2148
sql_print_warning(_("Changed limits: max_open_files: %u "
2332
2342
if (table_cache_init() | table_def_init())
2333
2343
unireg_abort(1);
2335
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
2345
randominit(&sql_rand,(uint32_t) server_start_time,(uint32_t) server_start_time/2);
2337
2347
init_thr_lock();
2338
2348
init_slave_list();
5077
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
5087
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
5078
5088
const char *option)
5082
5092
const char **ptr;
5084
if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0)
5094
if ((res= find_bit_type(x, bit_lib)) == ~(uint32_t) 0)
5086
5096
ptr= bit_lib->type_names;
5104
5114
a bitfield from a string of substrings separated by ','
5106
~(ulong) 0 on error.
5116
~(uint32_t) 0 on error.
5109
static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
5119
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib)
5111
5121
bool found_end;
5112
5122
int found_count;
5113
5123
const char *end,*i,*j;
5114
5124
const char **array, *pos;
5115
ulong found,found_int,bit;
5125
uint32_t found,found_int,bit;