210
214
{&Arg_comparator::compare_row, &Arg_comparator::compare_e_row},
211
215
{&Arg_comparator::compare_decimal, &Arg_comparator::compare_e_decimal}};
213
const char *log_output_names[] = { "NONE", "FILE", NULL};
214
static const unsigned int log_output_names_len[]= { 4, 4, 0 };
215
TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"",
217
(unsigned int *) log_output_names_len};
219
217
/* static variables */
221
/* the default log output is log tables */
222
static bool volatile select_thread_in_use, signal_thread_in_use;
219
static bool volatile select_thread_in_use;
223
220
static bool volatile ready_to_exit;
224
static bool opt_debugging= 0, opt_console= 0;
225
static uint32_t kill_cached_threads, wake_thread;
226
static uint32_t killed_threads, thread_created;
227
static uint32_t max_used_connections;
228
static volatile uint32_t cached_thread_count= 0;
229
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
230
static char *opt_init_slave, *language_ptr, *opt_init_connect;
231
static char *default_character_set_name;
232
static char *character_set_filesystem_name;
221
static bool opt_debugging= 0;
222
static uint32_t wake_thread;
223
static uint32_t killed_threads;
224
static char *drizzled_user, *drizzled_chroot;
225
static char *language_ptr;
226
static const char *default_character_set_name;
227
static const char *character_set_filesystem_name;
233
228
static char *lc_time_names_name;
234
static char *my_bind_addr_str;
235
229
static char *default_collation_name;
236
230
static char *default_storage_engine_str;
237
static char compiled_default_collation_name[]= DRIZZLE_DEFAULT_COLLATION_NAME;
238
static I_List<THD> thread_cache;
239
static double long_query_time;
241
static pthread_cond_t COND_thread_cache, COND_flush_thread_cache;
231
static const char *compiled_default_collation_name= "utf8_general_ci";
243
233
/* Global variables */
246
ulong log_output_options;
247
bool opt_log_queries_not_using_indexes= false;
248
bool opt_error_log= 0;
249
bool opt_skip_show_db= false;
250
bool opt_character_set_client_handshake= 1;
251
bool server_id_supplied = 0;
252
bool opt_endinfo, using_udf_functions;
253
236
bool locked_in_memory;
254
bool opt_using_transactions, using_update_log;
255
237
bool volatile abort_loop;
256
238
bool volatile shutdown_in_progress;
257
bool opt_skip_slave_start = 0; ///< If set, slave is not autostarted
258
bool opt_reckless_slave = 0;
259
bool opt_enable_named_pipe= 0;
260
bool opt_local_infile;
261
bool opt_slave_compressed_protocol;
262
bool opt_safe_user_create = 0;
263
bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
264
bool opt_log_slave_updates= 0;
265
static struct pollfd fds[UINT8_MAX];
266
static uint8_t pollfd_count= 0;
239
uint32_t max_used_connections;
240
const string opt_scheduler_default("multi_thread");
241
char *opt_scheduler= NULL;
243
size_t my_thread_stack_size= 65536;
269
Legacy global handlerton. These will be removed (please do not add more).
246
Legacy global plugin::StorageEngine. These will be removed (please do not add more).
271
handlerton *heap_hton;
272
handlerton *myisam_hton;
248
plugin::StorageEngine *heap_engine;
249
plugin::StorageEngine *myisam_engine;
276
bool relay_log_purge;
277
bool opt_secure_auth= false;
278
251
char* opt_secure_file_priv= 0;
279
bool opt_log_slow_admin_statements= 0;
280
bool opt_log_slow_slave_statements= 0;
281
bool opt_old_style_user_limits= 0;
282
bool trust_function_creators= 0;
284
True if there is at least one per-hour limit for some user, so we should
285
check them before each query (and possibly reset counters when hour is
286
changed). False otherwise.
290
ulong opt_binlog_rows_event_max_size;
291
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NULL};
292
TYPELIB binlog_format_typelib=
293
{ array_elements(binlog_format_names) - 1, "",
294
binlog_format_names, NULL };
295
uint32_t opt_binlog_format_id= (uint32_t) BINLOG_FORMAT_UNSPEC;
296
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id];
297
253
#ifdef HAVE_INITGROUPS
298
254
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
300
uint32_t mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
301
uint32_t mysqld_port_timeout;
302
uint32_t delay_key_write_options, protocol_version;
303
uint32_t lower_case_table_names= 1;
258
This needs to be a uint32_t and not a in_port_t because the config system
259
requires a 4-byte integer.
261
uint32_t drizzled_tcp_port;
262
char *drizzled_bind_host;
263
uint32_t drizzled_bind_timeout;
264
std::bitset<12> test_flags;
265
uint32_t dropping_tables, ha_open_options;
304
266
uint32_t tc_heuristic_recover= 0;
305
uint32_t volatile thread_count, thread_running;
306
uint64_t thd_startup_options;
307
ulong back_log, connect_timeout, server_id;
308
ulong table_cache_size, table_def_size;
310
ulong slow_launch_time, slave_open_temp_tables;
311
ulong open_files_limit;
312
ulong max_binlog_size;
313
ulong max_relay_log_size;
314
ulong slave_net_timeout;
315
ulong slave_trans_retries;
316
bool slave_allow_batching;
317
ulong slave_exec_mode_options;
318
const char *slave_exec_mode_str= "STRICT";
319
ulong thread_cache_size= 0;
320
ulong thread_pool_size= 0;
321
ulong binlog_cache_size= 0;
322
ulong max_binlog_cache_size= 0;
323
uint32_t refresh_version; /* Increments on each reload */
324
query_id_t global_query_id;
325
ulong aborted_threads;
326
ulong aborted_connects;
327
ulong specialflag= 0;
328
ulong binlog_cache_use= 0;
329
ulong binlog_cache_disk_use= 0;
330
ulong max_connections;
331
ulong max_connect_errors;
332
uint32_t max_user_connections= 0;
335
ulong slow_launch_threads = 0;
336
ulong sync_binlog_period;
337
ulong expire_logs_days = 0;
338
ulong rpl_recovery_rank=0;
339
const char *log_output_str= "FILE";
267
uint64_t session_startup_options;
270
uint64_t table_cache_size;
271
uint64_t table_def_size;
272
uint64_t aborted_threads;
273
uint64_t aborted_connects;
274
uint64_t max_connect_errors;
275
uint32_t global_thread_id= 1UL;
341
278
const double log_10[] = {
342
279
1e000, 1e001, 1e002, 1e003, 1e004, 1e005, 1e006, 1e007, 1e008, 1e009,
403
336
my_decimal decimal_zero;
404
337
/* classes for comparation parsing/processing */
405
Eq_creator eq_creator;
406
Ne_creator ne_creator;
407
Gt_creator gt_creator;
408
Lt_creator lt_creator;
409
Ge_creator ge_creator;
410
Le_creator le_creator;
412
339
FILE *stderror_file=0;
415
I_List<NAMED_LIST> key_caches;
416
Rpl_filter* rpl_filter;
417
Rpl_filter* binlog_filter;
341
vector<Session*> session_list;
419
343
struct system_variables global_system_variables;
420
344
struct system_variables max_system_variables;
421
345
struct system_status_var global_status_var;
423
MY_TMPDIR mysql_tmpdir_list;
426
347
const CHARSET_INFO *system_charset_info, *files_charset_info ;
427
const CHARSET_INFO *national_charset_info, *table_alias_charset;
348
const CHARSET_INFO *table_alias_charset;
428
349
const CHARSET_INFO *character_set_filesystem;
430
351
MY_LOCALE *my_default_lc_time_names;
432
353
SHOW_COMP_OPTION have_symlink;
433
SHOW_COMP_OPTION have_compress;
435
355
/* Thread specific variables */
437
pthread_key(MEM_ROOT**,THR_MALLOC);
438
pthread_key(THD*, THR_THD);
439
pthread_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_thread_count,
440
LOCK_status, LOCK_global_read_lock,
441
LOCK_error_log, LOCK_uuid_generator,
442
LOCK_global_system_variables,
443
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
444
LOCK_connection_count;
357
pthread_key_t THR_Mem_root;
358
pthread_key_t THR_Session;
359
pthread_mutex_t LOCK_create_db;
360
pthread_mutex_t LOCK_open;
361
pthread_mutex_t LOCK_thread_count;
362
pthread_mutex_t LOCK_status;
363
pthread_mutex_t LOCK_global_read_lock;
364
pthread_mutex_t LOCK_global_system_variables;
446
rw_lock_t LOCK_sys_init_connect, LOCK_sys_init_slave;
447
rw_lock_t LOCK_system_variables_hash;
366
pthread_rwlock_t LOCK_system_variables_hash;
448
367
pthread_cond_t COND_refresh, COND_thread_count, COND_global_read_lock;
449
368
pthread_t signal_thread;
450
pthread_attr_t connection_attrib;
451
pthread_cond_t COND_server_started;
453
/* replication parameters, if master_host is not NULL, we are a slave */
454
uint32_t report_port= DRIZZLE_PORT;
455
uint32_t master_retry_count= 0;
456
char *master_info_file;
457
char *relay_log_info_file, *report_user, *report_password, *report_host;
458
char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
369
pthread_cond_t COND_server_end;
461
371
/* Static variables */
463
static bool kill_in_progress, segfaulted;
373
static bool segfaulted;
464
374
#ifdef HAVE_STACK_TRACE_ON_SEGV
465
375
static bool opt_do_pstack;
466
376
#endif /* HAVE_STACK_TRACE_ON_SEGV */
467
static int cleanup_done;
468
static uint32_t opt_myisam_block_size;
469
static char *opt_binlog_index_name;
470
static char *opt_tc_heuristic_recover;
471
static char *mysql_home_ptr, *pidfile_name_ptr;
378
static char *drizzle_home_ptr, *pidfile_name_ptr;
472
379
static int defaults_argc;
473
380
static char **defaults_argv;
474
static char *opt_bin_logname;
476
struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD()
478
382
struct passwd *user_info;
479
383
static pthread_t select_thread;
480
384
static uint32_t thr_kill_signal;
482
/* OS specific variables */
484
bool mysqld_embedded=0;
486
scheduler_functions thread_scheduler;
489
387
Number of currently active user connections. The variable is protected by
490
LOCK_connection_count.
492
uint32_t connection_count= 0;
390
drizzled::atomic<uint32_t> connection_count;
393
Refresh value. We use to test this to find out if a refresh even has happened recently.
395
drizzled::atomic<uint32_t> refresh_version; /* Increments on each reload */
494
397
/* Function declarations */
398
bool drizzle_rm_tmp_tables();
496
pthread_handler_t signal_hand(void *arg);
497
static void mysql_init_variables(void);
400
extern "C" pthread_handler_t signal_hand(void *arg);
401
static void drizzle_init_variables(void);
498
402
static void get_options(int *argc,char **argv);
499
extern "C" bool mysqld_get_one_option(int, const struct my_option *, char *);
500
static void set_server_version(void);
403
extern "C" bool drizzled_get_one_option(int, const struct my_option *, char *);
501
404
static int init_thread_environment();
502
static char *get_relative_path(const char *path);
405
static const char *get_relative_path(const char *path);
503
406
static void fix_paths(void);
504
void handle_connections_sockets();
505
pthread_handler_t kill_server_thread(void *arg);
506
pthread_handler_t handle_slave(void *arg);
507
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib);
508
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
407
extern "C" pthread_handler_t handle_slave(void *arg);
510
408
static void clean_up(bool print_message);
512
410
static void usage(void);
513
static void start_signal_handler(void);
514
static void close_server_sock();
515
411
static void clean_up_mutexes(void);
516
static void wait_for_signal_thread_to_end(void);
517
static void create_pid_file();
518
static void mysqld_exit(int exit_code) __attribute__((noreturn));
412
extern "C" void end_thread_signal(int );
413
void close_connections(void);
414
extern "C" void print_signal_warning(int sig);
520
416
/****************************************************************************
521
** Code to end mysqld
417
** Code to end drizzled
522
418
****************************************************************************/
524
static void close_connections(void)
420
void close_connections(void)
530
/* Clear thread cache */
531
kill_cached_threads++;
532
flush_thread_cache();
422
/* Abort listening to new connections */
423
plugin::Listen::shutdown();
534
425
/* kill connection thread */
535
426
(void) pthread_mutex_lock(&LOCK_thread_count);
539
430
struct timespec abstime;
542
#ifndef DONT_USE_THR_ALARM
543
if (pthread_kill(select_thread, thr_client_alarm))
544
break; // allready dead
546
433
set_timespec(abstime, 2);
547
434
for (uint32_t tmp=0 ; tmp < 10 && select_thread_in_use; tmp++)
549
error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count,
436
error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count, &abstime);
551
437
if (error != EINTR)
555
if (error != 0 && !count++)
556
sql_print_error(_("Got error %d from pthread_cond_timedwait"),error);
560
441
(void) pthread_mutex_unlock(&LOCK_thread_count);
563
/* Abort listening to new connections */
567
for (x= 0; x < pollfd_count; x++)
571
(void) shutdown(fds[x].fd, SHUT_RDWR);
572
(void) close(fds[x].fd);
578
end_thr_alarm(0); // Abort old alarms.
581
445
First signal all threads that it's time to die
582
446
This will give the threads some time to gracefully abort their
583
447
statements and inform their clients that the server is about to die.
587
452
(void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
589
I_List_iterator<THD> it(threads);
454
for( vector<Session*>::iterator it= session_list.begin(); it != session_list.end(); ++it )
592
/* We skip slave threads & scheduler on this first loop through. */
593
if (tmp->slave_thread)
596
tmp->killed= THD::KILL_CONNECTION;
597
thread_scheduler.post_kill_notification(tmp);
457
tmp->killed= Session::KILL_CONNECTION;
458
tmp->scheduler->killSession(tmp);
459
DRIZZLE_CONNECTION_DONE(tmp->thread_id);
598
460
if (tmp->mysys_var)
600
462
tmp->mysys_var->abort=1;
601
463
pthread_mutex_lock(&tmp->mysys_var->mutex);
602
464
if (tmp->mysys_var->current_cond)
604
pthread_mutex_lock(tmp->mysys_var->current_mutex);
605
pthread_cond_broadcast(tmp->mysys_var->current_cond);
606
pthread_mutex_unlock(tmp->mysys_var->current_mutex);
466
pthread_mutex_lock(tmp->mysys_var->current_mutex);
467
pthread_cond_broadcast(tmp->mysys_var->current_cond);
468
pthread_mutex_unlock(tmp->mysys_var->current_mutex);
608
470
pthread_mutex_unlock(&tmp->mysys_var->mutex);
611
473
(void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list
616
sleep(2); // Give threads time to die
475
if (connection_count)
476
sleep(2); // Give threads time to die
619
479
Force remaining threads to die by closing the connection to the client
620
480
This will ensure that threads that are waiting for a command from the
621
481
client on a blocking read call are aborted.
626
485
(void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
627
if (!(tmp=threads.get()))
486
if (session_list.empty())
629
488
(void) pthread_mutex_unlock(&LOCK_thread_count);
634
if (global_system_variables.log_warnings)
635
sql_print_warning(ER(ER_FORCING_CLOSE),my_progname,
637
(tmp->main_security_ctx.user ?
638
tmp->main_security_ctx.user : ""));
639
close_connection(tmp,0,0);
491
tmp= session_list.front();
641
492
(void) pthread_mutex_unlock(&LOCK_thread_count);
643
/* All threads has now been aborted */
644
(void) pthread_mutex_lock(&LOCK_thread_count);
647
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
649
(void) pthread_mutex_unlock(&LOCK_thread_count);
655
static void close_server_sock()
657
#ifdef HAVE_CLOSE_SERVER_SOCK
661
for (x= 0; x < pollfd_count; x++)
665
(void) shutdown(fds[x].fd, SHUT_RDWR);
666
(void) close(fds[x].fd);
675
void kill_mysql(void)
678
#if defined(SIGNALS_DONT_BREAK_READ)
679
abort_loop=1; // Break connection loops
680
close_server_sock(); // Force accept to wake up
683
#if defined(HAVE_PTHREAD_KILL)
684
pthread_kill(signal_thread, DRIZZLE_KILL_SIGNAL);
685
#elif !defined(SIGNALS_DONT_BREAK_READ)
686
kill(current_pid, DRIZZLE_KILL_SIGNAL);
688
shutdown_in_progress=1; // Safety if kill didn't work
689
#ifdef SIGNALS_DONT_BREAK_READ
690
if (!kill_in_progress)
694
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
696
sql_print_error(_("Can't create thread to kill server"));
703
Force server down. Kill all connections and threads and exit.
705
@param sig_ptr Signal number that caused kill_server to be called.
708
A signal number of 0 mean that the function was not called
709
from a signal handler and there is thus no signal to block
710
or stop, we just want to kill the server.
713
static void *kill_server(void *sig_ptr)
714
#define RETURN_FROM_KILL_SERVER return(0)
716
int sig=(int) (long) sig_ptr; // This is passed a int
717
// if there is a signal during the kill in progress, ignore the other
718
if (kill_in_progress) // Safety
719
RETURN_FROM_KILL_SERVER;
720
kill_in_progress=true;
721
abort_loop=1; // This should be set
722
if (sig != 0) // 0 is not a valid signal number
723
my_sigset(sig, SIG_IGN); /* purify inspected */
724
if (sig == DRIZZLE_KILL_SIGNAL || sig == 0)
725
sql_print_information(_(ER(ER_NORMAL_SHUTDOWN)),my_progname);
727
sql_print_error(_(ER(ER_GOT_SIGNAL)),my_progname,sig); /* purecov: inspected */
730
if (sig != DRIZZLE_KILL_SIGNAL &&
732
unireg_abort(1); /* purecov: inspected */
736
/* purecov: begin deadcode */
742
RETURN_FROM_KILL_SERVER;
746
#if defined(USE_ONE_SIGNAL_HAND)
747
pthread_handler_t kill_server_thread(void *arg __attribute__((unused)))
749
my_thread_init(); // Initialize new thread
751
/* purecov: begin deadcode */
760
extern "C" RETSIGTYPE print_signal_warning(int sig)
493
tmp->client->close();
498
void print_signal_warning(int sig)
762
500
if (global_system_variables.log_warnings)
763
sql_print_warning(_("Got signal %d from thread %lud"), sig,my_thread_id());
501
errmsg_printf(ERRMSG_LVL_WARN, _("Got signal %d from thread %"PRIu64), sig,my_thread_id());
764
502
#ifndef HAVE_BSD_SIGNALS
765
503
my_sigset(sig,print_signal_warning); /* int. thread system calls */
1077
745
/** Change root user if started with @c --chroot . */
1078
746
static void set_root(const char *path)
1080
if (chroot(path) == -1)
748
if ((chroot(path) == -1) || !chdir("/"))
1082
750
sql_perror("chroot");
1083
751
unireg_abort(1);
1085
my_setwd("/", MYF(0));
1089
static void network_init(void)
1095
char port_buf[NI_MAXSERV];
1096
struct addrinfo *ai;
1097
struct addrinfo *next;
1098
struct addrinfo hints;
1101
if (thread_scheduler.init())
1102
unireg_abort(1); /* purecov: inspected */
1106
memset(fds, 0, sizeof(struct pollfd) * UINT8_MAX);
1107
memset(&hints, 0, sizeof (hints));
1108
hints.ai_flags= AI_PASSIVE;
1109
hints.ai_socktype= SOCK_STREAM;
1111
snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port);
1112
error= getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai);
1115
sql_perror(ER(ER_IPSOCK_ERROR)); /* purecov: tested */
1116
unireg_abort(1); /* purecov: tested */
1119
for (next= ai, pollfd_count= 0; next; next= next->ai_next, pollfd_count++)
1123
ip_sock= socket(next->ai_family, next->ai_socktype, next->ai_protocol);
1127
sql_perror(ER(ER_IPSOCK_ERROR)); /* purecov: tested */
1128
unireg_abort(1); /* purecov: tested */
1131
fds[pollfd_count].fd= ip_sock;
1132
fds[pollfd_count].events= POLLIN | POLLERR;
1134
/* Add options for our listening socket */
1137
struct linger ling = {0, 0};
1141
if (next->ai_family == AF_INET6)
1143
error= setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &flags, sizeof(flags));
1146
perror("setsockopt");
1151
error= setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&flags, sizeof(flags));
1154
perror("setsockopt");
1157
error= setsockopt(ip_sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
1160
perror("setsockopt");
1163
error= setsockopt(ip_sock, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
1166
perror("setsockopt");
1169
error= setsockopt(ip_sock, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags));
1172
perror("setsockopt");
1179
Sometimes the port is not released fast enough when stopping and
1180
restarting the server. This happens quite often with the test suite
1181
on busy Linux systems. Retry to bind the address at these intervals:
1182
Sleep intervals: 1, 2, 4, 6, 9, 13, 17, 22, ...
1183
Retry at second: 1, 3, 7, 13, 22, 35, 52, 74, ...
1184
Limit the sequence by mysqld_port_timeout (set --port-open-timeout=#).
1186
for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
1188
if (((ret= bind(ip_sock, next->ai_addr, next->ai_addrlen)) >= 0 ) ||
1189
(errno != EADDRINUSE) ||
1190
(waited >= mysqld_port_timeout))
1192
sql_print_information(_("Retrying bind on TCP/IP port %u"), mysqld_port);
1193
this_wait= retry * retry / 3 + 1;
1198
sql_perror(_("Can't start server: Bind on TCP/IP port"));
1199
sql_print_error(_("Do you already have another drizzled server running "
1200
"on port: %d ?"),mysqld_port);
1203
if (listen(ip_sock,(int) back_log) < 0)
1205
sql_perror(_("Can't start server: listen() on TCP/IP port"));
1206
sql_print_error(_("listen() on TCP/IP failed with error %d"),
1219
@param thd Thread handle
1220
@param errcode Error code to print to console
1221
@param lock 1 if we have have to lock LOCK_thread_count
1224
For the connection that is doing shutdown, this is called twice
1226
void close_connection(THD *thd, uint32_t errcode, bool lock)
1230
(void) pthread_mutex_lock(&LOCK_thread_count);
1231
thd->killed= THD::KILL_CONNECTION;
1232
if ((vio= thd->net.vio) != 0)
1235
net_send_error(thd, errcode, ER(errcode)); /* purecov: inspected */
1236
net_close(&(thd->net)); /* vio is freed in delete thd */
1239
(void) pthread_mutex_unlock(&LOCK_thread_count);
1244
756
/** Called when a thread is aborted. */
1246
extern "C" RETSIGTYPE end_thread_signal(int sig __attribute__((unused)))
757
void end_thread_signal(int )
1248
THD *thd=current_thd;
1249
if (thd && ! thd->bootstrap)
759
Session *session=current_session;
1251
762
statistic_increment(killed_threads, &LOCK_status);
1252
thread_scheduler.end_thread(thd,0); /* purecov: inspected */
763
session->scheduler->killSessionNow(session);
764
DRIZZLE_CONNECTION_DONE(session->thread_id);
1254
return;; /* purecov: deadcode */
1259
Unlink thd from global list of available connections and free thd
771
Unlink session from global list of available connections and free session
775
session Thread handler
1266
778
LOCK_thread_count is locked and left locked
1269
void unlink_thd(THD *thd)
1273
pthread_mutex_lock(&LOCK_connection_count);
1275
pthread_mutex_unlock(&LOCK_connection_count);
1277
(void) pthread_mutex_lock(&LOCK_thread_count);
1285
Store thread in cache for reuse by new connections
1291
LOCK_thread_count has to be locked
1294
0 Thread was not put in cache
1295
1 Thread is to be reused by new connection.
1296
(ie, caller should return, not abort with pthread_exit())
1300
static bool cache_thread()
1302
safe_mutex_assert_owner(&LOCK_thread_count);
1303
if (cached_thread_count < thread_cache_size &&
1304
! abort_loop && !kill_cached_threads)
1306
/* Don't kill the thread, just put it in cache for reuse */
1307
cached_thread_count++;
1308
while (!abort_loop && ! wake_thread && ! kill_cached_threads)
1309
(void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count);
1310
cached_thread_count--;
1311
if (kill_cached_threads)
1312
pthread_cond_signal(&COND_flush_thread_cache);
1317
thd= thread_cache.get();
1318
thd->thread_stack= (char*) &thd; // For store_globals
1319
(void) thd->store_globals();
1321
THD::mysys_var::abort is associated with physical thread rather
1322
than with THD object. So we need to reset this flag before using
1323
this thread for handling of new THD object/connection.
1325
thd->mysys_var->abort= 0;
1326
thd->thr_create_utime= my_micro_time();
1327
threads.append(thd);
1336
End thread for the current connection
1339
one_thread_per_connection_end()
1341
put_in_cache Store thread in cache, if there is room in it
1342
Normally this is true in all cases except when we got
1343
out of resources initializing the current thread
1346
If thread is cached, we will wait until thread is scheduled to be
1347
reused and then we will return.
1348
If thread is not cached, we end the thread.
1351
0 Signal to handle_one_connection to reuse connection
1354
bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
1358
put_in_cache= cache_thread();
1359
pthread_mutex_unlock(&LOCK_thread_count);
1361
return(0); // Thread is reused
1363
/* It's safe to broadcast outside a lock (COND... is not deleted here) */
1365
(void) pthread_cond_broadcast(&COND_thread_count);
1368
return(0); // Impossible
1372
void flush_thread_cache()
1374
(void) pthread_mutex_lock(&LOCK_thread_count);
1375
kill_cached_threads++;
1376
while (cached_thread_count)
1378
pthread_cond_broadcast(&COND_thread_cache);
1379
pthread_cond_wait(&COND_flush_thread_cache,&LOCK_thread_count);
1381
kill_cached_threads--;
781
void unlink_session(Session *session)
787
(void) pthread_mutex_lock(&LOCK_thread_count);
788
pthread_mutex_lock(&session->LOCK_delete);
790
session_list.erase(remove(session_list.begin(),
1382
795
(void) pthread_mutex_unlock(&LOCK_thread_count);
1642
static void start_signal_handler(void)
1645
pthread_attr_t thr_attr;
1647
(void) pthread_attr_init(&thr_attr);
1648
pthread_attr_setscope(&thr_attr, PTHREAD_SCOPE_SYSTEM);
1649
(void) pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED);
1651
struct sched_param tmp_sched_param;
1653
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
1654
tmp_sched_param.sched_priority= INTERRUPT_PRIOR;
1655
(void)pthread_attr_setschedparam(&thr_attr, &tmp_sched_param);
1657
#if defined(__ia64__) || defined(__ia64)
1659
Peculiar things with ia64 platforms - it seems we only have half the
1660
stack size in reality, so we have to double it here
1662
pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2);
1664
pthread_attr_setstacksize(&thr_attr,my_thread_stack_size);
1666
(void) pthread_mutex_lock(&LOCK_thread_count);
1667
if ((error=pthread_create(&signal_thread,&thr_attr,signal_hand,0)))
1669
sql_print_error(_("Can't create interrupt-thread (error %d, errno: %d)"),
1673
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
1674
pthread_mutex_unlock(&LOCK_thread_count);
1676
(void) pthread_attr_destroy(&thr_attr);
1681
/** This threads handles all signals and alarms. */
1683
pthread_handler_t signal_hand(void *arg __attribute__((unused)))
1687
my_thread_init(); // Init new thread
1688
signal_thread_in_use= 1;
1692
This should actually be '+ max_number_of_slaves' instead of +10,
1693
but the +10 should be quite safe.
1695
init_thr_alarm(thread_scheduler.max_threads + 10);
1696
if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT))
1698
(void) sigemptyset(&set); // Setup up SIGINT for debug
1699
(void) sigaddset(&set,SIGINT); // For debugging
1700
(void) pthread_sigmask(SIG_UNBLOCK,&set,NULL);
1702
(void) sigemptyset(&set); // Setup up SIGINT for debug
1703
#ifdef USE_ONE_SIGNAL_HAND
1704
(void) sigaddset(&set,THR_SERVER_ALARM); // For alarms
1706
#ifndef IGNORE_SIGHUP_SIGQUIT
1707
(void) sigaddset(&set,SIGQUIT);
1708
(void) sigaddset(&set,SIGHUP);
1710
(void) sigaddset(&set,SIGTERM);
1711
(void) sigaddset(&set,SIGTSTP);
1713
/* Save pid to this process (or thread on Linux) */
1716
#ifdef HAVE_STACK_TRACE_ON_SEGV
1719
sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (uint32_t)getpid());
1720
pstack_install_segv_action(pstack_file_name);
1722
#endif /* HAVE_STACK_TRACE_ON_SEGV */
1725
signal to start_signal_handler that we are ready
1726
This works by waiting for start_signal_handler to free mutex,
1727
after which we signal it that we are ready.
1728
At this pointer there is no other threads running, so there
1729
should not be any other pthread_cond_signal() calls.
1731
(void) pthread_mutex_lock(&LOCK_thread_count);
1732
(void) pthread_mutex_unlock(&LOCK_thread_count);
1733
(void) pthread_cond_broadcast(&COND_thread_count);
1735
(void) pthread_sigmask(SIG_BLOCK,&set,NULL);
1738
int error; // Used when debugging
1739
if (shutdown_in_progress && !abort_loop)
1745
while ((error=my_sigwait(&set,&sig)) == EINTR) ;
1749
signal_thread_in_use= 0;
1750
pthread_exit(0); // Safety
1757
sql_print_information(_("Got signal %d to shutdown mysqld"),sig);
1759
/* switch to the old log message processing */
1762
abort_loop=1; // mark abort for threads
1763
#ifdef USE_ONE_SIGNAL_HAND
1766
struct sched_param tmp_sched_param;
1768
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
1769
tmp_sched_param.sched_priority= INTERRUPT_PRIOR;
1770
(void)pthread_attr_setschedparam(&connection_attrib, &tmp_sched_param);
1772
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
1774
sql_print_error(_("Can't create thread to kill server"));
1776
kill_server((void*) sig); // MIT THREAD has a alarm thread
1784
reload_cache((THD*) 0,
1785
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
1787
REFRESH_THREADS | REFRESH_HOSTS),
1788
(TableList*) 0, ¬_used); // Flush logs
1791
#ifdef USE_ONE_SIGNAL_HAND
1792
case THR_SERVER_ALARM:
1793
process_alarm(sig); // Trigger alarms.
1798
sql_print_warning(_("Got signal: %d error: %d"),sig,error); /* purecov: tested */
1800
break; /* purecov: tested */
1803
return(0); /* purecov: deadcode */
1806
static void check_data_home(const char *path __attribute__((unused)))
1051
static void check_data_home(const char *)
1813
1056
All global error messages are sent here where the first one is stored
1819
1062
void my_message_sql(uint32_t error, const char *str, myf MyFlags)
1823
1066
Put here following assertion when situation with EE_* error codes
1826
if ((thd= current_thd))
1069
if ((session= current_session))
1828
1071
if (MyFlags & ME_FATALERROR)
1829
thd->is_fatal_error= 1;
1072
session->is_fatal_error= 1;
1832
TODO: There are two exceptions mechanism (THD and sp_rcontext),
1075
TODO: There are two exceptions mechanism (Session and sp_rcontext),
1833
1076
this could be improved by having a common stack of handlers.
1835
if (thd->handle_error(error, str,
1078
if (session->handle_error(error, str,
1836
1079
DRIZZLE_ERROR::WARN_LEVEL_ERROR))
1839
thd->is_slave_error= 1; // needed to catch query errors during replication
1842
thd->lex->current_select == 0 if lex structure is not inited
1083
session->lex->current_select == 0 if lex structure is not inited
1843
1084
(not query command (COM_QUERY))
1845
if (! (thd->lex->current_select &&
1846
thd->lex->current_select->no_error && !thd->is_fatal_error))
1086
if (! (session->lex->current_select &&
1087
session->lex->current_select->no_error && !session->is_fatal_error))
1848
if (! thd->main_da.is_error()) // Return only first message
1089
if (! session->main_da.is_error()) // Return only first message
1850
1091
if (error == 0)
1851
1092
error= ER_UNKNOWN_ERROR;
1852
1093
if (str == NULL)
1853
1094
str= ER(error);
1854
thd->main_da.set_error_status(thd, error, str);
1095
session->main_da.set_error_status(error, str);
1858
if (!thd->no_warnings_for_error && !thd->is_fatal_error)
1099
if (!session->no_warnings_for_error && !session->is_fatal_error)
1861
1102
Suppress infinite recursion if there a memory allocation error
1862
1103
inside push_warning.
1864
thd->no_warnings_for_error= true;
1865
push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR, error, str);
1866
thd->no_warnings_for_error= false;
1105
session->no_warnings_for_error= true;
1106
push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_ERROR, error, str);
1107
session->no_warnings_for_error= false;
1869
if (!thd || MyFlags & ME_NOREFRESH)
1870
sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */
1875
extern "C" void *my_str_malloc_mysqld(size_t size);
1876
extern "C" void my_str_free_mysqld(void *ptr);
1878
void *my_str_malloc_mysqld(size_t size)
1880
return my_malloc(size, MYF(MY_FAE));
1884
void my_str_free_mysqld(void *ptr)
1886
free((unsigned char*)ptr);
1110
if (!session || MyFlags & ME_NOREFRESH)
1111
errmsg_printf(ERRMSG_LVL_ERROR, "%s: %s",my_progname,str);
1890
1115
static const char *load_default_groups[]= {
1891
"mysqld","server", DRIZZLE_BASE_VERSION, 0, 0};
1895
Initialize one of the global date/time format variables.
1897
@param format_type What kind of format should be supported
1898
@param var_ptr Pointer to variable that should be updated
1901
The default value is taken from either opt_date_time_formats[] or
1902
the ISO format (ANSI SQL)
1910
static bool init_global_datetime_format(enum enum_drizzle_timestamp_type format_type,
1911
DATE_TIME_FORMAT **var_ptr)
1913
/* Get command line option */
1914
const char *str= opt_date_time_formats[format_type];
1916
if (!str) // No specified format
1918
str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT],
1921
Set the "command line" option to point to the generated string so
1922
that we can set global formats back to default
1924
opt_date_time_formats[format_type]= str;
1926
if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
1928
fprintf(stderr, _("Wrong date/time format specifier: %s\n"), str);
1116
DRIZZLE_CONFIG_NAME, "server", 0, 0};
1934
1118
SHOW_VAR com_status_vars[]= {
1935
1119
{"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
1936
{"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS},
1937
{"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
1938
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
1939
{"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
1940
{"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
1941
{"binlog", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS},
1942
{"change_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS},
1943
{"change_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_MASTER]), SHOW_LONG_STATUS},
1944
{"check", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECK]), SHOW_LONG_STATUS},
1945
{"checksum", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS},
1946
{"commit", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_COMMIT]), SHOW_LONG_STATUS},
1947
{"create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_DB]), SHOW_LONG_STATUS},
1948
{"create_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS},
1949
{"create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS},
1950
{"delete", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE]), SHOW_LONG_STATUS},
1951
{"delete_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE_MULTI]), SHOW_LONG_STATUS},
1952
{"drop_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_DB]), SHOW_LONG_STATUS},
1953
{"drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS},
1954
{"drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS},
1955
{"empty_query", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EMPTY_QUERY]), SHOW_LONG_STATUS},
1956
{"flush", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_FLUSH]), SHOW_LONG_STATUS},
1957
{"insert", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT]), SHOW_LONG_STATUS},
1958
{"insert_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT_SELECT]), SHOW_LONG_STATUS},
1959
{"kill", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_KILL]), SHOW_LONG_STATUS},
1960
{"load", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD]), SHOW_LONG_STATUS},
1961
{"lock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOCK_TABLES]), SHOW_LONG_STATUS},
1962
{"optimize", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS},
1963
{"purge", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS},
1964
{"purge_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS},
1965
{"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS},
1966
{"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS},
1967
{"repair", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPAIR]), SHOW_LONG_STATUS},
1968
{"replace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]), SHOW_LONG_STATUS},
1969
{"replace_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS},
1970
{"reset", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]), SHOW_LONG_STATUS},
1971
{"rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS},
1972
{"rollback_to_savepoint",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS},
1973
{"savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
1974
{"select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS},
1975
{"set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
1976
{"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
1977
{"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
1978
{"show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
1979
{"show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
1980
{"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
1981
{"show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
1982
{"show_databases", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS},
1983
{"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS},
1984
{"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
1985
{"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
1986
{"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
1987
{"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
1988
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
1989
{"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
1990
{"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
1991
{"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
1992
{"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
1993
{"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
1994
{"show_table_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
1995
{"show_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS},
1996
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
1997
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
1998
{"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
1999
{"slave_stop", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
2000
{"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS},
2001
{"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
2002
{"update", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
2003
{"update_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE_MULTI]), SHOW_LONG_STATUS},
2004
{NULL, NULL, SHOW_LONG}
1120
{"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
1121
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
1122
{"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
1123
{"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
1124
{"change_db", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS},
1125
{"check", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_CHECK]), SHOW_LONG_STATUS},
1126
{"checksum", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS},
1127
{"commit", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_COMMIT]), SHOW_LONG_STATUS},
1128
{"create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_CREATE_DB]), SHOW_LONG_STATUS},
1129
{"create_index", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS},
1130
{"create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS},
1131
{"delete", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_DELETE]), SHOW_LONG_STATUS},
1132
{"drop_db", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_DROP_DB]), SHOW_LONG_STATUS},
1133
{"drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS},
1134
{"drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS},
1135
{"empty_query", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_EMPTY_QUERY]), SHOW_LONG_STATUS},
1136
{"flush", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_FLUSH]), SHOW_LONG_STATUS},
1137
{"insert", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_INSERT]), SHOW_LONG_STATUS},
1138
{"insert_select", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_INSERT_SELECT]), SHOW_LONG_STATUS},
1139
{"kill", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_KILL]), SHOW_LONG_STATUS},
1140
{"load", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_LOAD]), SHOW_LONG_STATUS},
1141
{"optimize", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS},
1142
{"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS},
1143
{"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS},
1144
{"replace", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_REPLACE]), SHOW_LONG_STATUS},
1145
{"replace_select", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS},
1146
{"rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS},
1147
{"rollback_to_savepoint",(char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS},
1148
{"savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
1149
{"select", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SELECT]), SHOW_LONG_STATUS},
1150
{"set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
1151
{"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
1152
{"show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
1153
{"show_databases", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS},
1154
{"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS},
1155
{"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
1156
{"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
1157
{"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
1158
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
1159
{"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
1160
{"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
1161
{"show_table_status", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
1162
{"show_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS},
1163
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
1164
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
1165
{"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS},
1166
{"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
1167
{"update", (char*) offsetof(STATUS_VAR, com_stat[(uint32_t) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
1168
{NULL, NULL, SHOW_LONGLONG}
2007
1171
static int init_common_variables(const char *conf_file_name, int argc,
2008
char **argv, const char **groups)
1172
char **argv, const char **groups)
2010
1175
umask(((~my_umask) & 0666));
2011
1176
my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
2012
1177
tzset(); // Set tzname
1179
curr_time= time(NULL);
1180
if (curr_time == (time_t)-1)
2014
1183
max_system_variables.pseudo_thread_id= UINT32_MAX;
2015
server_start_time= flush_status_time= my_time(0);
2016
rpl_filter= new Rpl_filter;
2017
binlog_filter= new Rpl_filter;
2018
if (!rpl_filter || !binlog_filter)
2020
sql_perror("Could not allocate replication and binlog filters");
1184
server_start_time= flush_status_time= curr_time;
2024
1186
if (init_thread_environment())
2026
mysql_init_variables();
1188
drizzle_init_variables();
2030
1191
struct tm tm_tmp;
2031
1192
localtime_r(&server_start_time,&tm_tmp);
2032
strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
1193
strncpy(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
2033
1194
sizeof(system_time_zone)-1);
2038
1198
We set SYSTEM time zone as reasonable default and
2039
1199
also for failure of my_tz_init() and bootstrap mode.
2237
1291
static int init_thread_environment()
2239
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
2240
(void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW);
1293
(void) pthread_mutex_init(&LOCK_create_db, NULL);
2241
1294
(void) pthread_mutex_init(&LOCK_open, NULL);
2242
1295
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
2243
1296
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
2244
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
2245
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
2246
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
2247
1297
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
2248
(void) my_rwlock_init(&LOCK_system_variables_hash, NULL);
1298
(void) pthread_rwlock_init(&LOCK_system_variables_hash, NULL);
2249
1299
(void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
2250
(void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
2251
(void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST);
2252
(void) my_rwlock_init(&LOCK_sys_init_connect, NULL);
2253
(void) my_rwlock_init(&LOCK_sys_init_slave, NULL);
2254
1300
(void) pthread_cond_init(&COND_thread_count,NULL);
1301
(void) pthread_cond_init(&COND_server_end,NULL);
2255
1302
(void) pthread_cond_init(&COND_refresh,NULL);
2256
1303
(void) pthread_cond_init(&COND_global_read_lock,NULL);
2257
(void) pthread_cond_init(&COND_thread_cache,NULL);
2258
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
2259
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
2260
(void) pthread_cond_init(&COND_rpl_status, NULL);
2262
/* Parameter for threads created for connections */
2263
(void) pthread_attr_init(&connection_attrib);
2264
(void) pthread_attr_setdetachstate(&connection_attrib,
2265
PTHREAD_CREATE_DETACHED);
2266
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
2268
struct sched_param tmp_sched_param;
2270
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
2271
tmp_sched_param.sched_priority= WAIT_PRIOR;
2272
(void)pthread_attr_setschedparam(&connection_attrib, &tmp_sched_param);
2275
if (pthread_key_create(&THR_THD,NULL) ||
2276
pthread_key_create(&THR_MALLOC,NULL))
2278
sql_print_error(_("Can't create thread-keys"));
1305
if (pthread_key_create(&THR_Session,NULL) ||
1306
pthread_key_create(&THR_Mem_root,NULL))
1308
errmsg_printf(ERRMSG_LVL_ERROR, _("Can't create thread-keys"));
2285
static int init_server_components()
1315
static int init_server_components(plugin::Registry &plugins)
2288
1318
We need to call each of these following functions to ensure that
2289
1319
all things are initialized so that unireg_abort() doesn't fail
2291
if (table_cache_init() | table_def_init())
1321
if (table_cache_init())
1323
if (TableShare::cacheStart())
2292
1324
unireg_abort(1);
2294
randominit(&sql_rand,(uint32_t) server_start_time,(uint32_t) server_start_time/2);
2296
1327
init_thr_lock();
2299
1329
/* Setup logs */
2302
Enable old-fashioned error log, except when the user has requested
2303
help information. Since the implementation of plugin server
2304
variables the help output is now written much later.
2306
if (opt_error_log && !opt_help)
2308
if (!log_error_file_ptr[0])
2309
fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
2310
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */
2312
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
2313
MY_UNPACK_FILENAME | MY_SAFE_PATH);
2314
if (!log_error_file[0])
2315
opt_error_log= 1; // Too long file name
2318
if (freopen(log_error_file, "a+", stdout))
2319
freopen(log_error_file, "a+", stderr);
2323
1331
if (xid_cache_init())
2325
sql_print_error(_("Out of memory"));
2330
if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
2332
sql_print_error(_("You need to use --log-bin to make "
2333
"--binlog-format work."));
2338
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
2341
if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC)
2342
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
2345
assert(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
2348
/* Check that we have not let the format to unspecified at this point */
2349
assert((uint)global_system_variables.binlog_format <=
2350
array_elements(binlog_format_names)-1);
2352
if (opt_log_slave_updates && replicate_same_server_id)
2354
sql_print_error(_("using --replicate-same-server-id in conjunction with "
2355
"--log-slave-updates is impossible, it would lead to "
2356
"infinite loops in this server."));
2362
char buf[FN_REFLEN];
2364
ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf);
2365
if (!opt_bin_logname && !opt_binlog_index_name)
2368
User didn't give us info to name the binlog index file.
2369
Picking `hostname`-bin.index like did in 4.x, causes replication to
2370
fail if the hostname is changed later. So, we would like to instead
2371
require a name. But as we don't want to break many existing setups, we
2372
only give warning, not error.
2374
sql_print_warning(_("No argument was provided to --log-bin, and "
2375
"--log-bin-index was not used; so replication "
2376
"may break when this Drizzle server acts as a "
2377
"master and has his hostname changed!! Please "
2378
"use '--log-bin=%s' to avoid this problem."), ln);
2382
free(opt_bin_logname);
2383
opt_bin_logname=my_strdup(buf, MYF(0));
2385
if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln))
2391
Used to specify which type of lock we need to use for queries of type
2392
INSERT ... SELECT. This will change when we have row level logging.
2397
/* call ha_init_key_cache() on all key caches to init them */
2398
process_key_caches(&ha_init_key_cache);
1333
errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory"));
2400
1337
/* Allow storage engine to give real error messages */
2401
1338
if (ha_init_errors())
2404
if (plugin_init(&defaults_argc, defaults_argv,
2405
(opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
2406
(opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
1341
if (plugin_init(plugins, &defaults_argc, defaults_argv,
1342
((opt_help) ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
2408
sql_print_error(_("Failed to initialize plugins."));
1344
errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize plugins."));
2409
1345
unireg_abort(1);
1348
if (opt_help || opt_help_extended)
2413
1349
unireg_abort(0);
2415
1351
/* we do want to exit if there are any other unknown options */
2551
1485
textdomain("drizzle");
1488
plugin::Registry &plugins= plugin::Registry::singleton();
1489
plugin::Client *client;
2554
1492
MY_INIT(argv[0]); // init my_sys library & pthreads
2555
1493
/* nothing should come before this line ^^^ */
2557
/* Set signal used to kill MySQL */
1495
/* Set signal used to kill Drizzle */
2558
1496
#if defined(SIGUSR2)
2559
1497
thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2;
2561
1499
thr_kill_signal= SIGINT;
2565
Perform basic logger initialization logger. Should be called after
2566
MY_INIT, as it initializes mutexes. Log tables are inited later.
2570
#ifdef _CUSTOMSTARTUPCONFIG_
2571
if (_cust_check_startup())
2573
/ * _cust_check_startup will report startup failure error * /
2578
1502
if (init_common_variables(DRIZZLE_CONFIG_NAME,
2579
1503
argc, argv, load_default_groups))
2580
1504
unireg_abort(1); // Will do exit
2582
1506
init_signals();
2584
pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size);
2586
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
2588
/* Retrieve used stack size; Needed for checking stack overflows */
2589
size_t stack_size= 0;
2590
pthread_attr_getstacksize(&connection_attrib, &stack_size);
2591
/* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
2592
if (stack_size && stack_size < my_thread_stack_size)
2594
if (global_system_variables.log_warnings)
2596
/* %zu is not yet in C++ */
2597
uint64_t size_tmp= (uint64_t)stack_size;
2598
sql_print_warning(_("Asked for %u thread stack, but got %"PRIu64),
2599
my_thread_stack_size, size_tmp);
2601
my_thread_stack_size= stack_size;
2606
1509
select_thread=pthread_self();
2607
1510
select_thread_in_use=1;
2610
We have enough space for fiddling with the argv, continue
2612
check_data_home(mysql_real_data_home);
2613
if (my_setwd(mysql_real_data_home,MYF(MY_WME)) && !opt_help)
2614
unireg_abort(1); /* purecov: inspected */
2615
mysql_data_home= mysql_data_home_buff;
2616
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
2617
mysql_data_home[1]=0;
2618
mysql_data_home_len= 2;
1512
check_data_home(drizzle_real_data_home);
1513
if (chdir(drizzle_real_data_home) && !opt_help)
1515
drizzle_data_home= drizzle_data_home_buff;
1516
drizzle_data_home[0]=FN_CURLIB; // all paths are relative from here
1517
drizzle_data_home[1]=0;
1518
drizzle_data_home_len= 2;
2620
if ((user_info= check_user(mysqld_user)))
1520
if ((user_info= check_user(drizzled_user)))
2622
1522
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
2623
1523
if (locked_in_memory) // getuid() == 0 here
2624
1524
set_effective_user(user_info);
2627
set_user(mysqld_user, user_info);
1527
set_user(drizzled_user, user_info);
2630
if (opt_bin_log && !server_id)
2634
sql_print_warning(_("You have enabled the binary log, but you haven't set "
2635
"server-id to a non-zero value: we force server id to "
2636
"1; updates will be logged to the binary log, but "
2637
"connections from slaves will not be accepted."));
2641
if (init_server_components())
2647
Initialize my_str_malloc() and my_str_free()
2649
my_str_malloc= &my_str_malloc_mysqld;
2650
my_str_free= &my_str_free_mysqld;
1535
if (init_server_components(plugins))
1540
if (plugin::Listen::setup())
2653
1544
init signals & alarm
2654
1545
After this we can't quit by a simple unireg_abort
2656
1547
error_handler_hook= my_message_sql;
2657
start_signal_handler(); // Creates pidfile
2659
if (mysql_rm_tmp_tables() || my_tz_init((THD *)0, default_tz_name, false))
1549
if (drizzle_rm_tmp_tables() ||
1550
my_tz_init((Session *)0, default_tz_name))
2662
1553
select_thread_in_use=0;
2663
(void) pthread_kill(signal_thread, DRIZZLE_KILL_SIGNAL);
1554
(void) pthread_kill(signal_thread, SIGTERM);
2665
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
1556
(void) unlink(pidfile_name); // Not needed anymore
2670
1561
init_status_vars();
2672
init_slave() must be called after the thread keys are created.
2673
Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
2674
places) assume that active_mi != 0, so let's fail if it's 0 (out of
2675
memory); a message has already been printed.
2677
if (init_slave() && !active_mi)
1563
errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_STARTUP)), my_progname, VERSION,
1564
COMPILATION_COMMENT);
1567
/* Listen for new connections and start new session for each connection
1568
accepted. The listen.getClient() method will return NULL when the server
1569
should be shutdown. */
1570
while ((client= plugin::Listen::getClient()) != NULL)
1572
if (!(session= new Session(client)))
1578
/* If we error on creation we drop the connection and delete the session. */
1579
if (session->schedule())
1580
unlink_session(session);
2682
sql_print_information(_(ER(ER_STARTUP)),my_progname,server_version,
2683
"", mysqld_port, DRIZZLE_COMPILATION_COMMENT);
2686
handle_connections_sockets();
2688
1583
/* (void) pthread_attr_destroy(&connection_attrib); */
2692
sql_print_error(_("Before Lock_thread_count"));
2694
1586
(void) pthread_mutex_lock(&LOCK_thread_count);
2695
1587
select_thread_in_use=0; // For close_connections
2696
1588
(void) pthread_mutex_unlock(&LOCK_thread_count);
2697
1589
(void) pthread_cond_broadcast(&COND_thread_count);
2699
sql_print_error(_("After lock_thread_count"));
2702
1591
/* Wait until cleanup is done */
2703
1592
(void) pthread_mutex_lock(&LOCK_thread_count);
2704
1593
while (!ready_to_exit)
2705
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
1594
pthread_cond_wait(&COND_server_end,&LOCK_thread_count);
2706
1595
(void) pthread_mutex_unlock(&LOCK_thread_count);
2714
Create new thread to handle incoming connection.
2716
This function will create new thread to handle the incoming
2717
connection. If there are idle cached threads one will be used.
2718
'thd' will be pushed into 'threads'.
2720
In single-threaded mode (\#define ONE_THREAD) connection will be
2721
handled inside this function.
2723
@param[in,out] thd Thread handle of future thread.
2726
static void create_new_thread(THD *thd)
2730
Don't allow too many connections. We roughly check here that we allow
2731
only (max_connections + 1) connections.
2734
pthread_mutex_lock(&LOCK_connection_count);
2736
if (connection_count >= max_connections + 1 || abort_loop)
2738
pthread_mutex_unlock(&LOCK_connection_count);
2740
close_connection(thd, ER_CON_COUNT_ERROR, 1);
2747
if (connection_count > max_used_connections)
2748
max_used_connections= connection_count;
2750
pthread_mutex_unlock(&LOCK_connection_count);
2752
/* Start a new thread to handle connection. */
2754
pthread_mutex_lock(&LOCK_thread_count);
2757
The initialization of thread_id is done in create_embedded_thd() for
2758
the embedded library.
2759
TODO: refactor this to avoid code duplication there
2761
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
2765
thread_scheduler.add_connection(thd);
2771
#ifdef SIGNALS_DONT_BREAK_READ
2772
inline void kill_broken_server()
2774
/* hack to get around signals ignored in syscalls for problem OS's */
2775
if ((ip_sock == -1))
2777
select_thread_in_use = 0;
2778
/* The following call will never return */
2779
kill_server((void*) DRIZZLE_KILL_SIGNAL);
2782
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
2784
#define MAYBE_BROKEN_SYSCALL
2787
/* Handle new connections and spawn new process to handle them */
2789
void handle_connections_sockets()
2793
uint32_t error_count=0;
2795
struct sockaddr_storage cAddr;
2797
MAYBE_BROKEN_SYSCALL;
2802
if ((number_of= poll(fds, pollfd_count, -1)) == -1)
2806
if (!select_errors++ && !abort_loop) /* purecov: inspected */
2807
sql_print_error(_("drizzled: Got error %d from select"),
2808
errno); /* purecov: inspected */
2810
MAYBE_BROKEN_SYSCALL
2816
#ifdef FIXME_IF_WE_WERE_KEEPING_THIS
2817
assert(number_of > 1); /* Not handling this at the moment */
2822
MAYBE_BROKEN_SYSCALL;
2826
for (x= 0, sock= -1; x < pollfd_count; x++)
2828
if (fds[x].revents == POLLIN)
2836
for (uint32_t retry=0; retry < MAX_ACCEPT_RETRY; retry++)
2838
SOCKET_SIZE_TYPE length= sizeof(struct sockaddr_storage);
2839
new_sock= accept(sock, (struct sockaddr *)(&cAddr),
2841
if (new_sock != -1 || (errno != EINTR && errno != EAGAIN))
2848
if ((error_count++ & 255) == 0) // This can happen often
2849
sql_perror("Error in accept");
2850
MAYBE_BROKEN_SYSCALL;
2851
if (errno == ENFILE || errno == EMFILE)
2852
sleep(1); // Give other threads some time
2857
SOCKET_SIZE_TYPE dummyLen;
2858
struct sockaddr_storage dummy;
2859
dummyLen = sizeof(dummy);
2860
if ( getsockname(new_sock,(struct sockaddr *)&dummy,
2861
(socklen_t *)&dummyLen) < 0 )
2863
sql_perror("Error on new connection socket");
2864
(void) shutdown(new_sock, SHUT_RDWR);
2865
(void) close(new_sock);
2868
dummyLen = sizeof(dummy);
2869
if ( getpeername(new_sock, (struct sockaddr *)&dummy,
2870
(socklen_t *)&dummyLen) < 0)
2872
sql_perror("Error on new connection socket");
2873
(void) shutdown(new_sock, SHUT_RDWR);
2874
(void) close(new_sock);
2880
** Don't allow too many connections
2883
if (!(thd= new THD))
2885
(void) shutdown(new_sock, SHUT_RDWR);
2889
if (net_init_sock(&thd->net, new_sock, sock == 0))
2895
create_new_thread(thd);
1599
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
2968
1636
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
2969
1637
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
2970
1638
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
2971
OPT_MYISAM_STATS_METHOD,
2972
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
2973
OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
2974
OPT_OPEN_FILES_LIMIT,
1639
OPT_NET_BUFFER_LENGTH,
2975
1640
OPT_PRELOAD_BUFFER_SIZE,
2976
1641
OPT_RECORD_BUFFER,
2977
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT,
2978
OPT_RELAY_LOG_PURGE,
2979
OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
2980
OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING,
1642
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT,
2981
1644
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
2982
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
2983
1645
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
2984
1646
OPT_WAIT_TIMEOUT,
2986
OPT_DEFAULT_WEEK_FORMAT,
2987
1647
OPT_RANGE_ALLOC_BLOCK_SIZE,
2988
1648
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
2989
1649
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
2990
OPT_SYNC_FRM, OPT_SYNC_BINLOG,
2991
OPT_SYNC_REPLICATION,
2992
OPT_SYNC_REPLICATION_SLAVE_ID,
2993
OPT_SYNC_REPLICATION_TIMEOUT,
2994
OPT_ENABLE_SHARED_MEMORY,
2995
OPT_SHARED_MEMORY_BASE_NAME,
2996
1650
OPT_OLD_ALTER_TABLE,
2997
OPT_EXPIRE_LOGS_DAYS,
2998
1651
OPT_GROUP_CONCAT_MAX_LEN,
2999
1652
OPT_DEFAULT_COLLATION,
3000
OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
3001
1653
OPT_CHARACTER_SET_FILESYSTEM,
3002
1654
OPT_LC_TIME_NAMES,
3003
1655
OPT_INIT_CONNECT,
3008
OPT_DATETIME_FORMAT,
3009
1656
OPT_DEFAULT_TIME_ZONE,
3011
1657
OPT_OPTIMIZER_SEARCH_DEPTH,
3012
1660
OPT_OPTIMIZER_PRUNE_LEVEL,
3013
OPT_UPDATABLE_VIEWS_WITH_LIMIT,
3014
1661
OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET,
3015
1662
OPT_ENABLE_LARGE_PAGES,
3016
1663
OPT_TIMED_MUTEXES,
3017
OPT_OLD_STYLE_USER_LIMITS,
3018
1664
OPT_TABLE_LOCK_WAIT_TIMEOUT,
3019
1665
OPT_PLUGIN_LOAD,
3020
1666
OPT_PLUGIN_DIR,
3021
1667
OPT_PORT_OPEN_TIMEOUT,
3023
OPT_KEEP_FILES_ON_CREATE,
3025
OPT_THREAD_HANDLING,
3026
OPT_INNODB_ROLLBACK_ON_TIMEOUT,
3027
1668
OPT_SECURE_FILE_PRIV,
3028
OPT_MIN_EXAMINED_ROW_LIMIT,
3030
OPT_POOL_OF_THREADS,
1669
OPT_MIN_EXAMINED_ROW_LIMIT
3035
#define LONG_TIMEOUT ((uint32_t) 3600L*24L*365L)
3037
1673
struct my_option my_long_options[] =
3039
1675
{"help", '?', N_("Display this help and exit."),
3040
1676
(char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
3042
{"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
3043
N_("Option used by mysql-test for debugging and testing of replication."),
3044
(char**) &abort_slave_event_count, (char**) &abort_slave_event_count,
3045
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1678
{"help-extended", '?',
1679
N_("Display this help and exit after initializing plugins."),
1680
(char**) &opt_help_extended, (char**) &opt_help_extended,
1681
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3046
1682
{"auto-increment-increment", OPT_AUTO_INCREMENT,
3047
1683
N_("Auto-increment columns are incremented by this"),
3048
1684
(char**) &global_system_variables.auto_increment_increment,
3049
(char**) &max_system_variables.auto_increment_increment, 0, GET_ULONG,
3050
OPT_ARG, 1, 1, 65535, 0, 1, 0 },
1685
(char**) &max_system_variables.auto_increment_increment, 0, GET_ULL,
1686
OPT_ARG, 1, 1, UINT64_MAX, 0, 1, 0 },
3051
1687
{"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET,
3052
1688
N_("Offset added to Auto-increment columns. Used when "
3053
1689
"auto-increment-increment != 1"),
3054
1690
(char**) &global_system_variables.auto_increment_offset,
3055
(char**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
3056
1, 1, 65535, 0, 1, 0 },
1691
(char**) &max_system_variables.auto_increment_offset, 0, GET_ULL, OPT_ARG,
1692
1, 1, UINT64_MAX, 0, 1, 0 },
3057
1693
{"basedir", 'b',
3058
1694
N_("Path to installation directory. All paths are usually resolved "
3059
1695
"relative to this."),
3060
(char**) &mysql_home_ptr, (char**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
1696
(char**) &drizzle_home_ptr, (char**) &drizzle_home_ptr, 0, GET_STR, REQUIRED_ARG,
3061
1697
0, 0, 0, 0, 0, 0},
3062
1698
{"bind-address", OPT_BIND_ADDRESS, N_("IP address to bind to."),
3063
(char**) &my_bind_addr_str, (char**) &my_bind_addr_str, 0, GET_STR,
1699
(char**) &drizzled_bind_host, (char**) &drizzled_bind_host, 0, GET_STR,
3064
1700
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3065
{"binlog_format", OPT_BINLOG_FORMAT,
3066
N_("Does not have any effect without '--log-bin'. "
3067
"Tell the master the form of binary logging to use: either 'row' for "
3068
"row-based binary logging, or 'statement' for statement-based binary "
3069
"logging, or 'mixed'. 'mixed' is statement-based binary logging except "
3070
"for those statements where only row-based is correct: those which "
3071
"involve user-defined functions (i.e. UDFs) or the UUID() function; for "
3072
"those, row-based binary logging is automatically used. ")
3073
,(char**) &opt_binlog_format, (char**) &opt_binlog_format,
3074
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3075
{"binlog-do-db", OPT_BINLOG_DO_DB,
3076
N_("Tells the master it should log updates for the specified database, and "
3077
"exclude all others not explicitly mentioned."),
3078
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3079
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
3080
N_("Tells the master that updates to the given database should not "
3081
"be logged tothe binary log."),
3082
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3083
{"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
3084
N_("The maximum size of a row-based binary log event in bytes. Rows will "
3085
"be grouped into events smaller than this size if possible. "
3086
"The value has to be a multiple of 256."),
3087
(char**) &opt_binlog_rows_event_max_size,
3088
(char**) &opt_binlog_rows_event_max_size, 0,
3089
GET_ULONG, REQUIRED_ARG,
3090
/* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX,
3091
/* sub_size */ 0, /* block_size */ 256,
3094
{"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
3095
N_("Don't ignore client side character set value sent during handshake."),
3096
(char**) &opt_character_set_client_handshake,
3097
(char**) &opt_character_set_client_handshake,
3098
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
3099
{"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
3100
N_("Set the filesystem character set."),
3101
(char**) &character_set_filesystem_name,
3102
(char**) &character_set_filesystem_name,
3103
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3104
{"character-set-server", 'C',
3105
N_("Set the default character set."),
3106
(char**) &default_character_set_name, (char**) &default_character_set_name,
3107
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3108
{"character-sets-dir", OPT_CHARSETS_DIR,
3109
N_("Directory where character sets are."), (char**) &charsets_dir,
3110
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3111
1701
{"chroot", 'r',
3112
N_("Chroot mysqld daemon during startup."),
3113
(char**) &mysqld_chroot, (char**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
1702
N_("Chroot drizzled daemon during startup."),
1703
(char**) &drizzled_chroot, (char**) &drizzled_chroot, 0, GET_STR, REQUIRED_ARG,
3114
1704
0, 0, 0, 0, 0, 0},
3115
1705
{"collation-server", OPT_DEFAULT_COLLATION,
3116
1706
N_("Set the default collation."),
3141
1727
N_("Set the default time zone."),
3142
1728
(char**) &default_tz_name, (char**) &default_tz_name,
3143
1729
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3144
{"delay-key-write", OPT_DELAY_KEY_WRITE,
3145
N_("Type of DELAY_KEY_WRITE."),
3146
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3147
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
3148
N_("Option used by mysql-test for debugging and testing of replication."),
3149
(char**) &disconnect_slave_event_count,
3150
(char**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
3152
1730
#ifdef HAVE_STACK_TRACE_ON_SEGV
3153
1731
{"enable-pstack", OPT_DO_PSTACK,
3154
1732
N_("Print a symbolic stack trace on failure."),
3155
1733
(char**) &opt_do_pstack, (char**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
3157
1735
#endif /* HAVE_STACK_TRACE_ON_SEGV */
3158
{"engine-condition-pushdown",
3159
OPT_ENGINE_CONDITION_PUSHDOWN,
3160
N_("Push supported query conditions to the storage engine."),
3161
(char**) &global_system_variables.engine_condition_pushdown,
3162
(char**) &global_system_variables.engine_condition_pushdown,
3163
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
3164
1736
/* See how it's handled in get_one_option() */
3165
1737
{"exit-info", 'T',
3166
1738
N_("Used for debugging; Use at your own risk!"),
3167
1739
0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
3168
{"flush", OPT_FLUSH,
3169
N_("Flush tables to disk between SQL commands."),
3170
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3171
1740
/* We must always support the next option to make scripts like mysqltest
3172
1741
easier to do */
3173
1742
{"gdb", OPT_DEBUGGING,
3174
1743
N_("Set up signals usable for debugging"),
3175
1744
(char**) &opt_debugging, (char**) &opt_debugging,
3176
1745
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3177
{"init-connect", OPT_INIT_CONNECT,
3178
N_("Command(s) that are executed for each new connection"),
3179
(char**) &opt_init_connect, (char**) &opt_init_connect, 0, GET_STR_ALLOC,
3180
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3181
{"init-file", OPT_INIT_FILE,
3182
N_("Read SQL commands from this file at startup."),
3183
(char**) &opt_init_file, (char**) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
3185
{"init-slave", OPT_INIT_SLAVE,
3186
N_("Command(s) that are executed when a slave connects to this master"),
3187
(char**) &opt_init_slave, (char**) &opt_init_slave, 0, GET_STR_ALLOC,
3188
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3189
1746
{"language", 'L',
3190
1747
N_("(IGNORED)"),
3191
1748
(char**) &language_ptr, (char**) &language_ptr, 0, GET_STR, REQUIRED_ARG,
3195
1752
(char**) &lc_time_names_name,
3196
1753
(char**) &lc_time_names_name,
3197
1754
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3198
{"local-infile", OPT_LOCAL_INFILE,
3199
N_("Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0)."),
3200
(char**) &opt_local_infile,
3201
(char**) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
3204
N_("Log connections and queries to file."),
3205
(char**) &opt_logname,
3206
(char**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3207
{"log-bin", OPT_BIN_LOG,
3208
N_("Log update queries in binary format. Optional argument is the "
3209
"location for the binary log files.(Strongly "
3210
"recommended to avoid replication problems if server's hostname "
3212
(char**) &opt_bin_logname, (char**) &opt_bin_logname, 0, GET_STR_ALLOC,
3213
OPT_ARG, 0, 0, 0, 0, 0, 0},
3214
{"log-bin-index", OPT_BIN_LOG_INDEX,
3215
N_("File that holds the names for last binary log files."),
3216
(char**) &opt_binlog_index_name, (char**) &opt_binlog_index_name, 0, GET_STR,
3217
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3218
{"log-error", OPT_ERROR_LOG_FILE,
3219
N_("Error log file."),
3220
(char**) &log_error_file_ptr, (char**) &log_error_file_ptr, 0, GET_STR,
3221
OPT_ARG, 0, 0, 0, 0, 0, 0},
3222
{"log-isam", OPT_ISAM_LOG,
3223
N_("Log all MyISAM changes to file."),
3224
(char**) &myisam_log_filename, (char**) &myisam_log_filename, 0, GET_STR,
3225
OPT_ARG, 0, 0, 0, 0, 0, 0},
3226
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
3227
N_("Tells the slave to log the updates from the slave thread to the binary "
3228
"log. You will need to turn it on if you plan to "
3229
"daisy-chain the slaves."),
3230
(char**) &opt_log_slave_updates, (char**) &opt_log_slave_updates,
3232
NO_ARG, 0, 0, 0, 0, 0, 0},
3233
{"log-tc", OPT_LOG_TC,
3234
N_("Path to transaction coordinator log (used for transactions that affect "
3235
"more than one storage engine, when binary log is disabled)"),
3236
(char**) &opt_tc_log_file, (char**) &opt_tc_log_file, 0, GET_STR,
3237
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3239
{"log-tc-size", OPT_LOG_TC_SIZE,
3240
N_("Size of transaction coordinator log."),
3241
(char**) &opt_tc_log_size, (char**) &opt_tc_log_size, 0, GET_ULONG,
3242
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0,
3243
TC_LOG_PAGE_SIZE, 0},
3245
1755
{"log-warnings", 'W',
3246
1756
N_("Log some not critical warnings to the log file."),
3247
1757
(char**) &global_system_variables.log_warnings,
3248
(char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
1758
(char**) &max_system_variables.log_warnings, 0, GET_BOOL, OPT_ARG, 1, 0, 0,
3250
{"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
3251
N_("INSERT/DELETE/UPDATE has lower priority than selects."),
3252
(char**) &global_system_variables.low_priority_updates,
3253
(char**) &max_system_variables.low_priority_updates,
3254
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3255
{"master-info-file", OPT_MASTER_INFO_FILE,
3256
N_("The location and name of the file that remembers the master and "
3257
"where the I/O replication thread is in the master's binlogs."),
3258
(char**) &master_info_file, (char**) &master_info_file, 0, GET_STR,
3259
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3260
{"master-retry-count", OPT_MASTER_RETRY_COUNT,
3261
N_("The number of tries the slave will make to connect to the master "
3262
"before giving up."),
3263
(char**) &master_retry_count, (char**) &master_retry_count, 0, GET_ULONG,
3264
REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
3265
{"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS,
3266
N_("Option used by mysql-test for debugging and testing of replication."),
3267
(char**) &max_binlog_dump_events, (char**) &max_binlog_dump_events, 0,
3268
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3269
1760
{"memlock", OPT_MEMLOCK,
3270
N_("Lock mysqld in memory."),
1761
N_("Lock drizzled in memory."),
3271
1762
(char**) &locked_in_memory,
3272
1763
(char**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3273
{"myisam-recover", OPT_MYISAM_RECOVER,
3274
N_("Syntax: myisam-recover[=option[,option...]], where option can be "
3275
"DEFAULT, BACKUP, FORCE or QUICK."),
3276
(char**) &myisam_recover_options_str, (char**) &myisam_recover_options_str, 0,
3277
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3279
N_("Use very new possible 'unsafe' functions."),
3280
(char**) &global_system_variables.new_mode,
3281
(char**) &max_system_variables.new_mode,
3282
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3283
{"old-alter-table", OPT_OLD_ALTER_TABLE,
3284
N_("Use old, non-optimized alter table."),
3285
(char**) &global_system_variables.old_alter_table,
3286
(char**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
3288
{"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
3289
N_("Enable old-style user limits (before 5.0.3 user resources were counted "
3290
"per each user+host vs. per account)"),
3291
(char**) &opt_old_style_user_limits, (char**) &opt_old_style_user_limits,
3292
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3293
1764
{"pid-file", OPT_PID_FILE,
3294
1765
N_("Pid file used by safe_mysqld."),
3295
1766
(char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR,
3296
1767
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3298
1769
N_("Port number to use for connection or 0 for default to, in "
3299
"order of preference, my.cnf, $DRIZZLE_TCP_PORT, "
3300
"built-in default (" STRINGIFY_ARG(DRIZZLE_PORT) ")."),
3301
(char**) &mysqld_port,
3302
(char**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1770
"order of preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
1771
"built-in default (" STRINGIFY_ARG(DRIZZLE_TCP_PORT) ")."),
1772
(char**) &drizzled_tcp_port,
1773
(char**) &drizzled_tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3303
1774
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
3304
1775
N_("Maximum time in seconds to wait for the port to become free. "
3305
1776
"(Default: no wait)"),
3306
(char**) &mysqld_port_timeout,
3307
(char**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3308
{"relay-log", OPT_RELAY_LOG,
3309
N_("The location and name to use for relay logs."),
3310
(char**) &opt_relay_logname, (char**) &opt_relay_logname, 0,
3311
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3312
{"relay-log-index", OPT_RELAY_LOG_INDEX,
3313
N_("The location and name to use for the file that keeps a list of the "
3314
"last relay logs."),
3315
(char**) &opt_relaylog_index_name, (char**) &opt_relaylog_index_name, 0,
3316
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3317
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
3318
N_("The location and name of the file that remembers where the SQL "
3319
"replication thread is in the relay logs."),
3320
(char**) &relay_log_info_file, (char**) &relay_log_info_file, 0, GET_STR,
3321
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3322
{"replicate-do-db", OPT_REPLICATE_DO_DB,
3323
N_("Tells the slave thread to restrict replication to the specified "
3324
"database. To specify more than one database, use the directive "
3325
"multiple times, once for each database. Note that this will only work "
3326
"if you do not use cross-database queries such as UPDATE "
3327
"some_db.some_table SET foo='bar' while having selected a different or "
3328
"no database. If you need cross database updates to work, use "
3329
"replicate-wild-do-table=db_name.%."),
3330
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3331
{"replicate-do-table", OPT_REPLICATE_DO_TABLE,
3332
N_("Tells the slave thread to restrict replication to the specified table. "
3333
"To specify more than one table, use the directive multiple times, once "
3334
"for each table. This will work for cross-database updates, in contrast "
3335
"to replicate-do-db."),
3336
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3337
{"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB,
3338
N_("Tells the slave thread to not replicate to the specified database. To "
3339
"specify more than one database to ignore, use the directive multiple "
3340
"times, once for each database. This option will not work if you use "
3341
"cross database updates. If you need cross database updates to work, "
3342
"use replicate-wild-ignore-table=db_name.%. "),
3343
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3344
{"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
3345
N_("Tells the slave thread to not replicate to the specified table. To "
3346
"specify more than one table to ignore, use the directive multiple "
3347
"times, once for each table. This will work for cross-datbase updates, "
3348
"in contrast to replicate-ignore-db."),
3349
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3350
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
3351
N_("Updates to a database with a different name than the original. "
3352
"Example: replicate-rewrite-db=master_db_name->slave_db_name."),
3353
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3354
{"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
3355
N_("In replication, if set to 1, do not skip events having our server id. "
3356
"Default value is 0 (to break infinite loops in circular replication). "
3357
"Can't be set to 1 if --log-slave-updates is used."),
3358
(char**) &replicate_same_server_id,
3359
(char**) &replicate_same_server_id,
3360
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3361
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
3362
N_("Tells the slave thread to restrict replication to the tables that "
3363
"match the specified wildcard pattern. To specify more than one table, "
3364
"use the directive multiple times, once for each table. This will work "
3365
"for cross-database updates. Example: replicate-wild-do-table=foo%.bar% "
3366
"will replicate only updates to tables in all databases that start with "
3367
"foo and whose table names start with bar."),
3368
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3369
{"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE,
3370
N_("Tells the slave thread to not replicate to the tables that match the "
3371
"given wildcard pattern. To specify more than one table to ignore, use "
3372
"the directive multiple times, once for each table. This will work for "
3373
"cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% "
3374
"will not do updates to tables in databases that start with foo and "
3375
"whose table names start with bar."),
3376
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3377
// In replication, we may need to tell the other servers how to connect
3378
{"report-host", OPT_REPORT_HOST,
3379
N_("Hostname or IP of the slave to be reported to to the master during "
3380
"slave registration. Will appear in the output of SHOW SLAVE HOSTS. "
3381
"Leave unset if you do not want the slave to register itself with the "
3382
"master. Note that it is not sufficient for the master to simply read "
3383
"the IP of the slave off the socket once the slave connects. Due to NAT "
3384
"and other routing issues, that IP may not be valid for connecting to "
3385
"the slave from the master or other hosts."),
3386
(char**) &report_host, (char**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
3388
{"report-password", OPT_REPORT_PASSWORD, "Undocumented.",
3389
(char**) &report_password, (char**) &report_password, 0, GET_STR,
3390
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3391
{"report-port", OPT_REPORT_PORT,
3392
N_("Port for connecting to slave reported to the master during slave "
3393
"registration. Set it only if the slave is listening on a non-default "
3394
"port or if you have a special tunnel from the master or other clients "
3395
"to the slave. If not sure, leave this option unset."),
3396
(char**) &report_port, (char**) &report_port, 0, GET_UINT, REQUIRED_ARG,
3397
DRIZZLE_PORT, 0, 0, 0, 0, 0},
3398
{"safe-mode", OPT_SAFE,
3399
N_("Skip some optimize stages (for testing)."),
3400
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1777
(char**) &drizzled_bind_timeout,
1778
(char**) &drizzled_bind_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3401
1779
{"secure-file-priv", OPT_SECURE_FILE_PRIV,
3402
1780
N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
3403
1781
"within specified directory"),
3406
1784
{"server-id", OPT_SERVER_ID,
3407
1785
N_("Uniquely identifies the server instance in the community of "
3408
1786
"replication partners."),
3409
(char**) &server_id, (char**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
1787
(char**) &server_id, (char**) &server_id, 0, GET_UINT32, REQUIRED_ARG, 0, 0, 0,
3411
{"skip-new", OPT_SKIP_NEW,
3412
N_("Don't use new, possible wrong routines."),
3413
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3414
{"skip-slave-start", OPT_SKIP_SLAVE_START,
3415
N_("If set, slave is not autostarted."),
3416
(char**) &opt_skip_slave_start,
3417
(char**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3418
1789
{"skip-stack-trace", OPT_SKIP_STACK_TRACE,
3419
1790
N_("Don't print a stack trace on failure."),
3420
1791
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
3422
{"skip-thread-priority", OPT_SKIP_PRIOR,
3423
N_("Don't give threads different priorities."),
3424
0, 0, 0, GET_NO_ARG, NO_ARG,
3425
DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
3426
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
3427
N_("The location where the slave should put its temporary files when "
3428
"replicating a LOAD DATA INFILE command."),
3429
(char**) &slave_load_tmpdir, (char**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
3430
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3431
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
3432
N_("Tells the slave thread to continue replication when a query event "
3433
"returns an error from the provided list."),
3434
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3435
{"slave-exec-mode", OPT_SLAVE_EXEC_MODE,
3436
N_("Modes for how replication events should be executed. Legal values are "
3437
"STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will "
3438
"not stop for operations that are idempotent. In STRICT mode, "
3439
"replication will stop on any unexpected difference between the master "
3441
(char**) &slave_exec_mode_str, (char**) &slave_exec_mode_str,
3442
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3443
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
3445
0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0},
3446
1793
{"symbolic-links", 's',
3447
1794
N_("Enable symbolic link support."),
3448
1795
(char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
3491
1821
0, 0, 0, GET_NO_ARG,
3492
1822
NO_ARG, 0, 0, 0, 0, 0, 0},
3493
1823
{"back_log", OPT_BACK_LOG,
3494
N_("The number of outstanding connection requests MySQL can have. This "
3495
"comes into play when the main MySQL thread gets very many connection "
1824
N_("The number of outstanding connection requests Drizzle can have. This "
1825
"comes into play when the main Drizzle thread gets very many connection "
3496
1826
"requests in a very short time."),
3497
(char**) &back_log, (char**) &back_log, 0, GET_ULONG,
1827
(char**) &back_log, (char**) &back_log, 0, GET_UINT,
3498
1828
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
3499
{ "binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
3500
N_("The size of the cache to hold the SQL statements for the binary log "
3501
"during a transaction. If you often use big, multi-statement "
3502
"transactions you can increase this to get more performance."),
3503
(char**) &binlog_cache_size, (char**) &binlog_cache_size, 0, GET_ULONG,
3504
REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3505
1829
{ "bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
3506
N_("Size of tree cache used in bulk insert optimisation. Note that this is "
1830
N_("Size of tree cache used in bulk insert optimization. Note that this is "
3507
1831
"a limit per thread!"),
3508
1832
(char**) &global_system_variables.bulk_insert_buff_size,
3509
1833
(char**) &max_system_variables.bulk_insert_buff_size,
3510
0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
3511
{ "connect_timeout", OPT_CONNECT_TIMEOUT,
3512
N_("The number of seconds the mysqld server is waiting for a connect "
3513
"packet before responding with 'Bad handshake'."),
3514
(char**) &connect_timeout, (char**) &connect_timeout,
3515
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
3516
{ "date_format", OPT_DATE_FORMAT,
3517
N_("The DATE format (For future)."),
3518
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATE],
3519
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATE],
3520
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3521
{ "datetime_format", OPT_DATETIME_FORMAT,
3522
N_("The DATETIME/TIMESTAMP format (for future)."),
3523
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATETIME],
3524
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATETIME],
3525
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3526
{ "default_week_format", OPT_DEFAULT_WEEK_FORMAT,
3527
N_("The default week format used by WEEK() functions."),
3528
(char**) &global_system_variables.default_week_format,
3529
(char**) &max_system_variables.default_week_format,
3530
0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0},
1834
0, GET_ULL, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
3531
1835
{ "div_precision_increment", OPT_DIV_PRECINCREMENT,
3532
1836
N_("Precision of the result of '/' operator will be increased on that "
3534
1838
(char**) &global_system_variables.div_precincrement,
3535
(char**) &max_system_variables.div_precincrement, 0, GET_ULONG,
1839
(char**) &max_system_variables.div_precincrement, 0, GET_UINT,
3536
1840
REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
3537
{ "expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
3538
N_("If non-zero, binary logs will be purged after expire_logs_days "
3539
"days; possible purges happen at startup and at binary log rotation."),
3540
(char**) &expire_logs_days,
3541
(char**) &expire_logs_days, 0, GET_ULONG,
3542
REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
3543
1841
{ "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN,
3544
1842
N_("The maximum length of the result of function group_concat."),
3545
1843
(char**) &global_system_variables.group_concat_max_len,
3546
(char**) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
1844
(char**) &max_system_variables.group_concat_max_len, 0, GET_UINT64,
3547
1845
REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0},
3548
{ "interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
3549
N_("The number of seconds the server waits for activity on an interactive "
3550
"connection before closing it."),
3551
(char**) &global_system_variables.net_interactive_timeout,
3552
(char**) &max_system_variables.net_interactive_timeout, 0,
3553
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3554
1846
{ "join_buffer_size", OPT_JOIN_BUFF_SIZE,
3555
1847
N_("The size of the buffer that is used for full joins."),
3556
1848
(char**) &global_system_variables.join_buff_size,
3557
(char**) &max_system_variables.join_buff_size, 0, GET_ULONG,
1849
(char**) &max_system_variables.join_buff_size, 0, GET_UINT64,
3558
1850
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX,
3559
1851
MALLOC_OVERHEAD, IO_SIZE, 0},
3560
{"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
3561
N_("Don't overwrite stale .MYD and .MYI even if no directory is specified."),
3562
(char**) &global_system_variables.keep_files_on_create,
3563
(char**) &max_system_variables.keep_files_on_create,
3564
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
3565
1852
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
3566
1853
N_("The size of the buffer used for index blocks for MyISAM tables. "
3567
1854
"Increase this to get better index handling (for all reads and multiple "
3568
1855
"writes) to as much as you can afford;"),
3569
1856
(char**) &dflt_key_cache_var.param_buff_size,
3571
0, (GET_ULL | GET_ASK_ADDR),
3572
1859
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD,
3574
1861
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
3578
1865
"total number of blocks in key cache"),
3579
1866
(char**) &dflt_key_cache_var.param_age_threshold,
3581
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
1868
0, (GET_UINT32), REQUIRED_ARG,
3582
1869
300, 100, ULONG_MAX, 0, 100, 0},
3583
1870
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
3584
1871
N_("The default size of key cache blocks"),
3585
1872
(char**) &dflt_key_cache_var.param_block_size,
3587
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
1874
0, (GET_UINT32), REQUIRED_ARG,
3588
1875
KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0},
3589
1876
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
3590
1877
N_("The minimum percentage of warm blocks in key cache"),
3591
1878
(char**) &dflt_key_cache_var.param_division_limit,
3593
0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
1880
0, (GET_UINT32) , REQUIRED_ARG, 100,
3594
1881
1, 100, 0, 1, 0},
3595
{"long_query_time", OPT_LONG_QUERY_TIME,
3596
N_("Log all queries that have taken more than long_query_time seconds to "
3597
"execute to file. The argument will be treated as a decimal value with "
3598
"microsecond precission."),
3599
(char**) &long_query_time, (char**) &long_query_time, 0, GET_DOUBLE,
3600
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
3601
1882
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
3602
1883
N_("Max packetlength to send/receive from to server."),
3603
1884
(char**) &global_system_variables.max_allowed_packet,
3604
(char**) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
1885
(char**) &max_system_variables.max_allowed_packet, 0, GET_UINT32,
3605
1886
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
3606
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
3607
N_("Can be used to restrict the total size used to cache a "
3608
"multi-transaction query."),
3609
(char**) &max_binlog_cache_size, (char**) &max_binlog_cache_size, 0,
3610
GET_ULONG, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3611
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
3612
N_("Binary log will be rotated automatically when the size exceeds this "
3613
"value. Will also apply to relay logs if max_relay_log_size is 0. "
3614
"The minimum value for this variable is 4096."),
3615
(char**) &max_binlog_size, (char**) &max_binlog_size, 0, GET_ULONG,
3616
REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0},
3617
1887
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
3618
1888
N_("If there is more than this number of interrupted connections from a "
3619
1889
"host this host will be blocked from further connections."),
3620
(char**) &max_connect_errors, (char**) &max_connect_errors, 0, GET_ULONG,
1890
(char**) &max_connect_errors, (char**) &max_connect_errors, 0, GET_UINT64,
3621
1891
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0},
3622
// Default max_connections of 151 is larger than Apache's default max
3623
// children, to avoid "too many connections" error in a common setup
3624
{"max_connections", OPT_MAX_CONNECTIONS,
3625
N_("The number of simultaneous clients allowed."),
3626
(char**) &max_connections,
3627
(char**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
3629
1892
{"max_error_count", OPT_MAX_ERROR_COUNT,
3630
1893
N_("Max number of errors/warnings to store for a statement."),
3631
1894
(char**) &global_system_variables.max_error_count,
3632
1895
(char**) &max_system_variables.max_error_count,
3633
0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0},
1896
0, GET_UINT64, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0},
3634
1897
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
3635
1898
N_("Don't allow creation of heap tables bigger than this."),
3636
1899
(char**) &global_system_variables.max_heap_table_size,
3646
1909
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
3647
1910
N_("Max number of bytes in sorted records."),
3648
1911
(char**) &global_system_variables.max_length_for_sort_data,
3649
(char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
1912
(char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULL,
3650
1913
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3651
{"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
3652
N_("If non-zero: relay log will be rotated automatically when the size "
3653
"exceeds this value; if zero (the default): when the size exceeds "
3654
"max_binlog_size. 0 excepted, the minimum value for this variable "
3656
(char**) &max_relay_log_size, (char**) &max_relay_log_size, 0, GET_ULONG,
3657
REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0},
3658
1914
{ "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
3659
1915
N_("Limit assumed max number of seeks when looking up rows based on a key"),
3660
1916
(char**) &global_system_variables.max_seeks_for_key,
3661
(char**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
1917
(char**) &max_system_variables.max_seeks_for_key, 0, GET_UINT64,
3662
1918
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
3663
1919
{"max_sort_length", OPT_MAX_SORT_LENGTH,
3664
1920
N_("The number of bytes to use when sorting BLOB or TEXT values "
3665
1921
"(only the first max_sort_length bytes of each value are used; the "
3666
1922
"rest are ignored)."),
3667
1923
(char**) &global_system_variables.max_sort_length,
3668
(char**) &max_system_variables.max_sort_length, 0, GET_ULONG,
1924
(char**) &max_system_variables.max_sort_length, 0, GET_SIZE,
3669
1925
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3670
{"max_tmp_tables", OPT_MAX_TMP_TABLES,
3671
N_("Maximum number of temporary tables a client can keep open at a time."),
3672
(char**) &global_system_variables.max_tmp_tables,
3673
(char**) &max_system_variables.max_tmp_tables, 0, GET_ULONG,
3674
REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0},
3675
1926
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
3676
1927
N_("After this many write locks, allow some read locks to run in between."),
3677
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULONG,
1928
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULL,
3678
1929
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
3679
1930
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
3680
1931
N_("Don't log queries which examine less than min_examined_row_limit "
3681
1932
"rows to file."),
3682
1933
(char**) &global_system_variables.min_examined_row_limit,
3683
(char**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG,
1934
(char**) &max_system_variables.min_examined_row_limit, 0, GET_ULL,
3684
1935
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0},
3685
{"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
3686
N_("Block size to be used for MyISAM index pages."),
3687
(char**) &opt_myisam_block_size,
3688
(char**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
3689
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
3690
0, MI_MIN_KEY_BLOCK_LENGTH, 0},
3691
{"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE,
3692
N_("Default pointer size to be used for MyISAM tables."),
3693
(char**) &myisam_data_pointer_size,
3694
(char**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
3696
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
3697
N_("Don't use the fast sort index method to created index if the "
3698
"temporary file would get bigger than this."),
3699
(char**) &global_system_variables.myisam_max_sort_file_size,
3700
(char**) &max_system_variables.myisam_max_sort_file_size, 0,
3701
GET_ULL, REQUIRED_ARG, (int64_t) LONG_MAX, 0, (uint64_t) MAX_FILE_SIZE,
3703
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
3704
N_("Number of threads to use when repairing MyISAM tables. The value of "
3705
"1 disables parallel repair."),
3706
(char**) &global_system_variables.myisam_repair_threads,
3707
(char**) &max_system_variables.myisam_repair_threads, 0,
3708
GET_ULONG, REQUIRED_ARG, 1, 1, ULONG_MAX, 0, 1, 0},
3709
{"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
3710
N_("The buffer that is allocated when sorting the index when doing a "
3711
"REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."),
3712
(char**) &global_system_variables.myisam_sort_buff_size,
3713
(char**) &max_system_variables.myisam_sort_buff_size, 0,
3714
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, INT32_MAX, 0, 1, 0},
3715
{"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
3716
N_("Specifies how MyISAM index statistics collection code should threat "
3717
"NULLs. Possible values of name are 'nulls_unequal' "
3718
"(default behavior), "
3719
"'nulls_equal' (emulate MySQL 4.0 behavior), and 'nulls_ignored'."),
3720
(char**) &myisam_stats_method_str, (char**) &myisam_stats_method_str, 0,
3721
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3722
1936
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
3723
1937
N_("Buffer length for TCP/IP and socket communication."),
3724
1938
(char**) &global_system_variables.net_buffer_length,
3725
(char**) &max_system_variables.net_buffer_length, 0, GET_ULONG,
1939
(char**) &max_system_variables.net_buffer_length, 0, GET_UINT32,
3726
1940
REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0},
3727
{"net_read_timeout", OPT_NET_READ_TIMEOUT,
3728
N_("Number of seconds to wait for more data from a connection before "
3729
"aborting the read."),
3730
(char**) &global_system_variables.net_read_timeout,
3731
(char**) &max_system_variables.net_read_timeout, 0, GET_ULONG,
3732
REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3733
{"net_retry_count", OPT_NET_RETRY_COUNT,
3734
N_("If a read on a communication port is interrupted, retry this many "
3735
"times before giving up."),
3736
(char**) &global_system_variables.net_retry_count,
3737
(char**) &max_system_variables.net_retry_count,0,
3738
GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ULONG_MAX, 0, 1, 0},
3739
{"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
3740
N_("Number of seconds to wait for a block to be written to a connection "
3741
"before aborting the write."),
3742
(char**) &global_system_variables.net_write_timeout,
3743
(char**) &max_system_variables.net_write_timeout, 0, GET_ULONG,
3744
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3745
{ "old", OPT_OLD_MODE,
3746
N_("Use compatible behavior."),
3747
(char**) &global_system_variables.old_mode,
3748
(char**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
3750
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
3751
N_("If this is not 0, then mysqld will use this value to reserve file "
3752
"descriptors to use with setrlimit(). If this value is 0 then mysqld "
3753
"will reserve max_connections*5 or max_connections + table_cache*2 "
3754
"(whichever is larger) number of files."),
3755
(char**) &open_files_limit, (char**) &open_files_limit, 0, GET_ULONG,
3756
REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0},
3757
1941
{"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL,
3758
N_("Controls the heuristic(s) applied during query optimization to prune "
3759
"less-promising partial plans from the optimizer search space. Meaning: "
3760
"0 - do not apply any heuristic, thus perform exhaustive search; "
3761
"1 - prune plans based on number of retrieved rows."),
3762
(char**) &global_system_variables.optimizer_prune_level,
3763
(char**) &max_system_variables.optimizer_prune_level,
3764
0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0},
1942
N_("Controls the heuristic(s) applied during query optimization to prune "
1943
"less-promising partial plans from the optimizer search space. Meaning: "
1944
"false - do not apply any heuristic, thus perform exhaustive search; "
1945
"true - prune plans based on number of retrieved rows."),
1946
(char**) &global_system_variables.optimizer_prune_level,
1947
(char**) &max_system_variables.optimizer_prune_level,
1948
0, GET_BOOL, OPT_ARG, 1, 0, 1, 0, 1, 0},
3765
1949
{"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH,
3766
1950
N_("Maximum depth of search performed by the query optimizer. Values "
3767
1951
"larger than the number of relations in a query result in better query "
3773
1957
"testing/comparison)."),
3774
1958
(char**) &global_system_variables.optimizer_search_depth,
3775
1959
(char**) &max_system_variables.optimizer_search_depth,
3776
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
1960
0, GET_UINT, OPT_ARG, 0, 0, MAX_TABLES+2, 0, 1, 0},
3777
1961
{"plugin_dir", OPT_PLUGIN_DIR,
3778
1962
N_("Directory for plugins."),
3779
1963
(char**) &opt_plugin_dir_ptr, (char**) &opt_plugin_dir_ptr, 0,
3780
1964
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3781
1965
{"plugin_load", OPT_PLUGIN_LOAD,
3782
N_("Optional comma separated list of plugins to load, where each plugin is "
3783
"identified by the name of the shared library. "
3784
"[for example: --plugin_load=libmd5udf.so]"),
1966
N_("Optional comma separated list of plugins to load at starup."
1967
"[for example: --plugin_load=crc32,logger_gearman]"),
3785
1968
(char**) &opt_plugin_load, (char**) &opt_plugin_load, 0,
3786
1969
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3787
1970
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
3788
1971
N_("The size of the buffer that is allocated when preloading indexes"),
3789
1972
(char**) &global_system_variables.preload_buff_size,
3790
(char**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
1973
(char**) &max_system_variables.preload_buff_size, 0, GET_ULL,
3791
1974
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
3792
1975
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
3793
1976
N_("Allocation block size for query parsing and execution"),
3794
1977
(char**) &global_system_variables.query_alloc_block_size,
3795
(char**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
1978
(char**) &max_system_variables.query_alloc_block_size, 0, GET_UINT,
3796
1979
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3797
1980
{"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
3798
1981
N_("Persistent buffer for query parsing and execution"),
3799
1982
(char**) &global_system_variables.query_prealloc_size,
3800
(char**) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
1983
(char**) &max_system_variables.query_prealloc_size, 0, GET_UINT,
3801
1984
REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE,
3802
1985
ULONG_MAX, 0, 1024, 0},
3803
1986
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
3804
1987
N_("Allocation block size for storing ranges during optimization"),
3805
1988
(char**) &global_system_variables.range_alloc_block_size,
3806
(char**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
3807
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX,
1989
(char**) &max_system_variables.range_alloc_block_size, 0, GET_SIZE,
1990
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, SIZE_MAX,
3809
1992
{"read_buffer_size", OPT_RECORD_BUFFER,
3810
N_("Each thread that does a sequential scan allocates a buffer of this "
3811
"size for each table it scans. If you do many sequential scans, you may "
3812
"want to increase this value."),
3813
(char**) &global_system_variables.read_buff_size,
3814
(char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3815
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE,
3817
{"read_only", OPT_READONLY,
3818
N_("Make all non-temporary tables read-only, with the exception for "
3819
"replication (slave) threads and users with the SUPER privilege"),
3820
(char**) &opt_readonly,
3821
(char**) &opt_readonly,
3822
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
1993
N_("Each thread that does a sequential scan allocates a buffer of this "
1994
"size for each table it scans. If you do many sequential scans, you may "
1995
"want to increase this value."),
1996
(char**) &global_system_variables.read_buff_size,
1997
(char**) &max_system_variables.read_buff_size,0, GET_UINT, REQUIRED_ARG,
1998
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE,
3823
2000
{"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
3824
2001
N_("When reading rows in sorted order after a sort, the rows are read "
3825
2002
"through this buffer to avoid a disk seeks. If not set, then it's set "
3826
2003
"to the value of record_buffer."),
3827
2004
(char**) &global_system_variables.read_rnd_buff_size,
3828
2005
(char**) &max_system_variables.read_rnd_buff_size, 0,
3829
GET_ULONG, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
3830
INT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
3831
{"record_buffer", OPT_RECORD_BUFFER,
3832
"Alias for read_buffer_size",
3833
(char**) &global_system_variables.read_buff_size,
3834
(char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3835
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD,
3836
INT32_MAX, MALLOC_OVERHEAD, IO_SIZE, 0},
3837
{"relay_log_purge", OPT_RELAY_LOG_PURGE,
3838
N_("0 = do not purge relay logs. "
3839
"1 = purge them as soon as they are no more needed."),
3840
(char**) &relay_log_purge,
3841
(char**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
3843
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
3844
N_("Maximum space to use for all relay logs."),
3845
(char**) &relay_log_space_limit,
3846
(char**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
3847
(int64_t) ULONG_MAX, 0, 1, 0},
3848
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
3849
N_("Use compression on master/slave protocol."),
3850
(char**) &opt_slave_compressed_protocol,
3851
(char**) &opt_slave_compressed_protocol,
3852
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3853
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
3854
N_("Number of seconds to wait for more data from a master/slave connection "
3855
"before aborting the read."),
3856
(char**) &slave_net_timeout, (char**) &slave_net_timeout, 0,
3857
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3858
{"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES,
3859
N_("Number of times the slave SQL thread will retry a transaction in case "
3860
"it failed with a deadlock or elapsed lock wait timeout, "
3861
"before giving up and stopping."),
3862
(char**) &slave_trans_retries, (char**) &slave_trans_retries, 0,
3863
GET_ULONG, REQUIRED_ARG, 10L, 0L, (int64_t) ULONG_MAX, 0, 1, 0},
3864
{"slave-allow-batching", OPT_SLAVE_ALLOW_BATCHING,
3865
N_("Allow slave to batch requests."),
3866
(char**) &slave_allow_batching, (char**) &slave_allow_batching,
3867
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3868
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
3869
N_("If creating the thread takes longer than this value (in seconds), the "
3870
"Slow_launch_threads counter will be incremented."),
3871
(char**) &slow_launch_time, (char**) &slow_launch_time, 0, GET_ULONG,
3872
REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
2006
GET_UINT, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
2007
UINT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
2008
{"scheduler", OPT_SCHEDULER,
2009
N_("Select scheduler to be used (by default multi-thread)."),
2010
(char**)&opt_scheduler, (char**)&opt_scheduler,
2011
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2012
/* x8 compared to MySQL's x2. We have UTF8 to consider. */
3873
2013
{"sort_buffer_size", OPT_SORT_BUFFER,
3874
2014
N_("Each thread that needs to do a sort allocates a buffer of this size."),
3875
2015
(char**) &global_system_variables.sortbuff_size,
3876
(char**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
3877
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ULONG_MAX,
2016
(char**) &max_system_variables.sortbuff_size, 0, GET_SIZE, REQUIRED_ARG,
2017
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*8, SIZE_MAX,
3878
2018
MALLOC_OVERHEAD, 1, 0},
3879
{"sync-binlog", OPT_SYNC_BINLOG,
3880
N_("Synchronously flush binary log to disk after every #th event. "
3881
"Use 0 (default) to disable synchronous flushing."),
3882
(char**) &sync_binlog_period, (char**) &sync_binlog_period, 0, GET_ULONG,
3883
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
3884
2019
{"table_definition_cache", OPT_TABLE_DEF_CACHE,
3885
2020
N_("The number of cached table definitions."),
3886
2021
(char**) &table_def_size, (char**) &table_def_size,
3887
0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
2022
0, GET_ULL, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
3888
2023
{"table_open_cache", OPT_TABLE_OPEN_CACHE,
3889
2024
N_("The number of cached open tables."),
3890
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG,
2025
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_UINT64,
3891
2026
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
3892
2027
{"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT,
3893
2028
N_("Timeout in seconds to wait for a table level lock before returning an "
3894
2029
"error. Used only if the connection has active cursors."),
3895
2030
(char**) &table_lock_wait_timeout, (char**) &table_lock_wait_timeout,
3896
0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
3897
{"thread_cache_size", OPT_THREAD_CACHE_SIZE,
3898
N_("How many threads we should keep in a cache for reuse."),
3899
(char**) &thread_cache_size, (char**) &thread_cache_size, 0, GET_ULONG,
3900
REQUIRED_ARG, 0, 0, 16384, 0, 1, 0},
3901
{"thread_pool_size", OPT_THREAD_CACHE_SIZE,
3902
N_("How many threads we should create to handle query requests in case of "
3903
"'thread_handling=pool-of-threads'"),
3904
(char**) &thread_pool_size, (char**) &thread_pool_size, 0, GET_ULONG,
3905
REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
2031
0, GET_ULL, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
3906
2032
{"thread_stack", OPT_THREAD_STACK,
3907
2033
N_("The stack size for each thread."),
3908
2034
(char**) &my_thread_stack_size,
3909
(char**) &my_thread_stack_size, 0, GET_ULONG,
2035
(char**) &my_thread_stack_size, 0, GET_SIZE,
3910
2036
REQUIRED_ARG,DEFAULT_THREAD_STACK,
3911
1024L*128L, ULONG_MAX, 0, 1024, 0},
3912
{ "time_format", OPT_TIME_FORMAT,
3913
N_("The TIME format (for future)."),
3914
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_TIME],
3915
(char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_TIME],
3916
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2037
UINT32_C(1024*512), SIZE_MAX, 0, 1024, 0},
3917
2038
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
3918
N_("If an internal in-memory temporary table exceeds this size, MySQL will"
2039
N_("If an internal in-memory temporary table exceeds this size, Drizzle will"
3919
2040
" automatically convert it to an on-disk MyISAM table."),
3920
2041
(char**) &global_system_variables.tmp_table_size,
3921
2042
(char**) &max_system_variables.tmp_table_size, 0, GET_ULL,
3923
2044
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
3924
2045
N_("Allocation block size for transactions to be stored in binary log"),
3925
2046
(char**) &global_system_variables.trans_alloc_block_size,
3926
(char**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
2047
(char**) &max_system_variables.trans_alloc_block_size, 0, GET_UINT,
3927
2048
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3928
2049
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
3929
2050
N_("Persistent buffer for transactions to be stored in binary log"),
3930
2051
(char**) &global_system_variables.trans_prealloc_size,
3931
(char**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
2052
(char**) &max_system_variables.trans_prealloc_size, 0, GET_UINT,
3932
2053
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3933
{"wait_timeout", OPT_WAIT_TIMEOUT,
3934
N_("The number of seconds the server waits for activity on a connection "
3935
"before closing it."),
3936
(char**) &global_system_variables.net_wait_timeout,
3937
(char**) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
3938
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT,
3940
2054
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
3943
static int show_net_compression(THD *thd __attribute__((unused)),
3945
char *buff __attribute__((unused)))
3947
var->type= SHOW_MY_BOOL;
3948
var->value= (char *)&thd->net.compress;
3952
static st_show_var_func_container
3953
show_net_compression_cont= { &show_net_compression };
3955
static int show_starttime(THD *thd, SHOW_VAR *var, char *buff)
2057
static int show_starttime(SHOW_VAR *var, char *buff)
3957
2059
var->type= SHOW_LONG;
3958
2060
var->value= buff;
3959
*((long *)buff)= (long) (thd->query_start() - server_start_time);
2061
*((long *)buff)= (long) (time(NULL) - server_start_time);
3963
2065
static st_show_var_func_container
3964
2066
show_starttime_cont= { &show_starttime };
3966
static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff)
2068
static int show_flushstatustime(SHOW_VAR *var, char *buff)
3968
2070
var->type= SHOW_LONG;
3969
2071
var->value= buff;
3970
*((long *)buff)= (long) (thd->query_start() - flush_status_time);
2072
*((long *)buff)= (long) (time(NULL) - flush_status_time);
3974
2076
static st_show_var_func_container
3975
2077
show_flushstatustime_cont= { &show_flushstatustime };
3977
static int show_slave_running(THD *thd __attribute__((unused)),
3978
SHOW_VAR *var, char *buff)
3980
var->type= SHOW_MY_BOOL;
3981
pthread_mutex_lock(&LOCK_active_mi);
3983
*((bool *)buff)= (bool) (active_mi && active_mi->slave_running &&
3984
active_mi->rli.slave_running);
3985
pthread_mutex_unlock(&LOCK_active_mi);
3989
static st_show_var_func_container
3990
show_slave_running_cont= { &show_slave_running };
3992
static int show_slave_retried_trans(THD *thd __attribute__((unused)),
3993
SHOW_VAR *var, char *buff)
3996
TODO: with multimaster, have one such counter per line in
3997
SHOW SLAVE STATUS, and have the sum over all lines here.
3999
pthread_mutex_lock(&LOCK_active_mi);
4002
var->type= SHOW_LONG;
4004
pthread_mutex_lock(&active_mi->rli.data_lock);
4005
*((long *)buff)= (long)active_mi->rli.retried_trans;
4006
pthread_mutex_unlock(&active_mi->rli.data_lock);
4009
var->type= SHOW_UNDEF;
4010
pthread_mutex_unlock(&LOCK_active_mi);
4014
static st_show_var_func_container
4015
show_slave_retried_trans_cont= { &show_slave_retried_trans };
4017
static int show_slave_received_heartbeats(THD *thd __attribute__((unused)),
4018
SHOW_VAR *var, char *buff)
4020
pthread_mutex_lock(&LOCK_active_mi);
4023
var->type= SHOW_LONGLONG;
4025
pthread_mutex_lock(&active_mi->rli.data_lock);
4026
*((int64_t *)buff)= active_mi->received_heartbeats;
4027
pthread_mutex_unlock(&active_mi->rli.data_lock);
4030
var->type= SHOW_UNDEF;
4031
pthread_mutex_unlock(&LOCK_active_mi);
4035
static st_show_var_func_container
4036
show_slave_received_heartbeats_cont= { &show_slave_received_heartbeats };
4038
static int show_heartbeat_period(THD *thd __attribute__((unused)),
4039
SHOW_VAR *var, char *buff)
4041
pthread_mutex_lock(&LOCK_active_mi);
4044
var->type= SHOW_CHAR;
4046
sprintf(buff, "%.3f",active_mi->heartbeat_period);
4049
var->type= SHOW_UNDEF;
4050
pthread_mutex_unlock(&LOCK_active_mi);
4054
static st_show_var_func_container
4055
show_heartbeat_period_cont= { &show_heartbeat_period};
4057
static int show_open_tables(THD *thd __attribute__((unused)),
4058
SHOW_VAR *var, char *buff)
2079
static int show_open_tables(SHOW_VAR *var, char *buff)
4060
2081
var->type= SHOW_LONG;
4061
2082
var->value= buff;
4132
2148
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
4133
2149
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
4134
2150
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
4135
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG},
4136
{"Slave_retried_transactions",(char*) &show_slave_retried_trans_cont, SHOW_FUNC},
4137
{"Slave_heartbeat_period", (char*) &show_heartbeat_period_cont, SHOW_FUNC},
4138
{"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats_cont, SHOW_FUNC},
4139
{"Slave_running", (char*) &show_slave_running_cont, SHOW_FUNC},
4140
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
4141
2151
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
4142
2152
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
4143
2153
{"Sort_range", (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS},
4144
2154
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS},
4145
2155
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
4146
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG},
4147
{"Table_locks_waited", (char*) &locks_waited, SHOW_LONG},
4149
{"Tc_log_max_pages_used", (char*) &tc_log_max_pages_used, SHOW_LONG},
4150
{"Tc_log_page_size", (char*) &tc_log_page_size, SHOW_LONG},
4151
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG},
4153
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH},
2156
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_INT},
2157
{"Table_locks_waited", (char*) &locks_waited, SHOW_INT},
4154
2158
{"Threads_connected", (char*) &connection_count, SHOW_INT},
4155
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
4156
{"Threads_running", (char*) &thread_running, SHOW_INT},
4157
2159
{"Uptime", (char*) &show_starttime_cont, SHOW_FUNC},
4158
2160
{"Uptime_since_flush_status",(char*) &show_flushstatustime_cont, SHOW_FUNC},
4159
{NULL, NULL, SHOW_LONG}
2161
{NULL, NULL, SHOW_LONGLONG}
4162
2164
static void print_version(void)
4164
set_server_version();
4166
2167
Note: the instance manager keys off the string 'Ver' so it can find the
4167
version from the output of 'mysqld --version', so don't change it!
2168
version from the output of 'drizzled --version', so don't change it!
4169
printf("%s Ver %s for %s on %s (%s)\n",my_progname,
4170
server_version,SYSTEM_TYPE,MACHINE_TYPE, DRIZZLE_COMPILATION_COMMENT);
2170
printf("%s Ver %s for %s-%s on %s (%s)\n",my_progname,
2171
VERSION, HOST_VENDOR, HOST_OS, HOST_CPU, COMPILATION_COMMENT);
4173
2174
static void usage(void)
4175
if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
2176
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
4179
2178
if (!default_collation_name)
4180
2179
default_collation_name= (char*) default_charset_info->name;
4181
2180
print_version();
4182
puts(_("Copyright (C) 2000 MySQL AB, by Monty and others\n"
2181
puts(_("Copyright (C) 2008 Sun Microsystems\n"
4183
2182
"This software comes with ABSOLUTELY NO WARRANTY. "
4184
2183
"This is free software,\n"
4185
2184
"and you are welcome to modify and redistribute it under the GPL "
4219
2212
as these are initialized by my_getopt.
4222
static void mysql_init_variables(void)
2215
static void drizzle_init_variables(void)
4224
2217
/* Things reset to zero */
4225
opt_skip_slave_start= opt_reckless_slave = 0;
4226
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
4227
log_output_options= find_bit_type(log_output_str, &log_output_typelib);
4230
opt_logname= opt_binlog_index_name= 0;
2218
drizzle_home[0]= pidfile_name[0]= 0;
4231
2219
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
4233
2220
opt_secure_file_priv= 0;
4234
segfaulted= kill_in_progress= 0;
4235
2222
cleanup_done= 0;
4236
2223
defaults_argc= 0;
4237
2224
defaults_argv= 0;
4238
server_id_supplied= 0;
4239
test_flags= select_errors= dropping_tables= ha_open_options=0;
4240
thread_count= thread_running= kill_cached_threads= wake_thread=0;
4241
slave_open_temp_tables= 0;
4242
cached_thread_count= 0;
4243
opt_endinfo= using_udf_functions= 0;
4244
opt_using_transactions= using_update_log= 0;
4245
abort_loop= select_thread_in_use= signal_thread_in_use= 0;
2225
dropping_tables= ha_open_options=0;
2229
abort_loop= select_thread_in_use= false;
4246
2230
ready_to_exit= shutdown_in_progress= 0;
4247
2231
aborted_threads= aborted_connects= 0;
4249
binlog_cache_use= binlog_cache_disk_use= 0;
4250
max_used_connections= slow_launch_threads = 0;
4251
mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0;
4252
opt_mysql_tmpdir= my_bind_addr_str= NULL;
4253
memset(&mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
2232
max_used_connections= 0;
2233
drizzled_user= drizzled_chroot= 0;
2234
drizzled_bind_host= NULL;
4254
2235
memset(&global_status_var, 0, sizeof(global_status_var));
4255
key_map_full.set_all();
4257
2238
/* Character sets */
4258
2239
system_charset_info= &my_charset_utf8_general_ci;
4259
2240
files_charset_info= &my_charset_utf8_general_ci;
4260
national_charset_info= &my_charset_utf8_general_ci;
4261
2241
table_alias_charset= &my_charset_bin;
4262
2242
character_set_filesystem= &my_charset_bin;
4264
opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
4266
2244
/* Things with default values that are not zero */
4267
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
4268
slave_exec_mode_options= 0;
4269
slave_exec_mode_options= (uint)
4270
find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL);
4271
mysql_home_ptr= mysql_home;
2245
drizzle_home_ptr= drizzle_home;
4272
2246
pidfile_name_ptr= pidfile_name;
4273
log_error_file_ptr= log_error_file;
4274
2247
language_ptr= language;
4275
mysql_data_home= mysql_real_data_home;
4276
thd_startup_options= (OPTION_AUTO_IS_NULL | OPTION_BIN_LOG |
4277
OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES);
4278
protocol_version= PROTOCOL_VERSION;
4279
what_to_log= ~ (1L << (uint) COM_TIME);
2248
drizzle_data_home= drizzle_real_data_home;
2249
session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES);
4280
2250
refresh_version= 1L; /* Increments on each reload */
4281
global_query_id= thread_id= 1L;
4282
my_stpcpy(server_version, DRIZZLE_SERVER_VERSION);
4283
myisam_recover_options_str= "OFF";
4284
myisam_stats_method_str= "nulls_unequal";
4286
thread_cache.empty();
4288
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
4289
default_key_cache_base.length)))
4291
/* set key_cache_hash.default_value = dflt_key_cache */
4292
multi_keycache_init();
2251
global_thread_id= 1UL;
2252
session_list.clear();
4294
2254
/* Set directory paths */
4295
strmake(language, LANGUAGE, sizeof(language)-1);
4296
strmake(mysql_real_data_home, get_relative_path(DATADIR),
4297
sizeof(mysql_real_data_home)-1);
4298
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
4299
mysql_data_home_buff[1]=0;
4300
mysql_data_home_len= 2;
4302
/* Replication parameters */
4303
master_info_file= (char*) "master.info",
4304
relay_log_info_file= (char*) "relay-log.info";
4305
report_user= report_password = report_host= 0; /* TO BE DELETED */
4306
opt_relay_logname= opt_relaylog_index_name= 0;
2255
strncpy(language, LANGUAGE, sizeof(language)-1);
2256
strncpy(drizzle_real_data_home, get_relative_path(LOCALSTATEDIR),
2257
sizeof(drizzle_real_data_home)-1);
2258
drizzle_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
2259
drizzle_data_home_buff[1]=0;
2260
drizzle_data_home_len= 2;
4308
2262
/* Variables in libraries */
4310
default_character_set_name= (char*) DRIZZLE_DEFAULT_CHARSET_NAME;
4311
default_collation_name= compiled_default_collation_name;
4312
sys_charset_system.set((char*) system_charset_info->csname);
4313
character_set_filesystem_name= (char*) "binary";
2263
default_character_set_name= "utf8";
2264
default_collation_name= (char *)compiled_default_collation_name;
2265
character_set_filesystem_name= "binary";
4314
2266
lc_time_names_name= (char*) "en_US";
4315
2267
/* Set default values for some option variables */
4316
2268
default_storage_engine_str= (char*) "innodb";
4317
global_system_variables.table_plugin= NULL;
2269
global_system_variables.storage_engine= NULL;
4318
2270
global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
4319
2271
global_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
4320
2272
max_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
4321
2273
global_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
4322
2274
max_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
4323
global_system_variables.old_alter_table= 0;
4324
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
4326
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
4327
when collecting index statistics for MyISAM tables.
4329
global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
4331
2276
/* Variables that depends on compile options */
4333
2277
#ifdef HAVE_BROKEN_REALPATH
4334
2278
have_symlink=SHOW_OPTION_NO;
4336
2280
have_symlink=SHOW_OPTION_YES;
4338
#ifdef HAVE_COMPRESS
4339
have_compress= SHOW_OPTION_YES;
4341
have_compress= SHOW_OPTION_NO;
4344
2283
const char *tmpenv;
4345
2284
if (!(tmpenv = getenv("MY_BASEDIR_VERSION")))
4346
tmpenv = DEFAULT_DRIZZLE_HOME;
4347
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
2286
(void) strncpy(drizzle_home, tmpenv, sizeof(drizzle_home)-1);
2288
connection_count= 0;
4352
mysqld_get_one_option(int optid,
4353
const struct my_option *opt __attribute__((unused)),
2293
drizzled_get_one_option(int optid, const struct my_option *opt,
4356
2296
switch(optid) {
4737
2460
In most cases the global variables will not be used
4739
2462
my_default_record_cache_size=global_system_variables.read_buff_size;
4740
myisam_max_temp_length=
4741
(my_off_t) global_system_variables.myisam_max_sort_file_size;
4743
/* Set global variables based on startup options */
4744
myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
4746
/* long_query_time is in microseconds */
4747
global_system_variables.long_query_time= max_system_variables.long_query_time=
4748
(int64_t) (long_query_time * 1000000.0);
4750
if (init_global_datetime_format(DRIZZLE_TIMESTAMP_DATE,
4751
&global_system_variables.date_format) ||
4752
init_global_datetime_format(DRIZZLE_TIMESTAMP_TIME,
4753
&global_system_variables.time_format) ||
4754
init_global_datetime_format(DRIZZLE_TIMESTAMP_DATETIME,
4755
&global_system_variables.datetime_format))
4758
pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */
4763
Create version name for running mysqld version
4764
We automaticly add suffixes -debug, -embedded and -log to the version
4765
name to make the version more descriptive.
4766
(DRIZZLE_SERVER_SUFFIX is set by the compilation environment)
4769
#ifdef DRIZZLE_SERVER_SUFFIX
4770
#define DRIZZLE_SERVER_SUFFIX_STR STRINGIFY_ARG(DRIZZLE_SERVER_SUFFIX)
4772
#define DRIZZLE_SERVER_SUFFIX_STR DRIZZLE_SERVER_SUFFIX_DEF
4775
static void set_server_version(void)
4777
char *end= strxmov(server_version, DRIZZLE_SERVER_VERSION,
4778
DRIZZLE_SERVER_SUFFIX_STR, NULL);
4780
my_stpcpy(end, "-log"); // This may slow down system
4784
static char *get_relative_path(const char *path)
2466
static const char *get_relative_path(const char *path)
4786
2468
if (test_if_hard_path(path) &&
4787
is_prefix(path,DEFAULT_DRIZZLE_HOME) &&
4788
strcmp(DEFAULT_DRIZZLE_HOME,FN_ROOTDIR))
2469
is_prefix(path,PREFIX) &&
2470
strcmp(PREFIX,FN_ROOTDIR))
4790
path+=(uint) strlen(DEFAULT_DRIZZLE_HOME);
2472
if (strlen(PREFIX) < strlen(path))
2473
path+=(size_t) strlen(PREFIX);
4791
2474
while (*path == FN_LIBCHAR)
4794
return (char*) path;
4799
Fix filename and replace extension where 'dir' is relative to
4800
mysql_real_data_home.
4802
1 if len(path) > FN_REFLEN
4806
fn_format_relative_to_data_home(char * to, const char *name,
4807
const char *dir, const char *extension)
4809
char tmp_path[FN_REFLEN];
4810
if (!test_if_hard_path(dir))
4812
strxnmov(tmp_path,sizeof(tmp_path)-1, mysql_real_data_home,
4816
return !fn_format(to, name, dir, extension,
4817
MY_APPEND_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH);
4821
2481
static void fix_paths(void)
4823
char buff[FN_REFLEN],*pos;
4824
convert_dirname(mysql_home,mysql_home,NULL);
4825
/* Resolve symlinks to allow 'mysql_home' to be a relative symlink */
4826
my_realpath(mysql_home,mysql_home,MYF(0));
4827
/* Ensure that mysql_home ends in FN_LIBCHAR */
4828
pos= strchr(mysql_home, '\0');
2483
char buff[FN_REFLEN],*pos,rp_buff[PATH_MAX];
2484
convert_dirname(drizzle_home,drizzle_home,NULL);
2485
/* Resolve symlinks to allow 'drizzle_home' to be a relative symlink */
2486
#if defined(HAVE_BROKEN_REALPATH)
2487
my_load_path(drizzle_home, drizzle_home, NULL);
2489
if (!realpath(drizzle_home,rp_buff))
2490
my_load_path(rp_buff, drizzle_home, NULL);
2491
rp_buff[FN_REFLEN-1]= '\0';
2492
strcpy(drizzle_home,rp_buff);
2493
/* Ensure that drizzle_home ends in FN_LIBCHAR */
2494
pos= strchr(drizzle_home, '\0');
4829
2496
if (pos[-1] != FN_LIBCHAR)
4831
2498
pos[0]= FN_LIBCHAR;
4834
convert_dirname(mysql_real_data_home,mysql_real_data_home,NULL);
4835
(void) fn_format(buff, mysql_real_data_home, "", "",
2501
convert_dirname(drizzle_real_data_home,drizzle_real_data_home,NULL);
2502
(void) fn_format(buff, drizzle_real_data_home, "", "",
4836
2503
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
4837
(void) unpack_dirname(mysql_unpacked_real_data_home, buff);
2504
(void) unpack_dirname(drizzle_unpacked_real_data_home, buff);
4838
2505
convert_dirname(language,language,NULL);
4839
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
4840
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
4841
(void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
2506
(void) my_load_path(drizzle_home, drizzle_home,""); // Resolve current dir
2507
(void) my_load_path(drizzle_real_data_home, drizzle_real_data_home,drizzle_home);
2508
(void) my_load_path(pidfile_name, pidfile_name,drizzle_real_data_home);
4842
2509
(void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr :
4843
get_relative_path(PLUGINDIR), mysql_home);
2510
get_relative_path(PKGPLUGINDIR),
4844
2512
opt_plugin_dir_ptr= opt_plugin_dir;
4846
char *sharedir=get_relative_path(SHAREDIR);
2514
const char *sharedir= get_relative_path(PKGDATADIR);
4847
2515
if (test_if_hard_path(sharedir))
4848
strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */
2516
strncpy(buff,sharedir,sizeof(buff)-1);
4850
strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NULL);
2519
strcpy(buff, drizzle_home);
2520
strncat(buff, sharedir, sizeof(buff)-strlen(drizzle_home)-1);
4851
2522
convert_dirname(buff,buff,NULL);
4852
2523
(void) my_load_path(language,language,buff);
4854
/* If --character-sets-dir isn't given, use shared library dir */
4855
if (charsets_dir != mysql_charsets_dir)
4857
strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff,
4860
(void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff);
4861
convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NULL);
4862
charsets_dir=mysql_charsets_dir;
4864
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
4866
if (!slave_load_tmpdir)
4868
if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
2529
tmp_string= getenv("TMPDIR");
2531
if (opt_drizzle_tmpdir)
2532
drizzle_tmpdir= strdup(opt_drizzle_tmpdir);
2533
else if (tmp_string == NULL)
2534
drizzle_tmpdir= strdup(P_tmpdir);
2536
drizzle_tmpdir= strdup(tmp_string);
2538
assert(drizzle_tmpdir);
2540
if (stat(drizzle_tmpdir, &buf) || (S_ISDIR(buf.st_mode) == false))
4872
2547
Convert the secure-file-priv option to system format, allowing
4873
2548
a quick strcmp to check if read or write is in an allowed dir