655
1522
#define SA_NODEFER 0
661
const char *load_default_groups[]=
663
DRIZZLE_CONFIG_NAME, "server", 0, 0
666
static void find_plugin_dir(string progname)
668
fs::path full_progname(fs::system_complete(progname));
670
fs::path progdir(full_progname.parent_path());
671
if (progdir.filename() == ".libs")
673
progdir= progdir.parent_path();
676
if (fs::exists(progdir / "drizzled.lo") || fs::exists(progdir / "drizzled.o"))
678
/* We are in a source dir! Plugin dir is ../plugin/.libs */
679
base_plugin_dir= progdir.parent_path();
680
base_plugin_dir /= "plugin";
681
base_plugin_dir /= ".libs";
684
if (plugin_dir.root_directory() == "")
686
fs::path full_plugin_dir(fs::system_complete(base_plugin_dir));
687
full_plugin_dir /= plugin_dir;
688
plugin_dir= full_plugin_dir;
692
static void notify_plugin_dir(fs::path in_plugin_dir)
694
plugin_dir= in_plugin_dir;
695
if (plugin_dir.root_directory() == "")
697
fs::path full_plugin_dir(fs::system_complete(basedir));
698
full_plugin_dir /= plugin_dir;
699
plugin_dir= full_plugin_dir;
703
static void expand_secure_file_priv(fs::path in_secure_file_priv)
705
secure_file_priv= fs::system_complete(in_secure_file_priv);
708
static void check_limits_aii(uint64_t in_auto_increment_increment)
710
global_system_variables.auto_increment_increment= 1;
711
if (in_auto_increment_increment < 1 || in_auto_increment_increment > UINT64_MAX)
713
cout << _("Error: Invalid Value for auto_increment_increment");
716
global_system_variables.auto_increment_increment= in_auto_increment_increment;
719
static void check_limits_aio(uint64_t in_auto_increment_offset)
721
global_system_variables.auto_increment_offset= 1;
722
if (in_auto_increment_offset < 1 || in_auto_increment_offset > UINT64_MAX)
724
cout << _("Error: Invalid Value for auto_increment_offset");
727
global_system_variables.auto_increment_offset= in_auto_increment_offset;
730
static void check_limits_completion_type(uint32_t in_completion_type)
732
global_system_variables.completion_type= 0;
733
if (in_completion_type > 2)
735
cout << _("Error: Invalid Value for completion_type");
738
global_system_variables.completion_type= in_completion_type;
742
static void check_limits_dpi(uint32_t in_div_precincrement)
744
global_system_variables.div_precincrement= 4;
745
if (in_div_precincrement > DECIMAL_MAX_SCALE)
747
cout << _("Error: Invalid Value for div-precision-increment");
750
global_system_variables.div_precincrement= in_div_precincrement;
753
static void check_limits_gcml(uint64_t in_group_concat_max_len)
755
global_system_variables.group_concat_max_len= 1024;
756
if (in_group_concat_max_len > ULONG_MAX || in_group_concat_max_len < 4)
758
cout << _("Error: Invalid Value for group_concat_max_len");
761
global_system_variables.group_concat_max_len= in_group_concat_max_len;
764
static void check_limits_join_buffer_size(uint64_t in_join_buffer_size)
766
global_system_variables.join_buff_size= (128*1024L);
767
if (in_join_buffer_size < IO_SIZE*2 || in_join_buffer_size > ULONG_MAX)
769
cout << _("Error: Invalid Value for join_buffer_size");
772
in_join_buffer_size-= in_join_buffer_size % IO_SIZE;
773
global_system_variables.join_buff_size= in_join_buffer_size;
776
static void check_limits_map(uint32_t in_max_allowed_packet)
778
global_system_variables.max_allowed_packet= (64*1024*1024L);
779
if (in_max_allowed_packet < 1024 || in_max_allowed_packet > 1024*1024L*1024L)
781
cout << _("Error: Invalid Value for max_allowed_packet");
784
in_max_allowed_packet-= in_max_allowed_packet % 1024;
785
global_system_variables.max_allowed_packet= in_max_allowed_packet;
788
static void check_limits_max_err_cnt(uint64_t in_max_error_count)
790
global_system_variables.max_error_count= DEFAULT_ERROR_COUNT;
791
if (in_max_error_count > 65535)
793
cout << _("Error: Invalid Value for max_error_count");
796
global_system_variables.max_error_count= in_max_error_count;
799
static void check_limits_mhts(uint64_t in_max_heap_table_size)
801
global_system_variables.max_heap_table_size= (16*1024*1024L);
802
if (in_max_heap_table_size < 16384 || in_max_heap_table_size > MAX_MEM_TABLE_SIZE)
804
cout << _("Error: Invalid Value for max_heap_table_size");
807
in_max_heap_table_size-= in_max_heap_table_size % 1024;
808
global_system_variables.max_heap_table_size= in_max_heap_table_size;
811
static void check_limits_merl(uint64_t in_min_examined_row_limit)
813
global_system_variables.min_examined_row_limit= 0;
814
if (in_min_examined_row_limit > ULONG_MAX)
816
cout << _("Error: Invalid Value for min_examined_row_limit");
819
global_system_variables.min_examined_row_limit= in_min_examined_row_limit;
822
static void check_limits_max_join_size(drizzled::ha_rows in_max_join_size)
824
global_system_variables.max_join_size= INT32_MAX;
825
if ((uint64_t)in_max_join_size < 1 || (uint64_t)in_max_join_size > INT32_MAX)
827
cout << _("Error: Invalid Value for max_join_size");
830
global_system_variables.max_join_size= in_max_join_size;
833
static void check_limits_mlfsd(int64_t in_max_length_for_sort_data)
835
global_system_variables.max_length_for_sort_data= 1024;
836
if (in_max_length_for_sort_data < 4 || in_max_length_for_sort_data > 8192*1024L)
838
cout << _("Error: Invalid Value for max_length_for_sort_data");
841
global_system_variables.max_length_for_sort_data= in_max_length_for_sort_data;
844
static void check_limits_msfk(uint64_t in_max_seeks_for_key)
846
global_system_variables.max_seeks_for_key= ULONG_MAX;
847
if (in_max_seeks_for_key < 1 || in_max_seeks_for_key > ULONG_MAX)
849
cout << _("Error: Invalid Value for max_seeks_for_key");
852
global_system_variables.max_seeks_for_key= in_max_seeks_for_key;
855
static void check_limits_max_sort_length(size_t in_max_sort_length)
857
global_system_variables.max_sort_length= 1024;
858
if ((int64_t)in_max_sort_length < 4 || (int64_t)in_max_sort_length > 8192*1024L)
860
cout << _("Error: Invalid Value for max_sort_length");
863
global_system_variables.max_sort_length= in_max_sort_length;
866
static void check_limits_osd(uint32_t in_optimizer_search_depth)
868
global_system_variables.optimizer_search_depth= 0;
869
if (in_optimizer_search_depth > MAX_TABLES + 2)
871
cout << _("Error: Invalid Value for optimizer_search_depth");
874
global_system_variables.optimizer_search_depth= in_optimizer_search_depth;
877
static void check_limits_pbs(uint64_t in_preload_buff_size)
879
global_system_variables.preload_buff_size= (32*1024L);
880
if (in_preload_buff_size < 1024 || in_preload_buff_size > 1024*1024*1024L)
882
cout << _("Error: Invalid Value for preload_buff_size");
885
global_system_variables.preload_buff_size= in_preload_buff_size;
888
static void check_limits_qabs(uint32_t in_query_alloc_block_size)
890
global_system_variables.query_alloc_block_size= QUERY_ALLOC_BLOCK_SIZE;
891
if (in_query_alloc_block_size < 1024)
893
cout << _("Error: Invalid Value for query_alloc_block_size");
896
in_query_alloc_block_size-= in_query_alloc_block_size % 1024;
897
global_system_variables.query_alloc_block_size= in_query_alloc_block_size;
900
static void check_limits_qps(uint32_t in_query_prealloc_size)
902
global_system_variables.query_prealloc_size= QUERY_ALLOC_PREALLOC_SIZE;
903
if (in_query_prealloc_size < QUERY_ALLOC_PREALLOC_SIZE)
905
cout << _("Error: Invalid Value for query_prealloc_size");
908
in_query_prealloc_size-= in_query_prealloc_size % 1024;
909
global_system_variables.query_prealloc_size= in_query_prealloc_size;
912
static void check_limits_rabs(size_t in_range_alloc_block_size)
914
global_system_variables.range_alloc_block_size= RANGE_ALLOC_BLOCK_SIZE;
915
if (in_range_alloc_block_size < RANGE_ALLOC_BLOCK_SIZE)
917
cout << _("Error: Invalid Value for range_alloc_block_size");
920
in_range_alloc_block_size-= in_range_alloc_block_size % 1024;
921
global_system_variables.range_alloc_block_size= in_range_alloc_block_size;
924
static void check_limits_read_buffer_size(int32_t in_read_buff_size)
926
global_system_variables.read_buff_size= (128*1024L);
927
if (in_read_buff_size < IO_SIZE*2 || in_read_buff_size > INT32_MAX)
929
cout << _("Error: Invalid Value for read_buff_size");
932
in_read_buff_size-= in_read_buff_size % IO_SIZE;
933
global_system_variables.read_buff_size= in_read_buff_size;
936
static void check_limits_read_rnd_buffer_size(uint32_t in_read_rnd_buff_size)
938
global_system_variables.read_rnd_buff_size= (256*1024L);
939
if (in_read_rnd_buff_size < 64 || in_read_rnd_buff_size > UINT32_MAX)
941
cout << _("Error: Invalid Value for read_rnd_buff_size");
944
global_system_variables.read_rnd_buff_size= in_read_rnd_buff_size;
947
static void check_limits_sort_buffer_size(size_t in_sortbuff_size)
949
global_system_variables.sortbuff_size= MAX_SORT_MEMORY;
950
if ((uint32_t)in_sortbuff_size < MIN_SORT_MEMORY)
952
cout << _("Error: Invalid Value for sort_buff_size");
955
global_system_variables.sortbuff_size= in_sortbuff_size;
958
static void check_limits_tdc(uint32_t in_table_def_size)
961
if (in_table_def_size < 1 || in_table_def_size > 512*1024L)
963
cout << _("Error: Invalid Value for table_def_size");
966
table_def_size= in_table_def_size;
969
static void check_limits_toc(uint32_t in_table_cache_size)
971
table_cache_size= TABLE_OPEN_CACHE_DEFAULT;
972
if (in_table_cache_size < TABLE_OPEN_CACHE_MIN || in_table_cache_size > 512*1024L)
974
cout << _("Error: Invalid Value for table_cache_size");
977
table_cache_size= in_table_cache_size;
980
static void check_limits_tlwt(uint64_t in_table_lock_wait_timeout)
982
table_lock_wait_timeout= 50;
983
if (in_table_lock_wait_timeout < 1 || in_table_lock_wait_timeout > 1024*1024*1024)
985
cout << _("Error: Invalid Value for table_lock_wait_timeout");
988
table_lock_wait_timeout= in_table_lock_wait_timeout;
991
static void check_limits_thread_stack(uint32_t in_my_thread_stack_size)
993
my_thread_stack_size= in_my_thread_stack_size - (in_my_thread_stack_size % 1024);
996
static void check_limits_tmp_table_size(uint64_t in_tmp_table_size)
998
global_system_variables.tmp_table_size= 16*1024*1024L;
999
if (in_tmp_table_size < 1024 || in_tmp_table_size > MAX_MEM_TABLE_SIZE)
1001
cout << _("Error: Invalid Value for table_lock_wait_timeout");
1004
global_system_variables.tmp_table_size= in_tmp_table_size;
1007
static void check_limits_transaction_message_threshold(size_t in_transaction_message_threshold)
1009
transaction_message_threshold= 1024*1024;
1010
if ((int64_t) in_transaction_message_threshold < 128*1024 || (int64_t)in_transaction_message_threshold > 1024*1024)
1012
cout << _("Error: Invalid Value for transaction_message_threshold valid values are between 131072 - 1048576 bytes");
1015
transaction_message_threshold= in_transaction_message_threshold;
1018
static void process_defaults_files()
1020
for (vector<string>::iterator iter= defaults_file_list.begin();
1021
iter != defaults_file_list.end();
1024
fs::path file_location= *iter;
1026
ifstream input_defaults_file(file_location.file_string().c_str());
1028
po::parsed_options file_parsed=
1029
dpo::parse_config_file(input_defaults_file, full_options, true);
1030
vector<string> file_unknown=
1031
po::collect_unrecognized(file_parsed.options, po::include_positional);
1033
for (vector<string>::iterator it= file_unknown.begin();
1034
it != file_unknown.end();
1037
string new_unknown_opt("--");
1038
new_unknown_opt.append(*it);
1040
if (it != file_unknown.end())
1525
static void init_signals(void)
1528
struct sigaction sa;
1530
my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
1532
if (!(test_flags & TEST_NO_STACKTRACE) || (test_flags & TEST_CORE_ON_SIGNAL))
1534
sa.sa_flags = SA_RESETHAND | SA_NODEFER;
1535
sigemptyset(&sa.sa_mask);
1536
sigprocmask(SIG_SETMASK,&sa.sa_mask,NULL);
1539
sa.sa_handler=handle_segfault;
1540
sigaction(SIGSEGV, &sa, NULL);
1541
sigaction(SIGABRT, &sa, NULL);
1543
sigaction(SIGBUS, &sa, NULL);
1545
sigaction(SIGILL, &sa, NULL);
1546
sigaction(SIGFPE, &sa, NULL);
1549
#ifdef HAVE_GETRLIMIT
1550
if (test_flags & TEST_CORE_ON_SIGNAL)
1552
/* Change limits so that we will get a core file */
1554
rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
1555
if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
1556
sql_print_warning("setrlimit could not change the size of core files to 'infinity'; We may not be able to generate a core file on signals");
1559
(void) sigemptyset(&set);
1560
my_sigset(SIGPIPE,SIG_IGN);
1561
sigaddset(&set,SIGPIPE);
1562
#ifndef IGNORE_SIGHUP_SIGQUIT
1563
sigaddset(&set,SIGQUIT);
1564
sigaddset(&set,SIGHUP);
1566
sigaddset(&set,SIGTERM);
1568
/* Fix signals if blocked by parents (can happen on Mac OS X) */
1569
sigemptyset(&sa.sa_mask);
1571
sa.sa_handler = print_signal_warning;
1572
sigaction(SIGTERM, &sa, (struct sigaction*) 0);
1574
sa.sa_handler = print_signal_warning;
1575
sigaction(SIGHUP, &sa, (struct sigaction*) 0);
1577
sigaddset(&set,SIGTSTP);
1579
if (thd_lib_detected != THD_LIB_LT)
1580
sigaddset(&set,THR_SERVER_ALARM);
1581
if (test_flags & TEST_SIGINT)
1583
my_sigset(thr_kill_signal, end_thread_signal);
1585
sigdelset(&set, thr_kill_signal);
1588
sigaddset(&set,SIGINT);
1589
sigprocmask(SIG_SETMASK,&set,NULL);
1590
pthread_sigmask(SIG_SETMASK,&set,NULL);
1595
static void start_signal_handler(void)
1598
pthread_attr_t thr_attr;
1600
(void) pthread_attr_init(&thr_attr);
1601
pthread_attr_setscope(&thr_attr, PTHREAD_SCOPE_SYSTEM);
1602
(void) pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED);
1603
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
1605
struct sched_param tmp_sched_param;
1607
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
1608
tmp_sched_param.sched_priority= INTERRUPT_PRIOR;
1609
(void)pthread_attr_setschedparam(&thr_attr, &tmp_sched_param);
1611
#if defined(__ia64__) || defined(__ia64)
1613
Peculiar things with ia64 platforms - it seems we only have half the
1614
stack size in reality, so we have to double it here
1616
pthread_attr_setstacksize(&thr_attr,my_thread_stack_size*2);
1618
pthread_attr_setstacksize(&thr_attr,my_thread_stack_size);
1620
(void) pthread_mutex_lock(&LOCK_thread_count);
1621
if ((error=pthread_create(&signal_thread,&thr_attr,signal_hand,0)))
1623
sql_print_error("Can't create interrupt-thread (error %d, errno: %d)",
1627
(void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
1628
pthread_mutex_unlock(&LOCK_thread_count);
1630
(void) pthread_attr_destroy(&thr_attr);
1635
/** This threads handles all signals and alarms. */
1637
pthread_handler_t signal_hand(void *arg __attribute__((unused)))
1641
my_thread_init(); // Init new thread
1642
signal_thread_in_use= 1;
1646
This should actually be '+ max_number_of_slaves' instead of +10,
1647
but the +10 should be quite safe.
1649
init_thr_alarm(thread_scheduler.max_threads + 10);
1650
if (thd_lib_detected != THD_LIB_LT && (test_flags & TEST_SIGINT))
1652
(void) sigemptyset(&set); // Setup up SIGINT for debug
1653
(void) sigaddset(&set,SIGINT); // For debugging
1654
(void) pthread_sigmask(SIG_UNBLOCK,&set,NULL);
1656
(void) sigemptyset(&set); // Setup up SIGINT for debug
1657
#ifdef USE_ONE_SIGNAL_HAND
1658
(void) sigaddset(&set,THR_SERVER_ALARM); // For alarms
1660
#ifndef IGNORE_SIGHUP_SIGQUIT
1661
(void) sigaddset(&set,SIGQUIT);
1662
(void) sigaddset(&set,SIGHUP);
1664
(void) sigaddset(&set,SIGTERM);
1665
(void) sigaddset(&set,SIGTSTP);
1667
/* Save pid to this process (or thread on Linux) */
1671
#ifdef HAVE_STACK_TRACE_ON_SEGV
1674
sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (ulong)getpid());
1675
pstack_install_segv_action(pstack_file_name);
1677
#endif /* HAVE_STACK_TRACE_ON_SEGV */
1680
signal to start_signal_handler that we are ready
1681
This works by waiting for start_signal_handler to free mutex,
1682
after which we signal it that we are ready.
1683
At this pointer there is no other threads running, so there
1684
should not be any other pthread_cond_signal() calls.
1686
(void) pthread_mutex_lock(&LOCK_thread_count);
1687
(void) pthread_mutex_unlock(&LOCK_thread_count);
1688
(void) pthread_cond_broadcast(&COND_thread_count);
1690
(void) pthread_sigmask(SIG_BLOCK,&set,NULL);
1693
int error; // Used when debugging
1694
if (shutdown_in_progress && !abort_loop)
1700
while ((error=my_sigwait(&set,&sig)) == EINTR) ;
1704
signal_thread_in_use= 0;
1705
pthread_exit(0); // Safety
1712
sql_print_information("Got signal %d to shutdown mysqld",sig);
1714
/* switch to the old log message processing */
1715
logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
1716
opt_log ? LOG_FILE:LOG_NONE);
1042
if ((*it) != "true")
1719
abort_loop=1; // mark abort for threads
1720
#ifdef USE_ONE_SIGNAL_HAND
1722
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
1044
new_unknown_opt.push_back('=');
1045
new_unknown_opt.append(*it);
1724
struct sched_param tmp_sched_param;
1726
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
1727
tmp_sched_param.sched_priority= INTERRUPT_PRIOR;
1728
(void)pthread_attr_setschedparam(&connection_attrib, &tmp_sched_param);
1730
if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
1732
sql_print_error("Can't create thread to kill server");
1734
kill_server((void*) sig); // MIT THREAD has a alarm thread
1742
reload_cache((THD*) 0,
1743
(REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
1745
REFRESH_THREADS | REFRESH_HOSTS),
1746
(TABLE_LIST*) 0, ¬_used); // Flush logs
1748
/* reenable logs after the options were reloaded */
1749
if (log_output_options & LOG_NONE)
1751
logger.set_handlers(LOG_FILE,
1752
opt_slow_log ? LOG_TABLE : LOG_NONE,
1753
opt_log ? LOG_TABLE : LOG_NONE);
1052
unknown_options.push_back(new_unknown_opt);
1054
store(file_parsed, vm);
1058
static void compose_defaults_file_list(vector<string> in_options)
1060
for (vector<string>::iterator it= in_options.begin();
1061
it != in_options.end();
1065
if (fs::is_regular_file(p))
1066
defaults_file_list.push_back(*it);
1069
errmsg_printf(error::ERROR,
1070
_("Defaults file '%s' not found\n"), (*it).c_str());
1077
int init_basic_variables(int argc, char **argv)
1080
umask(((~internal::my_umask) & 0666));
1081
decimal_zero.set_zero(); // set decimal_zero constant;
1757
logger.set_handlers(LOG_FILE,
1758
opt_slow_log ? log_output_options : LOG_NONE,
1759
opt_log ? log_output_options : LOG_NONE);
1762
#ifdef USE_ONE_SIGNAL_HAND
1763
case THR_SERVER_ALARM:
1764
process_alarm(sig); // Trigger alarms.
1769
sql_print_warning("Got signal: %d error: %d",sig,error); /* purecov: tested */
1771
break; /* purecov: tested */
1774
return(0); /* purecov: deadcode */
1777
static void check_data_home(const char *path __attribute__((__unused__)))
1784
All global error messages are sent here where the first one is stored
1788
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
1790
void my_message_sql(uint error, const char *str, myf MyFlags)
1794
Put here following assertion when situation with EE_* error codes
1797
if ((thd= current_thd))
1799
if (MyFlags & ME_FATALERROR)
1800
thd->is_fatal_error= 1;
1802
#ifdef BUG_36098_FIXED
1803
mysql_audit_general(thd,MYSQL_AUDIT_GENERAL_ERROR,error,my_time(0),
1804
0,0,str,str ? strlen(str) : 0,
1805
thd->query,thd->query_length,
1806
thd->variables.character_set_client,
1812
TODO: There are two exceptions mechanism (THD and sp_rcontext),
1813
this could be improved by having a common stack of handlers.
1815
if (thd->handle_error(error, str,
1816
MYSQL_ERROR::WARN_LEVEL_ERROR))
1819
thd->is_slave_error= 1; // needed to catch query errors during replication
1822
thd->lex->current_select == 0 if lex structure is not inited
1823
(not query command (COM_QUERY))
1825
if (! (thd->lex->current_select &&
1826
thd->lex->current_select->no_error && !thd->is_fatal_error))
1828
if (! thd->main_da.is_error()) // Return only first message
1831
error= ER_UNKNOWN_ERROR;
1834
thd->main_da.set_error_status(thd, error, str);
1838
if (!thd->no_warnings_for_error && !thd->is_fatal_error)
1841
Suppress infinite recursion if there a memory allocation error
1842
inside push_warning.
1844
thd->no_warnings_for_error= true;
1845
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str);
1846
thd->no_warnings_for_error= false;
1849
if (!thd || MyFlags & ME_NOREFRESH)
1850
sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */
1855
extern "C" void *my_str_malloc_mysqld(size_t size);
1856
extern "C" void my_str_free_mysqld(void *ptr);
1858
void *my_str_malloc_mysqld(size_t size)
1860
return my_malloc(size, MYF(MY_FAE));
1864
void my_str_free_mysqld(void *ptr)
1866
my_free((uchar*)ptr, MYF(MY_FAE));
1870
static const char *load_default_groups[]= {
1871
"mysqld","server", MYSQL_BASE_VERSION, 0, 0};
1875
Initialize one of the global date/time format variables.
1877
@param format_type What kind of format should be supported
1878
@param var_ptr Pointer to variable that should be updated
1881
The default value is taken from either opt_date_time_formats[] or
1882
the ISO format (ANSI SQL)
1890
static bool init_global_datetime_format(timestamp_type format_type,
1891
DATE_TIME_FORMAT **var_ptr)
1893
/* Get command line option */
1894
const char *str= opt_date_time_formats[format_type];
1896
if (!str) // No specified format
1898
str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT],
1901
Set the "command line" option to point to the generated string so
1902
that we can set global formats back to default
1904
opt_date_time_formats[format_type]= str;
1906
if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
1908
fprintf(stderr, "Wrong date/time format specifier: %s\n", str);
1914
SHOW_VAR com_status_vars[]= {
1915
{"admin_commands", (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
1916
{"assign_to_keycache", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS},
1917
{"alter_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
1918
{"alter_db_upgrade", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB_UPGRADE]), SHOW_LONG_STATUS},
1919
{"alter_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
1920
{"analyze", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
1921
{"begin", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
1922
{"binlog", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS},
1923
{"change_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS},
1924
{"change_master", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_MASTER]), SHOW_LONG_STATUS},
1925
{"check", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECK]), SHOW_LONG_STATUS},
1926
{"checksum", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS},
1927
{"commit", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_COMMIT]), SHOW_LONG_STATUS},
1928
{"create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_DB]), SHOW_LONG_STATUS},
1929
{"create_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_INDEX]), SHOW_LONG_STATUS},
1930
{"create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CREATE_TABLE]), SHOW_LONG_STATUS},
1931
{"delete", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE]), SHOW_LONG_STATUS},
1932
{"delete_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DELETE_MULTI]), SHOW_LONG_STATUS},
1933
{"drop_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_DB]), SHOW_LONG_STATUS},
1934
{"drop_index", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_INDEX]), SHOW_LONG_STATUS},
1935
{"drop_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_DROP_TABLE]), SHOW_LONG_STATUS},
1936
{"empty_query", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_EMPTY_QUERY]), SHOW_LONG_STATUS},
1937
{"flush", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_FLUSH]), SHOW_LONG_STATUS},
1938
{"insert", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT]), SHOW_LONG_STATUS},
1939
{"insert_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_INSERT_SELECT]), SHOW_LONG_STATUS},
1940
{"kill", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_KILL]), SHOW_LONG_STATUS},
1941
{"load", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD]), SHOW_LONG_STATUS},
1942
{"lock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOCK_TABLES]), SHOW_LONG_STATUS},
1943
{"optimize", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS},
1944
{"purge", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS},
1945
{"purge_before_date", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS},
1946
{"release_savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS},
1947
{"rename_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS},
1948
{"repair", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPAIR]), SHOW_LONG_STATUS},
1949
{"replace", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]), SHOW_LONG_STATUS},
1950
{"replace_select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS},
1951
{"reset", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]), SHOW_LONG_STATUS},
1952
{"rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS},
1953
{"rollback_to_savepoint",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS},
1954
{"savepoint", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
1955
{"select", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS},
1956
{"set_option", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
1957
{"show_binlog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
1958
{"show_binlogs", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
1959
{"show_charsets", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
1960
{"show_collations", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
1961
{"show_create_db", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
1962
{"show_create_table", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
1963
{"show_databases", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS},
1964
{"show_engine_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ENGINE_STATUS]), SHOW_LONG_STATUS},
1965
{"show_errors", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
1966
{"show_fields", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
1967
{"show_keys", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
1968
{"show_master_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
1969
{"show_open_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
1970
{"show_plugins", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
1971
{"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
1972
{"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
1973
{"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
1974
{"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
1975
{"show_table_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
1976
{"show_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS},
1977
{"show_variables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
1978
{"show_warnings", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
1979
{"slave_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
1980
{"slave_stop", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
1981
{"truncate", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS},
1982
{"unlock_tables", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
1983
{"update", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
1984
{"update_multi", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE_MULTI]), SHOW_LONG_STATUS},
1985
{NullS, NullS, SHOW_LONG}
1988
static int init_common_variables(const char *conf_file_name, int argc,
1989
char **argv, const char **groups)
1991
char buff[FN_REFLEN], *s;
1992
umask(((~my_umask) & 0666));
1993
my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
1082
1994
tzset(); // Set tzname
1084
curr_time= time(NULL);
1085
if (curr_time == (time_t)-1)
1996
max_system_variables.pseudo_thread_id= (ulong)~0;
1997
server_start_time= flush_status_time= my_time(0);
1998
rpl_filter= new Rpl_filter;
1999
binlog_filter= new Rpl_filter;
2000
if (!rpl_filter || !binlog_filter)
2002
sql_perror("Could not allocate replication and binlog filters");
2006
if (init_thread_environment())
1088
max_system_variables.pseudo_thread_id= UINT32_MAX;
1089
server_start_time= flush_status_time= curr_time;
1091
drizzle_init_variables();
1093
find_plugin_dir(argv[0]);
2008
mysql_init_variables();
2013
localtime_r(&server_start_time,&tm_tmp);
2014
strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
2015
sizeof(system_time_zone)-1);
1096
2020
We set SYSTEM time zone as reasonable default and
1097
2021
also for failure of my_tz_init() and bootstrap mode.
1101
2025
global_system_variables.time_zone= my_tz_SYSTEM;
1103
char ret_hostname[FN_REFLEN];
1104
if (gethostname(ret_hostname,sizeof(ret_hostname)) < 0)
2028
Init mutexes for the global MYSQL_BIN_LOG objects.
2029
As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
2030
global MYSQL_BIN_LOGs in their constructors, because then they would be
2031
inited before MY_INIT(). So we do it here.
2033
mysql_bin_log.init_pthread_objects();
2035
if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
1106
errmsg_printf(error::WARN,
1107
_("gethostname failed, using '%s' as hostname"),
1108
getServerHostname().c_str());
1109
pid_file= "drizzle";
2037
strmake(glob_hostname, STRING_WITH_LEN("localhost"));
2038
sql_print_warning("gethostname failed, using '%s' as hostname",
2040
strmake(pidfile_name, STRING_WITH_LEN("mysql"));
1113
setServerHostname(ret_hostname);
1114
pid_file= getServerHostname();
1116
pid_file.replace_extension(".pid");
1118
system_config_dir /= "drizzle";
1120
config_options.add_options()
1121
("help,?", po::value<bool>(&opt_help)->default_value(false)->zero_tokens(),
1122
_("Display this help and exit."))
1123
("daemon,d", po::value<bool>(&opt_daemon)->default_value(false)->zero_tokens(),
1124
_("Run as a daemon."))
1125
("no-defaults", po::value<bool>()->default_value(false)->zero_tokens(),
1126
_("Configuration file defaults are not used if no-defaults is set"))
1127
("defaults-file", po::value<vector<string> >()->composing()->notifier(&compose_defaults_file_list),
1128
_("Configuration file to use"))
1129
("config-dir", po::value<fs::path>(&system_config_dir),
1130
_("Base location for config files"))
1131
("plugin-dir", po::value<fs::path>(&plugin_dir)->notifier(¬ify_plugin_dir),
1132
_("Directory for plugins."))
1135
plugin_load_options.add_options()
1136
("plugin-add", po::value<vector<string> >()->composing()->notifier(&compose_plugin_add),
1137
_("Optional comma separated list of plugins to load at startup in addition "
1138
"to the default list of plugins. "
1139
"[for example: --plugin_add=crc32,logger_gearman]"))
1140
("plugin-remove", po::value<vector<string> >()->composing()->notifier(&compose_plugin_remove),
1141
_("Optional comma separated list of plugins to not load at startup. Effectively "
1142
"removes a plugin from the list of plugins to be loaded. "
1143
"[for example: --plugin_remove=crc32,logger_gearman]"))
1144
("plugin-load", po::value<string>()->notifier(¬ify_plugin_load)->default_value(PANDORA_PLUGIN_LIST),
1145
_("Optional comma separated list of plugins to load at starup instead of "
1146
"the default plugin load list. "
1147
"[for example: --plugin_load=crc32,logger_gearman]"))
1150
long_options.add_options()
1151
("auto-increment-increment", po::value<uint64_t>(&global_system_variables.auto_increment_increment)->default_value(1)->notifier(&check_limits_aii),
1152
_("Auto-increment columns are incremented by this"))
1153
("auto-increment-offset", po::value<uint64_t>(&global_system_variables.auto_increment_offset)->default_value(1)->notifier(&check_limits_aio),
1154
_("Offset added to Auto-increment columns. Used when auto-increment-increment != 1"))
1155
("basedir,b", po::value<fs::path>(&basedir),
1156
_("Path to installation directory. All paths are usually resolved "
1157
"relative to this."))
1158
("chroot,r", po::value<string>(),
1159
_("Chroot drizzled daemon during startup."))
1160
("collation-server", po::value<string>(),
1161
_("Set the default collation."))
1162
("completion-type", po::value<uint32_t>(&global_system_variables.completion_type)->default_value(0)->notifier(&check_limits_completion_type),
1163
_("Default completion type."))
1164
("core-file", _("Write core on errors."))
1165
("datadir", po::value<fs::path>(&getDataHome()),
1166
_("Path to the database root."))
1167
("default-storage-engine", po::value<string>(),
1168
_("Set the default storage engine for tables."))
1169
("default-time-zone", po::value<string>(),
1170
_("Set the default time zone."))
1171
("exit-info,T", po::value<long>(),
1172
_("Used for debugging; Use at your own risk!"))
1173
("gdb", po::value<bool>(&opt_debugging)->default_value(false)->zero_tokens(),
1174
_("Set up signals usable for debugging"))
1175
("lc-time-name", po::value<string>(),
1176
_("Set the language used for the month names and the days of the week."))
1177
("log-warnings,W", po::value<bool>(&global_system_variables.log_warnings)->default_value(false)->zero_tokens(),
1178
_("Log some not critical warnings to the log file."))
1179
("pid-file", po::value<fs::path>(&pid_file),
1180
_("Pid file used by drizzled."))
1181
("port-open-timeout", po::value<uint32_t>(&drizzled_bind_timeout)->default_value(0),
1182
_("Maximum time in seconds to wait for the port to become free. "))
1183
("replicate-query", po::value<bool>(&global_system_variables.replicate_query)->default_value(false)->zero_tokens(),
1184
_("Include the SQL query in replicated protobuf messages."))
1185
("secure-file-priv", po::value<fs::path>(&secure_file_priv)->notifier(expand_secure_file_priv),
1186
_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1187
"within specified directory"))
1188
("server-id", po::value<uint32_t>(&server_id)->default_value(0),
1189
_("Uniquely identifies the server instance in the community of "
1190
"replication partners."))
1191
("skip-stack-trace",
1192
_("Don't print a stack trace on failure."))
1193
("symbolic-links,s", po::value<bool>(&internal::my_use_symdir)->default_value(IF_PURIFY(false,true))->zero_tokens(),
1194
_("Enable symbolic link support."))
1195
("timed-mutexes", po::value<bool>(&internal::timed_mutexes)->default_value(false)->zero_tokens(),
1196
_("Specify whether to time mutexes (only InnoDB mutexes are currently "
1198
("tmpdir,t", po::value<string>(),
1199
_("Path for temporary files."))
1200
("transaction-isolation", po::value<string>(),
1201
_("Default transaction isolation level."))
1202
("transaction-message-threshold", po::value<size_t>(&transaction_message_threshold)->default_value(1024*1024)->notifier(&check_limits_transaction_message_threshold),
1203
_("Max message size written to transaction log, valid values 131072 - 1048576 bytes."))
1204
("user,u", po::value<string>(),
1205
_("Run drizzled daemon as user."))
1207
_("Output version information and exit."))
1208
("back-log", po::value<back_log_constraints>(&back_log),
1209
_("The number of outstanding connection requests Drizzle can have. This "
1210
"comes into play when the main Drizzle thread gets very many connection "
1211
"requests in a very short time."))
1212
("bulk-insert-buffer-size",
1213
po::value<uint64_t>(&global_system_variables.bulk_insert_buff_size)->default_value(8192*1024),
1214
_("Size of tree cache used in bulk insert optimization. Note that this is "
1215
"a limit per thread!"))
1216
("div-precision-increment", po::value<uint32_t>(&global_system_variables.div_precincrement)->default_value(4)->notifier(&check_limits_dpi),
1217
_("Precision of the result of '/' operator will be increased on that "
1219
("group-concat-max-len", po::value<uint64_t>(&global_system_variables.group_concat_max_len)->default_value(1024)->notifier(&check_limits_gcml),
1220
_("The maximum length of the result of function group_concat."))
1221
("join-buffer-size", po::value<uint64_t>(&global_system_variables.join_buff_size)->default_value(128*1024L)->notifier(&check_limits_join_buffer_size),
1222
_("The size of the buffer that is used for full joins."))
1223
("join-heap-threshold",
1224
po::value<uint64_t>()->default_value(0),
1225
_("A global cap on the amount of memory that can be allocated by session join buffers (0 means unlimited)"))
1226
("max-allowed-packet", po::value<uint32_t>(&global_system_variables.max_allowed_packet)->default_value(64*1024*1024L)->notifier(&check_limits_map),
1227
_("Max packetlength to send/receive from to server."))
1228
("max-error-count", po::value<uint64_t>(&global_system_variables.max_error_count)->default_value(DEFAULT_ERROR_COUNT)->notifier(&check_limits_max_err_cnt),
1229
_("Max number of errors/warnings to store for a statement."))
1230
("max-heap-table-size", po::value<uint64_t>(&global_system_variables.max_heap_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_mhts),
1231
_("Don't allow creation of heap tables bigger than this."))
1232
("max-join-size", po::value<drizzled::ha_rows>(&global_system_variables.max_join_size)->default_value(INT32_MAX)->notifier(&check_limits_max_join_size),
1233
_("Joins that are probably going to read more than max_join_size records "
1234
"return an error."))
1235
("max-length-for-sort-data", po::value<uint64_t>(&global_system_variables.max_length_for_sort_data)->default_value(1024)->notifier(&check_limits_mlfsd),
1236
_("Max number of bytes in sorted records."))
1237
("max-seeks-for-key", po::value<uint64_t>(&global_system_variables.max_seeks_for_key)->default_value(ULONG_MAX)->notifier(&check_limits_msfk),
1238
_("Limit assumed max number of seeks when looking up rows based on a key"))
1239
("max-sort-length", po::value<size_t>(&global_system_variables.max_sort_length)->default_value(1024)->notifier(&check_limits_max_sort_length),
1240
_("The number of bytes to use when sorting BLOB or TEXT values "
1241
"(only the first max_sort_length bytes of each value are used; the "
1242
"rest are ignored)."))
1243
("max-write-lock-count", po::value<uint64_t>(&max_write_lock_count)->default_value(UINT64_MAX),
1244
_("After this many write locks, allow some read locks to run in between."))
1245
("min-examined-row-limit", po::value<uint64_t>(&global_system_variables.min_examined_row_limit)->default_value(0)->notifier(&check_limits_merl),
1246
_("Don't log queries which examine less than min_examined_row_limit "
1248
("disable-optimizer-prune",
1249
_("Do not apply any heuristic(s) during query optimization to prune, "
1250
"thus perform an exhaustive search from the optimizer search space."))
1251
("optimizer-search-depth", po::value<uint32_t>(&global_system_variables.optimizer_search_depth)->default_value(0)->notifier(&check_limits_osd),
1252
_("Maximum depth of search performed by the query optimizer. Values "
1253
"larger than the number of relations in a query result in better query "
1254
"plans, but take longer to compile a query. Smaller values than the "
1255
"number of tables in a relation result in faster optimization, but may "
1256
"produce very bad query plans. If set to 0, the system will "
1257
"automatically pick a reasonable value; if set to MAX_TABLES+2, the "
1258
"optimizer will switch to the original find_best (used for "
1259
"testing/comparison)."))
1260
("preload-buffer-size", po::value<uint64_t>(&global_system_variables.preload_buff_size)->default_value(32*1024L)->notifier(&check_limits_pbs),
1261
_("The size of the buffer that is allocated when preloading indexes"))
1262
("query-alloc-block-size",
1263
po::value<uint32_t>(&global_system_variables.query_alloc_block_size)->default_value(QUERY_ALLOC_BLOCK_SIZE)->notifier(&check_limits_qabs),
1264
_("Allocation block size for query parsing and execution"))
1265
("query-prealloc-size",
1266
po::value<uint32_t>(&global_system_variables.query_prealloc_size)->default_value(QUERY_ALLOC_PREALLOC_SIZE)->notifier(&check_limits_qps),
1267
_("Persistent buffer for query parsing and execution"))
1268
("range-alloc-block-size",
1269
po::value<size_t>(&global_system_variables.range_alloc_block_size)->default_value(RANGE_ALLOC_BLOCK_SIZE)->notifier(&check_limits_rabs),
1270
_("Allocation block size for storing ranges during optimization"))
1271
("read-buffer-size",
1272
po::value<uint32_t>(&global_system_variables.read_buff_size)->default_value(128*1024L)->notifier(&check_limits_read_buffer_size),
1273
_("Each thread that does a sequential scan allocates a buffer of this "
1274
"size for each table it scans. If you do many sequential scans, you may "
1275
"want to increase this value."))
1276
("read-buffer-threshold",
1277
po::value<uint64_t>()->default_value(0),
1278
_("A global cap on the size of read-buffer-size (0 means unlimited)"))
1279
("read-rnd-buffer-size",
1280
po::value<uint32_t>(&global_system_variables.read_rnd_buff_size)->default_value(256*1024L)->notifier(&check_limits_read_rnd_buffer_size),
1281
_("When reading rows in sorted order after a sort, the rows are read "
1282
"through this buffer to avoid a disk seeks. If not set, then it's set "
1283
"to the value of record_buffer."))
1284
("read-rnd-threshold",
1285
po::value<uint64_t>()->default_value(0),
1286
_("A global cap on the size of read-rnd-buffer-size (0 means unlimited)"))
1287
("scheduler", po::value<string>(),
1288
_("Select scheduler to be used (by default multi-thread)."))
1289
("sort-buffer-size",
1290
po::value<size_t>(&global_system_variables.sortbuff_size)->default_value(MAX_SORT_MEMORY)->notifier(&check_limits_sort_buffer_size),
1291
_("Each thread that needs to do a sort allocates a buffer of this size."))
1292
("sort-heap-threshold",
1293
po::value<uint64_t>()->default_value(0),
1294
_("A global cap on the amount of memory that can be allocated by session sort buffers (0 means unlimited)"))
1295
("table-definition-cache", po::value<size_t>(&table_def_size)->default_value(128)->notifier(&check_limits_tdc),
1296
_("The number of cached table definitions."))
1297
("table-open-cache", po::value<uint64_t>(&table_cache_size)->default_value(TABLE_OPEN_CACHE_DEFAULT)->notifier(&check_limits_toc),
1298
_("The number of cached open tables."))
1299
("table-lock-wait-timeout", po::value<uint64_t>(&table_lock_wait_timeout)->default_value(50)->notifier(&check_limits_tlwt),
1300
_("Timeout in seconds to wait for a table level lock before returning an "
1301
"error. Used only if the connection has active cursors."))
1302
("thread-stack", po::value<size_t>(&my_thread_stack_size)->default_value(DEFAULT_THREAD_STACK)->notifier(&check_limits_thread_stack),
1303
_("The stack size for each thread."))
1305
po::value<uint64_t>(&global_system_variables.tmp_table_size)->default_value(16*1024*1024L)->notifier(&check_limits_tmp_table_size),
1306
_("If an internal in-memory temporary table exceeds this size, Drizzle will"
1307
" automatically convert it to an on-disk MyISAM table."))
1308
("verbose", po::value<std::string>()->default_value(error::verbose_string())->notifier(&error::check_verbosity),
1309
_("The stack size for each thread."))
1312
full_options.add(long_options);
1313
full_options.add(plugin_load_options);
1315
initial_options.add(config_options);
1316
initial_options.add(plugin_load_options);
1318
int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1319
/* Get options about where config files and the like are */
1320
po::parsed_options parsed= po::command_line_parser(argc, argv).style(style).
1321
options(initial_options).allow_unregistered().run();
1323
po::collect_unrecognized(parsed.options, po::include_positional);
1327
po::store(parsed, vm);
1329
catch (std::exception&)
1331
errmsg_printf(error::ERROR, _("Duplicate entry for command line option\n"));
1335
if (not vm["no-defaults"].as<bool>())
1337
fs::path system_config_file_drizzle(system_config_dir);
1338
system_config_file_drizzle /= "drizzled.cnf";
1339
defaults_file_list.insert(defaults_file_list.begin(),
1340
system_config_file_drizzle.file_string());
1342
fs::path config_conf_d_location(system_config_dir);
1343
config_conf_d_location /= "conf.d";
1346
CachedDirectory config_conf_d(config_conf_d_location.file_string());
1347
if (not config_conf_d.fail())
2043
strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
2044
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
2047
Add server status variables to the dynamic list of
2048
status variables that is shown by SHOW STATUS.
2049
Later, in plugin_init, and mysql_install_plugin
2050
new entries could be added to that list.
2052
if (add_status_vars(status_vars))
2053
return 1; // an error was already reported
2055
load_defaults(conf_file_name, groups, &argc, &argv);
2058
get_options(&defaults_argc, defaults_argv);
2059
set_server_version();
2062
/* connections and databases needs lots of files */
2064
uint files, wanted_files, max_open_files;
2066
/* MyISAM requires two file handles per table. */
2067
wanted_files= 10+max_connections+table_cache_size*2;
2069
We are trying to allocate no less than max_connections*5 file
2070
handles (i.e. we are trying to set the limit so that they will
2071
be available). In addition, we allocate no less than how much
2072
was already allocated. However below we report a warning and
2073
recompute values only if we got less file handles than were
2074
explicitly requested. No warning and re-computation occur if we
2075
can't get max_connections*5 but still got no less than was
2076
requested (value of wanted_files).
2078
max_open_files= max(max(wanted_files, max_connections*5),
2080
files= my_set_max_open_files(max_open_files);
2082
if (files < wanted_files)
1350
for (CachedDirectory::Entries::const_iterator iter= config_conf_d.getEntries().begin();
1351
iter != config_conf_d.getEntries().end();
2084
if (!open_files_limit)
1354
string file_entry((*iter)->filename);
1356
if (not file_entry.empty()
1357
&& file_entry != "."
1358
&& file_entry != "..")
1360
fs::path the_entry(config_conf_d_location);
1361
the_entry /= file_entry;
1362
defaults_file_list.push_back(the_entry.file_string());
2087
If we have requested too much file handles than we bring
2088
max_connections in supported bounds.
2090
max_connections= (ulong) min(files-10-TABLE_OPEN_CACHE_MIN*2,
2093
Decrease table_cache_size according to max_connections, but
2094
not below TABLE_OPEN_CACHE_MIN. Outer min() ensures that we
2095
never increase table_cache_size automatically (that could
2096
happen if max_connections is decreased above).
2098
table_cache_size= (ulong) min(max((files-10-max_connections)/2,
2099
TABLE_OPEN_CACHE_MIN),
2101
if (global_system_variables.log_warnings)
2102
sql_print_warning("Changed limits: max_open_files: %u max_connections: %ld table_cache: %ld",
2103
files, max_connections, table_cache_size);
1368
/* TODO: here is where we should add a process_env_vars */
1370
/* We need a notify here so that plugin_init will work properly */
1375
catch (po::validation_error &err)
1377
errmsg_printf(error::ERROR,
1379
"Use --help to get a list of available options\n"),
1380
internal::my_progname, err.what());
1384
process_defaults_files();
1386
/* Process with notify a second time because a config file may contain
1387
plugin loader options */
1393
catch (po::validation_error &err)
1395
errmsg_printf(error::ERROR,
1397
"Use --help to get a list of available options\n"),
1398
internal::my_progname, err.what());
1405
int init_remaining_variables(module::Registry &plugins)
1407
int style = po::command_line_style::default_style & ~po::command_line_style::allow_guessing;
1409
current_pid= getpid(); /* Save for later ref */
1411
/* At this point, we've read all the options we need to read from files and
1412
collected most of them into unknown options - now let's load everything
1415
if (plugin_init(plugins, plugin_options))
1417
errmsg_printf(error::ERROR, _("Failed to initialize plugins\n"));
1421
full_options.add(plugin_options);
1423
vector<string> final_unknown_options;
1426
po::parsed_options final_parsed=
1427
po::command_line_parser(unknown_options).style(style).
1428
options(full_options).extra_parser(dpo::parse_size_arg).run();
1430
final_unknown_options=
1431
po::collect_unrecognized(final_parsed.options, po::include_positional);
1433
po::store(final_parsed, vm);
1436
catch (po::validation_error &err)
1438
errmsg_printf(error::ERROR,
1440
"Use --help to get a list of available options\n"),
1441
internal::my_progname, err.what());
1444
catch (po::invalid_command_line_syntax &err)
1446
errmsg_printf(error::ERROR,
1448
"Use --help to get a list of available options\n"),
1449
internal::my_progname, err.what());
1452
catch (po::unknown_option &err)
1454
errmsg_printf(error::ERROR,
1455
_("%s\nUse --help to get a list of available options\n"),
1464
catch (po::validation_error &err)
1466
errmsg_printf(error::ERROR,
1468
"Use --help to get a list of available options\n"),
1469
internal::my_progname, err.what());
1475
/* Inverted Booleans */
1477
global_system_variables.optimizer_prune_level=
1478
vm.count("disable-optimizer-prune") ? false : true;
1480
if (vm.count("help") == 0 && vm.count("help-extended") == 0)
1482
if ((user_info= check_user(drizzled_user)))
1484
set_user(drizzled_user, user_info);
1490
init_time(); /* Init time-functions (read zone) */
2105
else if (global_system_variables.log_warnings)
2106
sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
2108
open_files_limit= files;
2110
unireg_init(opt_specialflag); /* Set up extern variabels */
2111
if (init_errmessage()) /* Read error messages from file */
1492
2115
if (item_create_init())
1496
/* Creates static regex matching for temporal values */
1497
if (! init_temporal_formats())
1500
if (!(default_charset_info=
1501
get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
2120
if (init_replication_sys_vars())
2122
mysys_uses_curses=0;
2124
Process a comma-separated character set list and choose
2125
the first available character set. This is mostly for
2126
test purposes, to be able to start "mysqld" even if
2127
the requested character set is not available (see bug#18743).
1503
errmsg_printf(error::ERROR, _("Error getting default charset"));
1504
return 1; // Eof of the list
2131
char *next_character_set_name= strchr(default_character_set_name, ',');
2132
if (next_character_set_name)
2133
*next_character_set_name++= '\0';
2134
if (!(default_charset_info=
2135
get_charset_by_csname(default_character_set_name,
2136
MY_CS_PRIMARY, MYF(MY_WME))))
2138
if (next_character_set_name)
2140
default_character_set_name= next_character_set_name;
2141
default_collation_name= 0; // Ignore collation
2144
return 1; // Eof of the list
1507
if (vm.count("scheduler"))
1508
opt_scheduler= vm["scheduler"].as<string>().c_str();
1510
2150
if (default_collation_name)
1512
const CHARSET_INFO * const default_collation= get_charset_by_name(default_collation_name);
1513
if (not default_collation)
2152
CHARSET_INFO *default_collation;
2153
default_collation= get_charset_by_name(default_collation_name, MYF(0));
2154
if (!default_collation)
1515
errmsg_printf(error::ERROR, _(ER(ER_UNKNOWN_COLLATION)), default_collation_name);
2156
sql_print_error(ER(ER_UNKNOWN_COLLATION), default_collation_name);
1518
if (not my_charset_same(default_charset_info, default_collation))
2159
if (!my_charset_same(default_charset_info, default_collation))
1520
errmsg_printf(error::ERROR, _(ER(ER_COLLATION_CHARSET_MISMATCH)),
1521
default_collation_name,
1522
default_charset_info->csname);
2161
sql_print_error(ER(ER_COLLATION_CHARSET_MISMATCH),
2162
default_collation_name,
2163
default_charset_info->csname);
1525
2166
default_charset_info= default_collation;
1527
2168
/* Set collactions that depends on the default collation */
1528
2169
global_system_variables.collation_server= default_charset_info;
1530
if (not (character_set_filesystem=
1531
get_charset_by_csname(character_set_filesystem_name, MY_CS_PRIMARY)))
1533
errmsg_printf(error::ERROR, _("Error setting collation"));
2170
global_system_variables.collation_database= default_charset_info;
2171
global_system_variables.collation_connection= default_charset_info;
2172
global_system_variables.character_set_results= default_charset_info;
2173
global_system_variables.character_set_client= default_charset_info;
2175
global_system_variables.optimizer_use_mrr= 1;
2176
global_system_variables.optimizer_switch= 0;
2178
if (!(character_set_filesystem=
2179
get_charset_by_csname(character_set_filesystem_name,
2180
MY_CS_PRIMARY, MYF(MY_WME))))
1536
2182
global_system_variables.character_set_filesystem= character_set_filesystem;
1538
2184
if (!(my_default_lc_time_names=
1539
2185
my_locale_by_name(lc_time_names_name)))
1541
errmsg_printf(error::ERROR, _("Unknown locale: '%s'"), lc_time_names_name);
2187
sql_print_error("Unknown locale: '%s'", lc_time_names_name);
1544
2190
global_system_variables.lc_time_names= my_default_lc_time_names;
1546
/* Reset table_alias_charset */
1547
table_alias_charset= files_charset_info;
1553
int init_server_components(module::Registry &plugins)
2192
sys_init_connect.value_length= 0;
2193
if ((sys_init_connect.value= opt_init_connect))
2194
sys_init_connect.value_length= strlen(opt_init_connect);
2196
sys_init_connect.value=my_strdup("",MYF(0));
2198
sys_init_slave.value_length= 0;
2199
if ((sys_init_slave.value= opt_init_slave))
2200
sys_init_slave.value_length= strlen(opt_init_slave);
2202
sys_init_slave.value=my_strdup("",MYF(0));
2204
/* check log options and issue warnings if needed */
2205
if (opt_log && opt_logname && !(log_output_options & LOG_FILE) &&
2206
!(log_output_options & LOG_NONE))
2207
sql_print_warning("Although a path was specified for the "
2208
"--log option, log tables are used. "
2209
"To enable logging to files use the --log-output option.");
2211
if (opt_slow_log && opt_slow_logname && !(log_output_options & LOG_FILE)
2212
&& !(log_output_options & LOG_NONE))
2213
sql_print_warning("Although a path was specified for the "
2214
"--log-slow-queries option, log tables are used. "
2215
"To enable logging to files use the --log-output=file option.");
2217
s= opt_logname ? opt_logname : make_default_log_name(buff, ".log");
2218
sys_var_general_log_path.value= my_strdup(s, MYF(0));
2219
sys_var_general_log_path.value_length= strlen(s);
2221
s= opt_slow_logname ? opt_slow_logname : make_default_log_name(buff, "-slow.log");
2222
sys_var_slow_log_path.value= my_strdup(s, MYF(0));
2223
sys_var_slow_log_path.value_length= strlen(s);
2225
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
2227
if (my_database_names_init())
2231
Ensure that lower_case_table_names is set on system where we have case
2232
insensitive names. If this is not done the users MyISAM tables will
2233
get corrupted if accesses with names of different case.
2235
lower_case_file_system= test_if_case_insensitive(mysql_real_data_home);
2236
if (!lower_case_table_names && lower_case_file_system == 1)
2238
if (lower_case_table_names_used)
2240
if (global_system_variables.log_warnings)
2241
sql_print_warning("\
2242
You have forced lower_case_table_names to 0 through a command-line \
2243
option, even though your file system '%s' is case insensitive. This means \
2244
that you can corrupt a MyISAM table by accessing it with different cases. \
2245
You should consider changing lower_case_table_names to 1 or 2",
2246
mysql_real_data_home);
2250
if (global_system_variables.log_warnings)
2251
sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home);
2252
lower_case_table_names= 2;
2255
else if (lower_case_table_names == 2 &&
2256
!(lower_case_file_system=
2257
(test_if_case_insensitive(mysql_real_data_home) == 1)))
2259
if (global_system_variables.log_warnings)
2260
sql_print_warning("lower_case_table_names was set to 2, even though your "
2261
"the file system '%s' is case sensitive. Now setting "
2262
"lower_case_table_names to 0 to avoid future problems.",
2263
mysql_real_data_home);
2264
lower_case_table_names= 0;
2268
lower_case_file_system=
2269
(test_if_case_insensitive(mysql_real_data_home) == 1);
2272
/* Reset table_alias_charset, now that lower_case_table_names is set. */
2273
table_alias_charset= (lower_case_table_names ?
2274
files_charset_info :
2281
static int init_thread_environment()
2283
(void) pthread_mutex_init(&LOCK_mysql_create_db,MY_MUTEX_INIT_SLOW);
2284
(void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW);
2285
(void) pthread_mutex_init(&LOCK_open, NULL);
2286
(void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
2287
(void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
2288
(void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
2289
(void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
2290
(void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST);
2291
(void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
2292
(void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
2293
(void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
2294
(void) my_rwlock_init(&LOCK_system_variables_hash, NULL);
2295
(void) pthread_mutex_init(&LOCK_global_read_lock, MY_MUTEX_INIT_FAST);
2296
(void) pthread_mutex_init(&LOCK_uuid_generator, MY_MUTEX_INIT_FAST);
2297
(void) pthread_mutex_init(&LOCK_connection_count, MY_MUTEX_INIT_FAST);
2298
(void) my_rwlock_init(&LOCK_sys_init_connect, NULL);
2299
(void) my_rwlock_init(&LOCK_sys_init_slave, NULL);
2300
(void) pthread_cond_init(&COND_thread_count,NULL);
2301
(void) pthread_cond_init(&COND_refresh,NULL);
2302
(void) pthread_cond_init(&COND_global_read_lock,NULL);
2303
(void) pthread_cond_init(&COND_thread_cache,NULL);
2304
(void) pthread_cond_init(&COND_flush_thread_cache,NULL);
2305
(void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
2306
(void) pthread_cond_init(&COND_rpl_status, NULL);
2308
/* Parameter for threads created for connections */
2309
(void) pthread_attr_init(&connection_attrib);
2310
(void) pthread_attr_setdetachstate(&connection_attrib,
2311
PTHREAD_CREATE_DETACHED);
2312
pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
2313
if (!(opt_specialflag & SPECIAL_NO_PRIOR))
2315
struct sched_param tmp_sched_param;
2317
memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
2318
tmp_sched_param.sched_priority= WAIT_PRIOR;
2319
(void)pthread_attr_setschedparam(&connection_attrib, &tmp_sched_param);
2322
if (pthread_key_create(&THR_THD,NULL) ||
2323
pthread_key_create(&THR_MALLOC,NULL))
2325
sql_print_error("Can't create thread-keys");
2332
static int init_server_components()
1556
2335
We need to call each of these following functions to ensure that
1557
2336
all things are initialized so that unireg_abort() doesn't fail
1559
if (table_cache_init())
1561
errmsg_printf(error::ERROR, _("Could not initialize table cache\n"));
2338
if (table_cache_init() | table_def_init())
1562
2339
unireg_abort(1);
1565
// Resize the definition Cache at startup
1566
table::Cache::singleton().rehash(table_def_size);
1567
definition::Cache::singleton().rehash(table_def_size);
1568
message::Cache::singleton().rehash(table_def_size);
2341
randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
1572
2346
/* Setup logs */
2349
Enable old-fashioned error log, except when the user has requested
2350
help information. Since the implementation of plugin server
2351
variables the help output is now written much later.
2353
if (opt_error_log && !opt_help)
2355
if (!log_error_file_ptr[0])
2356
fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
2357
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */
2359
fn_format(log_error_file, log_error_file_ptr, mysql_data_home, ".err",
2360
MY_UNPACK_FILENAME | MY_SAFE_PATH);
2361
if (!log_error_file[0])
2362
opt_error_log= 1; // Too long file name
2365
if (freopen(log_error_file, "a+", stdout))
2366
freopen(log_error_file, "a+", stderr);
1574
2370
if (xid_cache_init())
1576
errmsg_printf(error::ERROR, _("XA cache initialization failed: Out of memory\n"));
2372
sql_print_error("Out of memory");
2377
if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
2379
sql_print_error("You need to use --log-bin to make "
2380
"--binlog-format work.");
2385
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
2388
if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC)
2389
global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
2392
assert(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
2395
/* Check that we have not let the format to unspecified at this point */
2396
assert((uint)global_system_variables.binlog_format <=
2397
array_elements(binlog_format_names)-1);
2399
if (opt_log_slave_updates && replicate_same_server_id)
2402
using --replicate-same-server-id in conjunction with \
2403
--log-slave-updates is impossible, it would lead to infinite loops in this \
2410
char buf[FN_REFLEN];
2412
ln= mysql_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf);
2413
if (!opt_bin_logname && !opt_binlog_index_name)
2416
User didn't give us info to name the binlog index file.
2417
Picking `hostname`-bin.index like did in 4.x, causes replication to
2418
fail if the hostname is changed later. So, we would like to instead
2419
require a name. But as we don't want to break many existing setups, we
2420
only give warning, not error.
2422
sql_print_warning("No argument was provided to --log-bin, and "
2423
"--log-bin-index was not used; so replication "
2424
"may break when this MySQL server acts as a "
2425
"master and has his hostname changed!! Please "
2426
"use '--log-bin=%s' to avoid this problem.", ln);
2430
my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR));
2431
opt_bin_logname=my_strdup(buf, MYF(0));
2433
if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln))
2439
Used to specify which type of lock we need to use for queries of type
2440
INSERT ... SELECT. This will change when we have row level logging.
2445
/* call ha_init_key_cache() on all key caches to init them */
2446
process_key_caches(&ha_init_key_cache);
1580
2448
/* Allow storage engine to give real error messages */
2449
if (ha_init_errors())
2452
if (plugin_init(&defaults_argc, defaults_argv,
2453
(opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
2454
(opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
2456
sql_print_error("Failed to initialize plugins.");
1585
2461
unireg_abort(0);
1587
if (plugin_finalize(plugins))
1592
string scheduler_name;
1595
scheduler_name= opt_scheduler;
1599
scheduler_name= opt_scheduler_default;
1600
opt_scheduler= opt_scheduler_default;
1603
if (plugin::Scheduler::setPlugin(scheduler_name))
1605
errmsg_printf(error::ERROR,
1606
_("No scheduler found, cannot continue!\n"));
2463
/* we do want to exit if there are any other unknown options */
2464
if (defaults_argc > 1)
2467
char **tmp_argv= defaults_argv;
2468
struct my_option no_opts[]=
2470
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
2473
We need to eat any 'loose' arguments first before we conclude
2474
that there are unprocessed options.
2475
But we need to preserve defaults_argv pointer intact for
2476
free_defaults() to work. Thus we use a copy here.
2478
my_getopt_skip_unknown= 0;
2480
if ((ho_error= handle_options(&defaults_argc, &tmp_argv, no_opts,
2481
mysqld_get_one_option)))
2482
unireg_abort(ho_error);
2486
fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n"
2487
"Use --verbose --help to get a list of available options\n",
2488
my_progname, *tmp_argv);
1607
2489
unireg_abort(1);
1611
This is entirely for legacy. We will create a new "disk based" engine and a
1612
"memory" engine which will be configurable longterm.
1614
const std::string myisam_engine_name("MyISAM");
1615
const std::string heap_engine_name("MEMORY");
1616
myisam_engine= plugin::StorageEngine::findByName(myisam_engine_name);
1617
heap_engine= plugin::StorageEngine::findByName(heap_engine_name);
2493
/* if the errmsg.sys is not loaded, terminate to maintain behaviour */
2497
/* We have to initialize the storage engines before CSV logging */
2500
sql_print_error("Can't init databases");
2504
logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
2505
opt_log ? LOG_FILE:LOG_NONE);
1620
2508
Check that the default storage engine is actually available.
1622
2510
if (default_storage_engine_str)
1624
const std::string name(default_storage_engine_str);
1625
plugin::StorageEngine *engine;
1627
engine= plugin::StorageEngine::findByName(name);
1630
errmsg_printf(error::ERROR, _("Unknown/unsupported storage engine: %s\n"),
1631
default_storage_engine_str);
1634
global_system_variables.storage_engine= engine;
1637
if (plugin::XaResourceManager::recoverAllXids())
1639
/* This function alredy generates error messages */
2512
LEX_STRING name= { default_storage_engine_str,
2513
strlen(default_storage_engine_str) };
2517
if ((plugin= ha_resolve_by_name(0, &name)))
2518
hton= plugin_data(plugin, handlerton*);
2521
sql_print_error("Unknown/unsupported table type: %s",
2522
default_storage_engine_str);
2525
if (!ha_storage_engine_is_enabled(hton))
2529
sql_print_error("Default storage engine (%s) is not available",
2530
default_storage_engine_str);
2533
assert(global_system_variables.table_plugin);
2538
Need to unlock as global_system_variables.table_plugin
2539
was acquired during plugin_init()
2541
plugin_unlock(0, global_system_variables.table_plugin);
2542
global_system_variables.table_plugin= plugin;
2546
tc_log= (total_ha_2pc > 1 ? (opt_bin_log ?
2547
(TC_LOG *) &mysql_bin_log :
2548
(TC_LOG *) &tc_log_mmap) :
2549
(TC_LOG *) &tc_log_dummy);
2551
if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file))
2553
sql_print_error("Can't init tc log");
2562
if (opt_bin_log && mysql_bin_log.open(opt_bin_logname, LOG_BIN, 0,
2563
WRITE_CACHE, 0, max_binlog_size, 0))
2566
if (opt_bin_log && expire_logs_days)
2568
time_t purge_time= server_start_time - expire_logs_days*24*60*60;
2569
if (purge_time >= 0)
2570
mysql_bin_log.purge_logs_before_date(purge_time);
2576
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
2577
if (locked_in_memory && !getuid())
2579
if (setreuid((uid_t)-1, 0) == -1)
2580
{ // this should never happen
2581
sql_perror("setreuid");
2584
if (mlockall(MCL_CURRENT))
2586
if (global_system_variables.log_warnings)
2587
sql_print_warning("Failed to lock memory. Errno: %d\n",errno);
2588
locked_in_memory= 0;
2591
set_user(mysqld_user, user_info);
1643
2597
init_update_queries();
2602
int main(int argc, char **argv)
2604
MY_INIT(argv[0]); // init my_sys library & pthreads
2605
/* nothing should come before this line ^^^ */
2607
/* Set signal used to kill MySQL */
2608
#if defined(SIGUSR2)
2609
thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2;
2611
thr_kill_signal= SIGINT;
2615
Perform basic logger initialization logger. Should be called after
2616
MY_INIT, as it initializes mutexes. Log tables are inited later.
2620
#ifdef _CUSTOMSTARTUPCONFIG_
2621
if (_cust_check_startup())
2623
/ * _cust_check_startup will report startup failure error * /
2628
if (init_common_variables(MYSQL_CONFIG_NAME,
2629
argc, argv, load_default_groups))
2630
unireg_abort(1); // Will do exit
2634
pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size);
2636
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
2638
/* Retrieve used stack size; Needed for checking stack overflows */
2639
size_t stack_size= 0;
2640
pthread_attr_getstacksize(&connection_attrib, &stack_size);
2641
/* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */
2642
if (stack_size && stack_size < my_thread_stack_size)
2644
if (global_system_variables.log_warnings)
2645
sql_print_warning("Asked for %lu thread stack, but got %ld",
2646
my_thread_stack_size, (long) stack_size);
2647
my_thread_stack_size= stack_size;
2652
select_thread=pthread_self();
2653
select_thread_in_use=1;
2656
We have enough space for fiddling with the argv, continue
2658
check_data_home(mysql_real_data_home);
2659
if (my_setwd(mysql_real_data_home,MYF(MY_WME)) && !opt_help)
2660
unireg_abort(1); /* purecov: inspected */
2661
mysql_data_home= mysql_data_home_buff;
2662
mysql_data_home[0]=FN_CURLIB; // all paths are relative from here
2663
mysql_data_home[1]=0;
2664
mysql_data_home_len= 2;
2666
if ((user_info= check_user(mysqld_user)))
2668
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
2669
if (locked_in_memory) // getuid() == 0 here
2670
set_effective_user(user_info);
2673
set_user(mysqld_user, user_info);
2676
if (opt_bin_log && !server_id)
2680
sql_print_warning("You have enabled the binary log, but you haven't set "
2681
"server-id to a non-zero value: we force server id to 1; "
2682
"updates will be logged to the binary log, but "
2683
"connections from slaves will not be accepted.");
2687
if (init_server_components())
2693
Initialize my_str_malloc() and my_str_free()
2695
my_str_malloc= &my_str_malloc_mysqld;
2696
my_str_free= &my_str_free_mysqld;
2699
init signals & alarm
2700
After this we can't quit by a simple unireg_abort
2702
error_handler_hook= my_message_sql;
2703
start_signal_handler(); // Creates pidfile
2705
if (mysql_rm_tmp_tables() || my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
2708
select_thread_in_use=0;
2709
(void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
2712
(void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
2718
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
2719
opt_skip_slave_start= 1;
2721
init_slave() must be called after the thread keys are created.
2722
Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
2723
places) assume that active_mi != 0, so let's fail if it's 0 (out of
2724
memory); a message has already been printed.
2726
if (init_slave() && !active_mi)
2731
sql_print_information(ER(ER_STARTUP),my_progname,server_version,
2732
"", mysqld_port, MYSQL_COMPILATION_COMMENT);
2735
handle_connections_sockets();
2737
/* (void) pthread_attr_destroy(&connection_attrib); */
2741
sql_print_error("Before Lock_thread_count");
2743
(void) pthread_mutex_lock(&LOCK_thread_count);
2744
select_thread_in_use=0; // For close_connections
2745
(void) pthread_mutex_unlock(&LOCK_thread_count);
2746
(void) pthread_cond_broadcast(&COND_thread_count);
2748
sql_print_error("After lock_thread_count");
2751
/* Wait until cleanup is done */
2752
(void) pthread_mutex_lock(&LOCK_thread_count);
2753
while (!ready_to_exit)
2754
pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
2755
(void) pthread_mutex_unlock(&LOCK_thread_count);
2763
Create new thread to handle incoming connection.
2765
This function will create new thread to handle the incoming
2766
connection. If there are idle cached threads one will be used.
2767
'thd' will be pushed into 'threads'.
2769
In single-threaded mode (\#define ONE_THREAD) connection will be
2770
handled inside this function.
2772
@param[in,out] thd Thread handle of future thread.
2775
static void create_new_thread(THD *thd)
2779
Don't allow too many connections. We roughly check here that we allow
2780
only (max_connections + 1) connections.
2783
pthread_mutex_lock(&LOCK_connection_count);
2785
if (connection_count >= max_connections + 1 || abort_loop)
2787
pthread_mutex_unlock(&LOCK_connection_count);
2789
close_connection(thd, ER_CON_COUNT_ERROR, 1);
2796
if (connection_count > max_used_connections)
2797
max_used_connections= connection_count;
2799
pthread_mutex_unlock(&LOCK_connection_count);
2801
/* Start a new thread to handle connection. */
2803
pthread_mutex_lock(&LOCK_thread_count);
2806
The initialization of thread_id is done in create_embedded_thd() for
2807
the embedded library.
2808
TODO: refactor this to avoid code duplication there
2810
thd->thread_id= thd->variables.pseudo_thread_id= thread_id++;
2814
thread_scheduler.add_connection(thd);
2820
#ifdef SIGNALS_DONT_BREAK_READ
2821
inline void kill_broken_server()
2823
/* hack to get around signals ignored in syscalls for problem OS's */
2824
if ((!opt_disable_networking && ip_sock == INVALID_SOCKET))
2826
select_thread_in_use = 0;
2827
/* The following call will never return */
2828
kill_server((void*) MYSQL_KILL_SIGNAL);
2831
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
2833
#define MAYBE_BROKEN_SYSCALL
2836
/* Handle new connections and spawn new process to handle them */
2838
void handle_connections_sockets()
2840
my_socket sock,new_sock;
2842
uint max_used_connection= (uint)ip_sock+1;
2843
fd_set readFDs,clientFDs;
2845
struct sockaddr_storage cAddr;
2846
int ip_flags=0, flags;
2849
FD_ZERO(&clientFDs);
2850
if (ip_sock != INVALID_SOCKET)
2852
FD_SET(ip_sock,&clientFDs);
2853
ip_flags = fcntl(ip_sock, F_GETFL, 0);
2855
MAYBE_BROKEN_SYSCALL;
2859
if (select((int) max_used_connection,&readFDs,0,0,0) < 0)
2861
if (socket_errno != SOCKET_EINTR)
2863
if (!select_errors++ && !abort_loop) /* purecov: inspected */
2864
sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
2866
MAYBE_BROKEN_SYSCALL
2871
MAYBE_BROKEN_SYSCALL;
2875
/* Is this a new connection request ? */
2881
#if !defined(NO_FCNTL_NONBLOCK)
2882
if (!(test_flags & TEST_BLOCKING))
2884
#if defined(O_NONBLOCK)
2885
fcntl(sock, F_SETFL, flags | O_NONBLOCK);
2886
#elif defined(O_NDELAY)
2887
fcntl(sock, F_SETFL, flags | O_NDELAY);
2890
#endif /* NO_FCNTL_NONBLOCK */
2891
for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++)
2893
size_socket length= sizeof(struct sockaddr_storage);
2894
new_sock= accept(sock, (struct sockaddr *)(&cAddr),
2896
if (new_sock != INVALID_SOCKET ||
2897
(socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
2899
MAYBE_BROKEN_SYSCALL;
2900
#if !defined(NO_FCNTL_NONBLOCK)
2901
if (!(test_flags & TEST_BLOCKING))
2903
if (retry == MAX_ACCEPT_RETRY - 1)
2904
fcntl(sock, F_SETFL, flags); // Try without O_NONBLOCK
2908
#if !defined(NO_FCNTL_NONBLOCK)
2909
if (!(test_flags & TEST_BLOCKING))
2910
fcntl(sock, F_SETFL, flags);
2912
if (new_sock == INVALID_SOCKET)
2914
if ((error_count++ & 255) == 0) // This can happen often
2915
sql_perror("Error in accept");
2916
MAYBE_BROKEN_SYSCALL;
2917
if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
2918
sleep(1); // Give other threads some time
2923
size_socket dummyLen;
2924
struct sockaddr_storage dummy;
2925
dummyLen = sizeof(dummy);
2926
if ( getsockname(new_sock,(struct sockaddr *)&dummy,
2927
(socklen_t *)&dummyLen) < 0 )
2929
sql_perror("Error on new connection socket");
2930
(void) shutdown(new_sock, SHUT_RDWR);
2931
(void) closesocket(new_sock);
2937
** Don't allow too many connections
2940
if (!(thd= new THD))
2942
(void) shutdown(new_sock, SHUT_RDWR);
2943
VOID(closesocket(new_sock));
2946
if (!(vio_tmp=vio_new(new_sock, VIO_TYPE_TCPIP, sock == 0)) ||
2947
my_net_init(&thd->net,vio_tmp))
2950
Only delete the temporary vio if we didn't already attach it to the
2951
NET object. The destructor in THD will delete any initialized net
2954
if (vio_tmp && thd->net.vio != vio_tmp)
2955
vio_delete(vio_tmp);
2958
(void) shutdown(new_sock, SHUT_RDWR);
2959
(void) closesocket(new_sock);
2965
create_new_thread(thd);
1649
2970
/****************************************************************************
1650
2971
Handle start options
1651
2972
******************************************************************************/
1653
enum options_drizzled
2976
OPT_ISAM_LOG=256, OPT_SKIP_NEW,
2978
OPT_ENABLE_LOCK, OPT_USE_LOCKING,
2979
OPT_SOCKET, OPT_UPDATE_LOG,
2982
OPT_BIND_ADDRESS, OPT_PID_FILE,
2983
OPT_SKIP_PRIOR, OPT_BIG_TABLES,
2985
OPT_CONSOLE, OPT_LOW_PRIORITY_UPDATES,
2986
OPT_SHORT_LOG_FORMAT,
2987
OPT_FLUSH, OPT_SAFE,
2988
OPT_BOOTSTRAP, OPT_SKIP_SHOW_DB,
2989
OPT_STORAGE_ENGINE, OPT_INIT_FILE,
2990
OPT_DELAY_KEY_WRITE_ALL, OPT_SLOW_QUERY_LOG,
2991
OPT_DELAY_KEY_WRITE, OPT_CHARSETS_DIR,
2992
OPT_MASTER_INFO_FILE,
2993
OPT_MASTER_RETRY_COUNT, OPT_LOG_TC, OPT_LOG_TC_SIZE,
2994
OPT_SQL_BIN_UPDATE_SAME, OPT_REPLICATE_DO_DB,
2995
OPT_REPLICATE_IGNORE_DB, OPT_LOG_SLAVE_UPDATES,
2996
OPT_BINLOG_DO_DB, OPT_BINLOG_IGNORE_DB,
2998
OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
1663
OPT_TC_HEURISTIC_RECOVER,
3000
OPT_MEMLOCK, OPT_MYISAM_RECOVER,
3001
OPT_REPLICATE_REWRITE_DB, OPT_SERVER_ID,
3002
OPT_SKIP_SLAVE_START,
3003
OPT_REPLICATE_DO_TABLE,
3004
OPT_REPLICATE_IGNORE_TABLE, OPT_REPLICATE_WILD_DO_TABLE,
3005
OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
3006
OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
3007
OPT_ABORT_SLAVE_EVENT_COUNT,
3008
OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
3009
OPT_ENGINE_CONDITION_PUSHDOWN,
1664
3010
OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
1665
3011
OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
1670
OPT_MAX_ALLOWED_PACKET,
3012
OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
3013
OPT_SAFE_USER_CREATE,
3014
OPT_DO_PSTACK, OPT_REPORT_HOST,
3015
OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT,
3016
OPT_SHOW_SLAVE_AUTH_INFO,
3017
OPT_SLAVE_LOAD_TMPDIR, OPT_NO_MIX_TYPE,
3018
OPT_RPL_RECOVERY_RANK,
3019
OPT_RELAY_LOG, OPT_RELAY_LOG_INDEX, OPT_RELAY_LOG_INFO_FILE,
3020
OPT_SLAVE_SKIP_ERRORS, OPT_SLAVE_ALLOW_BATCHING, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE,
3021
OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA,
3022
OPT_SSL_CAPATH, OPT_SSL_CIPHER,
3023
OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE,
3024
OPT_CONNECT_TIMEOUT,
3026
OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
3027
OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
3028
OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
3029
OPT_LONG_QUERY_TIME,
3030
OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
3031
OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
3032
OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
1671
3033
OPT_MAX_HEP_TABLE_SIZE,
1673
OPT_MAX_SORT_LENGTH,
3034
OPT_MAX_JOIN_SIZE, OPT_MAX_PREPARED_STMT_COUNT,
3035
OPT_MAX_RELAY_LOG_SIZE, OPT_MAX_SORT_LENGTH,
1674
3036
OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
1675
3037
OPT_MAX_LENGTH_FOR_SORT_DATA,
1676
3038
OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
1678
3040
OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
1679
3041
OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
1680
3042
OPT_MYISAM_USE_MMAP, OPT_MYISAM_REPAIR_THREADS,
1681
OPT_NET_BUFFER_LENGTH,
3043
OPT_MYISAM_STATS_METHOD,
3044
OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
3045
OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
3046
OPT_OPEN_FILES_LIMIT,
1682
3047
OPT_PRELOAD_BUFFER_SIZE,
1684
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT,
3048
OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_MIN_RES_UNIT, OPT_QUERY_CACHE_SIZE,
3049
OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER,
3050
OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT,
3051
OPT_RELAY_LOG_PURGE,
3052
OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
3053
OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING,
1686
3054
OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE,
3055
OPT_THREAD_CONCURRENCY, OPT_THREAD_CACHE_SIZE,
1687
3056
OPT_TMP_TABLE_SIZE, OPT_THREAD_STACK,
1688
3057
OPT_WAIT_TIMEOUT,
3059
OPT_DEFAULT_WEEK_FORMAT,
1689
3060
OPT_RANGE_ALLOC_BLOCK_SIZE,
1690
3061
OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
1691
3062
OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
3063
OPT_SYNC_FRM, OPT_SYNC_BINLOG,
3064
OPT_SYNC_REPLICATION,
3065
OPT_SYNC_REPLICATION_SLAVE_ID,
3066
OPT_SYNC_REPLICATION_TIMEOUT,
3067
OPT_ENABLE_SHARED_MEMORY,
3068
OPT_SHARED_MEMORY_BASE_NAME,
1692
3069
OPT_OLD_ALTER_TABLE,
3070
OPT_EXPIRE_LOGS_DAYS,
1693
3071
OPT_GROUP_CONCAT_MAX_LEN,
1694
3072
OPT_DEFAULT_COLLATION,
3073
OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
1695
3074
OPT_CHARACTER_SET_FILESYSTEM,
1696
3075
OPT_LC_TIME_NAMES,
1697
3076
OPT_INIT_CONNECT,
3081
OPT_DATETIME_FORMAT,
3082
OPT_LOG_QUERIES_NOT_USING_INDEXES,
1698
3083
OPT_DEFAULT_TIME_ZONE,
1699
3085
OPT_OPTIMIZER_SEARCH_DEPTH,
1702
3086
OPT_OPTIMIZER_PRUNE_LEVEL,
3087
OPT_UPDATABLE_VIEWS_WITH_LIMIT,
1703
3088
OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET,
1704
3089
OPT_ENABLE_LARGE_PAGES,
1705
3090
OPT_TIMED_MUTEXES,
3091
OPT_OLD_STYLE_USER_LIMITS,
3092
OPT_LOG_SLOW_ADMIN_STATEMENTS,
1706
3093
OPT_TABLE_LOCK_WAIT_TIMEOUT,
1709
3094
OPT_PLUGIN_LOAD,
1710
3095
OPT_PLUGIN_DIR,
1711
3097
OPT_PORT_OPEN_TIMEOUT,
3099
OPT_KEEP_FILES_ON_CREATE,
3102
OPT_THREAD_HANDLING,
3103
OPT_INNODB_ROLLBACK_ON_TIMEOUT,
1712
3104
OPT_SECURE_FILE_PRIV,
1713
3105
OPT_MIN_EXAMINED_ROW_LIMIT,
3106
OPT_LOG_SLOW_SLAVE_STATEMENTS,
3108
OPT_POOL_OF_THREADS,
1718
struct option my_long_options[] =
3113
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
3115
struct my_option my_long_options[] =
1721
{"help", '?', N_("Display this help and exit."),
3117
{"help", '?', "Display this help and exit.",
1722
3118
(char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
1724
{"daemon", 'd', N_("Run as daemon."),
1725
(char**) &opt_daemon, (char**) &opt_daemon, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
3120
{"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
3121
"Option used by mysql-test for debugging and testing of replication.",
3122
(char**) &abort_slave_event_count, (char**) &abort_slave_event_count,
3123
0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3124
{"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0,
3125
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1727
3126
{"auto-increment-increment", OPT_AUTO_INCREMENT,
1728
N_("Auto-increment columns are incremented by this"),
3127
"Auto-increment columns are incremented by this",
1729
3128
(char**) &global_system_variables.auto_increment_increment,
1730
(char**) &max_system_variables.auto_increment_increment, 0, GET_ULL,
1731
OPT_ARG, 1, 1, INT64_MAX, 0, 1, 0 },
3129
(char**) &max_system_variables.auto_increment_increment, 0, GET_ULONG,
3130
OPT_ARG, 1, 1, 65535, 0, 1, 0 },
1732
3131
{"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET,
1733
N_("Offset added to Auto-increment columns. Used when "
1734
"auto-increment-increment != 1"),
3132
"Offset added to Auto-increment columns. Used when auto-increment-increment != 1",
1735
3133
(char**) &global_system_variables.auto_increment_offset,
1736
(char**) &max_system_variables.auto_increment_offset, 0, GET_ULL, OPT_ARG,
1737
1, 1, INT64_MAX, 0, 1, 0 },
3134
(char**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
3135
1, 1, 65535, 0, 1, 0 },
1738
3136
{"basedir", 'b',
1739
N_("Path to installation directory. All paths are usually resolved "
1740
"relative to this."),
1741
NULL, NULL, 0, GET_STR, REQUIRED_ARG,
1744
N_("Chroot drizzled daemon during startup."),
1745
(char**) &drizzled_chroot, (char**) &drizzled_chroot, 0, GET_STR, REQUIRED_ARG,
1747
{"collation-server", OPT_DEFAULT_COLLATION,
1748
N_("Set the default collation."),
3137
"Path to installation directory. All paths are usually resolved relative to this.",
3138
(char**) &mysql_home_ptr, (char**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
3140
{"big-tables", OPT_BIG_TABLES,
3141
"Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors).",
3142
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3143
{"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
3144
(char**) &my_bind_addr_str, (char**) &my_bind_addr_str, 0, GET_STR,
3145
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3146
{"binlog_format", OPT_BINLOG_FORMAT,
3147
"Does not have any effect without '--log-bin'. "
3148
"Tell the master the form of binary logging to use: either 'row' for "
3149
"row-based binary logging, or 'statement' for statement-based binary "
3150
"logging, or 'mixed'. 'mixed' is statement-based binary logging except "
3151
"for those statements where only row-based is correct: those which "
3152
"involve user-defined functions (i.e. UDFs) or the UUID() function; for "
3153
"those, row-based binary logging is automatically used. "
3154
,(char**) &opt_binlog_format, (char**) &opt_binlog_format,
3155
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3156
{"binlog-do-db", OPT_BINLOG_DO_DB,
3157
"Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
3158
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3159
{"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
3160
"Tells the master that updates to the given database should not be logged tothe binary log.",
3161
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3162
{"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
3163
"The maximum size of a row-based binary log event in bytes. Rows will be "
3164
"grouped into events smaller than this size if possible. "
3165
"The value has to be a multiple of 256.",
3166
(char**) &opt_binlog_rows_event_max_size,
3167
(char**) &opt_binlog_rows_event_max_size, 0,
3168
GET_ULONG, REQUIRED_ARG,
3169
/* def_value */ 1024, /* min_value */ 256, /* max_value */ ULONG_MAX,
3170
/* sub_size */ 0, /* block_size */ 256,
3173
#ifndef DISABLE_GRANT_OPTIONS
3174
{"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0,
3175
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3177
{"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
3178
"Don't ignore client side character set value sent during handshake.",
3179
(char**) &opt_character_set_client_handshake,
3180
(char**) &opt_character_set_client_handshake,
3181
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
3182
{"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
3183
"Set the filesystem character set.",
3184
(char**) &character_set_filesystem_name,
3185
(char**) &character_set_filesystem_name,
3186
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3187
{"character-set-server", 'C', "Set the default character set.",
3188
(char**) &default_character_set_name, (char**) &default_character_set_name,
3189
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3190
{"character-sets-dir", OPT_CHARSETS_DIR,
3191
"Directory where character sets are.", (char**) &charsets_dir,
3192
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3193
{"chroot", 'r', "Chroot mysqld daemon during startup.",
3194
(char**) &mysqld_chroot, (char**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
3196
{"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.",
1749
3197
(char**) &default_collation_name, (char**) &default_collation_name,
1750
3198
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
1751
{"completion-type", OPT_COMPLETION_TYPE,
1752
N_("Default completion type."),
3199
{"completion-type", OPT_COMPLETION_TYPE, "Default completion type.",
1753
3200
(char**) &global_system_variables.completion_type,
1754
(char**) &max_system_variables.completion_type, 0, GET_UINT,
3201
(char**) &max_system_variables.completion_type, 0, GET_ULONG,
1755
3202
REQUIRED_ARG, 0, 0, 2, 0, 1, 0},
1756
{"core-file", OPT_WANT_CORE,
1757
N_("Write core on errors."),
1758
0, 0, 0, GET_NO_ARG,
3203
{"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.",
3204
(char**) &opt_console, (char**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
3206
{"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
1759
3207
NO_ARG, 0, 0, 0, 0, 0, 0},
1761
N_("Path to the database root."),
1762
NULL, NULL, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3208
{"datadir", 'h', "Path to the database root.", (char**) &mysql_data_home,
3209
(char**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3210
{"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).",
3211
(char**) &default_character_set_name, (char**) &default_character_set_name,
3212
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3213
{"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).",
3214
(char**) &default_collation_name, (char**) &default_collation_name,
3215
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3216
{"default-storage-engine", OPT_STORAGE_ENGINE,
3217
"Set the default storage engine (table type) for tables.",
3218
(char**)&default_storage_engine_str, (char**)&default_storage_engine_str,
3219
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3220
{"default-table-type", OPT_STORAGE_ENGINE,
3221
"(deprecated) Use --default-storage-engine.",
3222
(char**)&default_storage_engine_str, (char**)&default_storage_engine_str,
3223
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3224
{"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.",
3225
(char**) &default_tz_name, (char**) &default_tz_name,
3226
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3227
{"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.",
3228
0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3229
{"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL,
3230
"Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).",
3231
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3232
{"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
3233
"Option used by mysql-test for debugging and testing of replication.",
3234
(char**) &disconnect_slave_event_count,
3235
(char**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
3237
#ifdef HAVE_STACK_TRACE_ON_SEGV
3238
{"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.",
3239
(char**) &opt_do_pstack, (char**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
3241
#endif /* HAVE_STACK_TRACE_ON_SEGV */
3242
{"engine-condition-pushdown",
3243
OPT_ENGINE_CONDITION_PUSHDOWN,
3244
"Push supported query conditions to the storage engine.",
3245
(char**) &global_system_variables.engine_condition_pushdown,
3246
(char**) &global_system_variables.engine_condition_pushdown,
3247
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
1763
3248
/* See how it's handled in get_one_option() */
1765
N_("Used for debugging; Use at your own risk!"),
1766
0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
3249
{"exit-info", 'T', "Used for debugging; Use at your own risk!", 0, 0, 0,
3250
GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
3251
{"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0,
3252
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1767
3253
/* We must always support the next option to make scripts like mysqltest
1768
3254
easier to do */
1769
3255
{"gdb", OPT_DEBUGGING,
1770
N_("Set up signals usable for debugging"),
3256
"Set up signals usable for debugging",
1771
3257
(char**) &opt_debugging, (char**) &opt_debugging,
1772
3258
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1773
{"log-warnings", 'W',
1774
N_("Log some not critical warnings to the log file."),
3259
{"general-log", OPT_GENERAL_LOG,
3260
"Enable|disable general log", (char**) &opt_log,
3261
(char**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
3262
{"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection",
3263
(char**) &opt_init_connect, (char**) &opt_init_connect, 0, GET_STR_ALLOC,
3264
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3265
{"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.",
3266
(char**) &opt_init_file, (char**) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
3268
{"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master",
3269
(char**) &opt_init_slave, (char**) &opt_init_slave, 0, GET_STR_ALLOC,
3270
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3272
"Client error messages in given language. May be given as a full path.",
3273
(char**) &language_ptr, (char**) &language_ptr, 0, GET_STR, REQUIRED_ARG,
3275
{"lc-time-names", OPT_LC_TIME_NAMES,
3276
"Set the language used for the month names and the days of the week.",
3277
(char**) &lc_time_names_name,
3278
(char**) &lc_time_names_name,
3279
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3280
{"local-infile", OPT_LOCAL_INFILE,
3281
"Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).",
3282
(char**) &opt_local_infile,
3283
(char**) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
3285
{"log", 'l', "Log connections and queries to file.", (char**) &opt_logname,
3286
(char**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3287
{"log-bin", OPT_BIN_LOG,
3288
"Log update queries in binary format. Optional (but strongly recommended "
3289
"to avoid replication problems if server's hostname changes) argument "
3290
"should be the chosen location for the binary log files.",
3291
(char**) &opt_bin_logname, (char**) &opt_bin_logname, 0, GET_STR_ALLOC,
3292
OPT_ARG, 0, 0, 0, 0, 0, 0},
3293
{"log-bin-index", OPT_BIN_LOG_INDEX,
3294
"File that holds the names for last binary log files.",
3295
(char**) &opt_binlog_index_name, (char**) &opt_binlog_index_name, 0, GET_STR,
3296
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3298
This option starts with "log-bin" to emphasize that it is specific of
3301
{"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
3302
"If equal to 0 (the default), then when --log-bin is used, creation of "
3303
"a stored function (or trigger) is allowed only to users having the SUPER privilege "
3304
"and only if this stored function (trigger) may not break binary logging."
3305
"Note that if ALL connections to this server ALWAYS use row-based binary "
3306
"logging, the security issues do not exist and the binary logging cannot "
3307
"break, so you can safely set this to 1."
3308
,(char**) &trust_function_creators, (char**) &trust_function_creators, 0,
3309
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3310
{"log-error", OPT_ERROR_LOG_FILE, "Error log file.",
3311
(char**) &log_error_file_ptr, (char**) &log_error_file_ptr, 0, GET_STR,
3312
OPT_ARG, 0, 0, 0, 0, 0, 0},
3313
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
3314
(char**) &myisam_log_filename, (char**) &myisam_log_filename, 0, GET_STR,
3315
OPT_ARG, 0, 0, 0, 0, 0, 0},
3316
{"log-long-format", '0',
3317
"Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.",
3318
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3319
#ifdef WITH_CSV_STORAGE_ENGINE
3320
{"log-output", OPT_LOG_OUTPUT,
3321
"Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, "
3323
(char**) &log_output_str, (char**) &log_output_str, 0,
3324
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3326
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
3327
"Log queries that are executed without benefit of any index to the slow log if it is open.",
3328
(char**) &opt_log_queries_not_using_indexes, (char**) &opt_log_queries_not_using_indexes,
3329
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3330
{"log-short-format", OPT_SHORT_LOG_FORMAT,
3331
"Don't log extra information to update and slow-query logs.",
3332
(char**) &opt_short_log_format, (char**) &opt_short_log_format,
3333
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3334
{"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
3335
"Tells the slave to log the updates from the slave thread to the binary log. You will need to turn it on if you plan to daisy-chain the slaves.",
3336
(char**) &opt_log_slave_updates, (char**) &opt_log_slave_updates, 0, GET_BOOL,
3337
NO_ARG, 0, 0, 0, 0, 0, 0},
3338
{"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS,
3339
"Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.",
3340
(char**) &opt_log_slow_admin_statements,
3341
(char**) &opt_log_slow_admin_statements,
3342
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3343
{"log-slow-slave-statements", OPT_LOG_SLOW_SLAVE_STATEMENTS,
3344
"Log slow statements executed by slave thread to the slow log if it is open.",
3345
(char**) &opt_log_slow_slave_statements,
3346
(char**) &opt_log_slow_slave_statements,
3347
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3348
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
3349
"Log slow queries to a table or log file. Defaults logging to table mysql.slow_log or hostname-slow.log if --log-output=file is used. Must be enabled to activate other slow log options.",
3350
(char**) &opt_slow_logname, (char**) &opt_slow_logname, 0, GET_STR, OPT_ARG,
3352
{"log-tc", OPT_LOG_TC,
3353
"Path to transaction coordinator log (used for transactions that affect "
3354
"more than one storage engine, when binary log is disabled)",
3355
(char**) &opt_tc_log_file, (char**) &opt_tc_log_file, 0, GET_STR,
3356
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3358
{"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.",
3359
(char**) &opt_tc_log_size, (char**) &opt_tc_log_size, 0, GET_ULONG,
3360
REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0,
3361
TC_LOG_PAGE_SIZE, 0},
3363
{"log-warnings", 'W', "Log some not critical warnings to the log file.",
1775
3364
(char**) &global_system_variables.log_warnings,
1776
(char**) &max_system_variables.log_warnings, 0, GET_BOOL, OPT_ARG, 1, 0, 0,
3365
(char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
1778
{"pid-file", OPT_PID_FILE,
1779
N_("Pid file used by drizzled."),
1780
NULL, NULL, 0, GET_STR,
1781
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3367
{"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
3368
"INSERT/DELETE/UPDATE has lower priority than selects.",
3369
(char**) &global_system_variables.low_priority_updates,
3370
(char**) &max_system_variables.low_priority_updates,
3371
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3372
{"master-info-file", OPT_MASTER_INFO_FILE,
3373
"The location and name of the file that remembers the master and where the I/O replication \
3374
thread is in the master's binlogs.",
3375
(char**) &master_info_file, (char**) &master_info_file, 0, GET_STR,
3376
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3377
{"master-retry-count", OPT_MASTER_RETRY_COUNT,
3378
"The number of tries the slave will make to connect to the master before giving up.",
3379
(char**) &master_retry_count, (char**) &master_retry_count, 0, GET_ULONG,
3380
REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
3381
{"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS,
3382
"Option used by mysql-test for debugging and testing of replication.",
3383
(char**) &max_binlog_dump_events, (char**) &max_binlog_dump_events, 0,
3384
GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3385
{"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (char**) &locked_in_memory,
3386
(char**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3387
{"myisam-recover", OPT_MYISAM_RECOVER,
3388
"Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
3389
(char**) &myisam_recover_options_str, (char**) &myisam_recover_options_str, 0,
3390
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3391
{"new", 'n', "Use very new possible 'unsafe' functions.",
3392
(char**) &global_system_variables.new_mode,
3393
(char**) &max_system_variables.new_mode,
3394
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3395
{"old-alter-table", OPT_OLD_ALTER_TABLE,
3396
"Use old, non-optimized alter table.",
3397
(char**) &global_system_variables.old_alter_table,
3398
(char**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
3400
{"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
3401
"Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)",
3402
(char**) &opt_old_style_user_limits, (char**) &opt_old_style_user_limits,
3403
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3404
{"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.",
3405
(char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR,
3406
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3407
{"port", 'P', "Port number to use for connection or 0 for default to, in "
3408
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
3409
#if MYSQL_PORT_DEFAULT == 0
3412
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
3413
(char**) &mysqld_port,
3414
(char**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1782
3415
{"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
1783
N_("Maximum time in seconds to wait for the port to become free. "
1784
"(Default: no wait)"),
1785
(char**) &drizzled_bind_timeout,
1786
(char**) &drizzled_bind_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3416
"Maximum time in seconds to wait for the port to become free. "
3417
"(Default: no wait)", (char**) &mysqld_port_timeout,
3418
(char**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3419
{"relay-log", OPT_RELAY_LOG,
3420
"The location and name to use for relay logs.",
3421
(char**) &opt_relay_logname, (char**) &opt_relay_logname, 0,
3422
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3423
{"relay-log-index", OPT_RELAY_LOG_INDEX,
3424
"The location and name to use for the file that keeps a list of the last \
3426
(char**) &opt_relaylog_index_name, (char**) &opt_relaylog_index_name, 0,
3427
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3428
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
3429
"The location and name of the file that remembers where the SQL replication \
3430
thread is in the relay logs.",
3431
(char**) &relay_log_info_file, (char**) &relay_log_info_file, 0, GET_STR,
3432
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3433
{"replicate-do-db", OPT_REPLICATE_DO_DB,
3434
"Tells the slave thread to restrict replication to the specified database. To specify more than one database, use the directive multiple times, once for each database. Note that this will only work if you do not use cross-database queries such as UPDATE some_db.some_table SET foo='bar' while having selected a different or no database. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-do-table=db_name.%.",
3435
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3436
{"replicate-do-table", OPT_REPLICATE_DO_TABLE,
3437
"Tells the slave thread to restrict replication to the specified table. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates, in contrast to replicate-do-db.",
3438
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3439
{"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB,
3440
"Tells the slave thread to not replicate to the specified database. To specify more than one database to ignore, use the directive multiple times, once for each database. This option will not work if you use cross database updates. If you need cross database updates to work, make sure you have 3.23.28 or later, and use replicate-wild-ignore-table=db_name.%. ",
3441
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3442
{"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
3443
"Tells the slave thread to not replicate to the specified table. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-datbase updates, in contrast to replicate-ignore-db.",
3444
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3445
{"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
3446
"Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.",
3447
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3448
{"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
3449
"In replication, if set to 1, do not skip events having our server id. \
3450
Default value is 0 (to break infinite loops in circular replication). \
3451
Can't be set to 1 if --log-slave-updates is used.",
3452
(char**) &replicate_same_server_id,
3453
(char**) &replicate_same_server_id,
3454
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3455
{"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
3456
"Tells the slave thread to restrict replication to the tables that match the specified wildcard pattern. To specify more than one table, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-do-table=foo%.bar% will replicate only updates to tables in all databases that start with foo and whose table names start with bar.",
3457
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3458
{"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE,
3459
"Tells the slave thread to not replicate to the tables that match the given wildcard pattern. To specify more than one table to ignore, use the directive multiple times, once for each table. This will work for cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% will not do updates to tables in databases that start with foo and whose table names start with bar.",
3460
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3461
// In replication, we may need to tell the other servers how to connect
3462
{"report-host", OPT_REPORT_HOST,
3463
"Hostname or IP of the slave to be reported to to the master during slave registration. Will appear in the output of SHOW SLAVE HOSTS. Leave unset if you do not want the slave to register itself with the master. Note that it is not sufficient for the master to simply read the IP of the slave off the socket once the slave connects. Due to NAT and other routing issues, that IP may not be valid for connecting to the slave from the master or other hosts.",
3464
(char**) &report_host, (char**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
3466
{"report-password", OPT_REPORT_PASSWORD, "Undocumented.",
3467
(char**) &report_password, (char**) &report_password, 0, GET_STR,
3468
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3469
{"report-port", OPT_REPORT_PORT,
3470
"Port for connecting to slave reported to the master during slave registration. Set it only if the slave is listening on a non-default port or if you have a special tunnel from the master or other clients to the slave. If not sure, leave this option unset.",
3471
(char**) &report_port, (char**) &report_port, 0, GET_UINT, REQUIRED_ARG,
3472
MYSQL_PORT, 0, 0, 0, 0, 0},
3473
{"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
3474
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
1787
3475
{"secure-file-priv", OPT_SECURE_FILE_PRIV,
1788
N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
1789
"within specified directory"),
3476
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory",
3477
(char**) &opt_secure_file_priv, (char**) &opt_secure_file_priv, 0,
1791
3478
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1792
3479
{"server-id", OPT_SERVER_ID,
1793
N_("Uniquely identifies the server instance in the community of "
1794
"replication partners."),
1795
(char**) &server_id, (char**) &server_id, 0, GET_UINT32, REQUIRED_ARG, 0, 0, 0,
3480
"Uniquely identifies the server instance in the community of replication partners.",
3481
(char**) &server_id, (char**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
3483
{"set-variable", 'O',
3484
"Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
3485
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3486
{"skip-new", OPT_SKIP_NEW, "Don't use new, possible wrong routines.",
3487
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3488
{"skip-slave-start", OPT_SKIP_SLAVE_START,
3489
"If set, slave is not autostarted.", (char**) &opt_skip_slave_start,
3490
(char**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
1797
3491
{"skip-stack-trace", OPT_SKIP_STACK_TRACE,
1798
N_("Don't print a stack trace on failure."),
1799
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
3492
"Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
1801
{"symbolic-links", 's',
1802
N_("Enable symbolic link support."),
1803
(char**) &internal::my_use_symdir, (char**) &internal::my_use_symdir, 0, GET_BOOL, NO_ARG,
3494
{"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.",
3495
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3496
{"skip-thread-priority", OPT_SKIP_PRIOR,
3497
"Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG,
3498
DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
3499
{"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
3500
"The location where the slave should put its temporary files when \
3501
replicating a LOAD DATA INFILE command.",
3502
(char**) &slave_load_tmpdir, (char**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
3503
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3504
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
3505
"Tells the slave thread to continue replication when a query event returns an error from the provided list.",
3506
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3507
{"slave-exec-mode", OPT_SLAVE_EXEC_MODE,
3508
"Modes for how replication events should be executed. Legal values are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will not stop for operations that are idempotent. In STRICT mode, replication will stop on any unexpected difference between the master and the slave.",
3509
(char**) &slave_exec_mode_str, (char**) &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3510
{"slow-query-log", OPT_SLOW_LOG,
3511
"Enable|disable slow query log", (char**) &opt_slow_log,
3512
(char**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
3513
{"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
3514
"The update log is deprecated since version 5.0, is replaced by the binary \
3515
log and this option does nothing anymore.",
3516
0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0},
3517
{"symbolic-links", 's', "Enable symbolic link support.",
3518
(char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
1805
3520
The system call realpath() produces warnings under valgrind and
1806
3521
purify. These are not suppressed: instead we disable symlinks
1807
3522
option if compiled with valgrind support.
1809
3524
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
3525
{"sysdate-is-now", OPT_SYSDATE_IS_NOW,
3526
"Non-default option to alias SYSDATE() to NOW() to make it safe-replicable. Since 5.0, SYSDATE() returns a `dynamic' value different for different invocations, even within the same statement.",
3527
(char**) &global_system_variables.sysdate_is_now,
3528
0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3529
{"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER,
3530
"Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.",
3531
(char**) &opt_tc_heuristic_recover, (char**) &opt_tc_heuristic_recover,
3532
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3533
{"temp-pool", OPT_TEMP_POOL,
3534
"Using this option will cause most temporary files created to use a small set of names, rather than a unique name for each new file.",
3535
(char**) &use_temp_pool, (char**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
1810
3537
{"timed_mutexes", OPT_TIMED_MUTEXES,
1811
N_("Specify whether to time mutexes (only InnoDB mutexes are currently "
1813
(char**) &internal::timed_mutexes, (char**) &internal::timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
3538
"Specify whether to time mutexes (only InnoDB mutexes are currently supported)",
3539
(char**) &timed_mutexes, (char**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
1814
3540
0, 0, 0, 0, 0},
3542
"Path for temporary files. Several paths may be specified, separated by a "
3544
", in this case they are used in a round-robin fashion.",
3545
(char**) &opt_mysql_tmpdir,
3546
(char**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1815
3547
{"transaction-isolation", OPT_TX_ISOLATION,
1816
N_("Default transaction isolation level."),
1817
0, 0, 0, GET_STR, REQUIRED_ARG, 0,
3548
"Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0,
1818
3549
0, 0, 0, 0, 0},
1820
N_("Run drizzled daemon as user."),
1821
0, 0, 0, GET_STR, REQUIRED_ARG,
3550
{"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
3551
(char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
3552
IF_PURIFY(0,1), 0, 0, 0, 0, 0},
3553
{"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
1822
3554
0, 0, 0, 0, 0, 0},
1823
{"back_log", OPT_BACK_LOG,
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 "
1826
"requests in a very short time."),
1827
(char**) &back_log, (char**) &back_log, 0, GET_UINT,
3555
{"verbose", 'v', "Used with --help option for detailed help",
3556
(char**) &opt_verbose, (char**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
3558
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
3559
NO_ARG, 0, 0, 0, 0, 0, 0},
3560
{"warnings", 'W', "Deprecated; use --log-warnings instead.",
3561
(char**) &global_system_variables.log_warnings,
3562
(char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG,
3563
1, 0, ULONG_MAX, 0, 0, 0},
3564
{ "back_log", OPT_BACK_LOG,
3565
"The number of outstanding connection requests MySQL can have. This comes into play when the main MySQL thread gets very many connection requests in a very short time.",
3566
(char**) &back_log, (char**) &back_log, 0, GET_ULONG,
1828
3567
REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
1829
{ "bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
1830
N_("Size of tree cache used in bulk insert optimization. Note that this is "
1831
"a limit per thread!"),
1832
(char**) &global_system_variables.bulk_insert_buff_size,
1833
(char**) &max_system_variables.bulk_insert_buff_size,
1834
0, GET_ULL, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
1835
{ "div_precision_increment", OPT_DIV_PRECINCREMENT,
1836
N_("Precision of the result of '/' operator will be increased on that "
3568
{"binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
3569
"The size of the cache to hold the SQL statements for the binary log during a transaction. If you often use big, multi-statement transactions you can increase this to get more performance.",
3570
(char**) &binlog_cache_size, (char**) &binlog_cache_size, 0, GET_ULONG,
3571
REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3572
{"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
3573
"Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!",
3574
(char**) &global_system_variables.bulk_insert_buff_size,
3575
(char**) &max_system_variables.bulk_insert_buff_size,
3576
0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
3577
{"connect_timeout", OPT_CONNECT_TIMEOUT,
3578
"The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.",
3579
(char**) &connect_timeout, (char**) &connect_timeout,
3580
0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
3581
{ "date_format", OPT_DATE_FORMAT,
3582
"The DATE format (For future).",
3583
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
3584
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
3585
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3586
{ "datetime_format", OPT_DATETIME_FORMAT,
3587
"The DATETIME/TIMESTAMP format (for future).",
3588
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
3589
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
3590
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3591
{ "default_week_format", OPT_DEFAULT_WEEK_FORMAT,
3592
"The default week format used by WEEK() functions.",
3593
(char**) &global_system_variables.default_week_format,
3594
(char**) &max_system_variables.default_week_format,
3595
0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0},
3596
{"div_precision_increment", OPT_DIV_PRECINCREMENT,
3597
"Precision of the result of '/' operator will be increased on that value.",
1838
3598
(char**) &global_system_variables.div_precincrement,
1839
(char**) &max_system_variables.div_precincrement, 0, GET_UINT,
3599
(char**) &max_system_variables.div_precincrement, 0, GET_ULONG,
1840
3600
REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
1841
{ "join_buffer_size", OPT_JOIN_BUFF_SIZE,
1842
N_("The size of the buffer that is used for full joins."),
3601
{"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
3602
"If non-zero, binary logs will be purged after expire_logs_days "
3603
"days; possible purges happen at startup and at binary log rotation.",
3604
(char**) &expire_logs_days,
3605
(char**) &expire_logs_days, 0, GET_ULONG,
3606
REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
3607
{ "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN,
3608
"The maximum length of the result of function group_concat.",
3609
(char**) &global_system_variables.group_concat_max_len,
3610
(char**) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
3611
REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0},
3612
{"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
3613
"The number of seconds the server waits for activity on an interactive connection before closing it.",
3614
(char**) &global_system_variables.net_interactive_timeout,
3615
(char**) &max_system_variables.net_interactive_timeout, 0,
3616
GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3617
{"join_buffer_size", OPT_JOIN_BUFF_SIZE,
3618
"The size of the buffer that is used for full joins.",
1843
3619
(char**) &global_system_variables.join_buff_size,
1844
(char**) &max_system_variables.join_buff_size, 0, GET_UINT64,
3620
(char**) &max_system_variables.join_buff_size, 0, GET_ULONG,
1845
3621
REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX,
1846
3622
MALLOC_OVERHEAD, IO_SIZE, 0},
3623
{"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
3624
"Don't overwrite stale .MYD and .MYI even if no directory is specified.",
3625
(char**) &global_system_variables.keep_files_on_create,
3626
(char**) &max_system_variables.keep_files_on_create,
3627
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
3628
{"key_buffer_size", OPT_KEY_BUFFER_SIZE,
3629
"The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford; 64M on a 256M machine that mainly runs MySQL is quite common.",
3630
(char**) &dflt_key_cache_var.param_buff_size,
3632
0, (GET_ULL | GET_ASK_ADDR),
3633
REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD,
3635
{"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
3636
"This characterizes the number of hits a hot block has to be untouched until it is considered aged enough to be downgraded to a warm block. This specifies the percentage ratio of that number of hits to the total number of blocks in key cache",
3637
(char**) &dflt_key_cache_var.param_age_threshold,
3639
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
3640
300, 100, ULONG_MAX, 0, 100, 0},
3641
{"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
3642
"The default size of key cache blocks",
3643
(char**) &dflt_key_cache_var.param_block_size,
3645
0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
3646
KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0},
3647
{"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
3648
"The minimum percentage of warm blocks in key cache",
3649
(char**) &dflt_key_cache_var.param_division_limit,
3651
0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
3653
{"long_query_time", OPT_LONG_QUERY_TIME,
3654
"Log all queries that have taken more than long_query_time seconds to execute to file. "
3655
"The argument will be treated as a decimal value with microsecond precission.",
3656
(char**) &long_query_time, (char**) &long_query_time, 0, GET_DOUBLE,
3657
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
3658
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
3659
"If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive. Should be set to 2 if you are using a case insensitive file system",
3660
(char**) &lower_case_table_names,
3661
(char**) &lower_case_table_names, 0, GET_UINT, OPT_ARG,
3662
#ifdef FN_NO_CASE_SENCE
1847
3668
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
1848
N_("Max packetlength to send/receive from to server."),
3669
"Max packetlength to send/receive from to server.",
1849
3670
(char**) &global_system_variables.max_allowed_packet,
1850
(char**) &max_system_variables.max_allowed_packet, 0, GET_UINT32,
1851
REQUIRED_ARG, 64*1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
3671
(char**) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
3672
REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
3673
{"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
3674
"Can be used to restrict the total size used to cache a multi-transaction query.",
3675
(char**) &max_binlog_cache_size, (char**) &max_binlog_cache_size, 0,
3676
GET_ULONG, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3677
{"max_binlog_size", OPT_MAX_BINLOG_SIZE,
3678
"Binary log will be rotated automatically when the size exceeds this \
3679
value. Will also apply to relay logs if max_relay_log_size is 0. \
3680
The minimum value for this variable is 4096.",
3681
(char**) &max_binlog_size, (char**) &max_binlog_size, 0, GET_ULONG,
3682
REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0},
3683
{"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
3684
"If there is more than this number of interrupted connections from a host this host will be blocked from further connections.",
3685
(char**) &max_connect_errors, (char**) &max_connect_errors, 0, GET_ULONG,
3686
REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0},
3687
// Default max_connections of 151 is larger than Apache's default max
3688
// children, to avoid "too many connections" error in a common setup
3689
{"max_connections", OPT_MAX_CONNECTIONS,
3690
"The number of simultaneous clients allowed.", (char**) &max_connections,
3691
(char**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
3693
{"max_error_count", OPT_MAX_ERROR_COUNT,
3694
"Max number of errors/warnings to store for a statement.",
3695
(char**) &global_system_variables.max_error_count,
3696
(char**) &max_system_variables.max_error_count,
3697
0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0},
1852
3698
{"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
1853
N_("Don't allow creation of heap tables bigger than this."),
3699
"Don't allow creation of heap tables bigger than this.",
1854
3700
(char**) &global_system_variables.max_heap_table_size,
1855
3701
(char**) &max_system_variables.max_heap_table_size, 0, GET_ULL,
1856
REQUIRED_ARG, 16*1024*1024L, 16384, (int64_t)MAX_MEM_TABLE_SIZE,
3702
REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE,
1857
3703
MALLOC_OVERHEAD, 1024, 0},
1858
3704
{"max_join_size", OPT_MAX_JOIN_SIZE,
1859
N_("Joins that are probably going to read more than max_join_size records "
1860
"return an error."),
3705
"Joins that are probably going to read more than max_join_size records return an error.",
1861
3706
(char**) &global_system_variables.max_join_size,
1862
3707
(char**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
1863
INT32_MAX, 1, INT32_MAX, 0, 1, 0},
1864
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
1865
N_("Max number of bytes in sorted records."),
1866
(char**) &global_system_variables.max_length_for_sort_data,
1867
(char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULL,
1868
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3708
~0L, 1, ~0L, 0, 1, 0},
3709
{"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
3710
"Max number of bytes in sorted records.",
3711
(char**) &global_system_variables.max_length_for_sort_data,
3712
(char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
3713
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3714
{"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
3715
"If non-zero: relay log will be rotated automatically when the size exceeds this value; if zero (the default): when the size exceeds max_binlog_size. 0 excepted, the minimum value for this variable is 4096.",
3716
(char**) &max_relay_log_size, (char**) &max_relay_log_size, 0, GET_ULONG,
3717
REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0},
1869
3718
{ "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
1870
N_("Limit assumed max number of seeks when looking up rows based on a key"),
3719
"Limit assumed max number of seeks when looking up rows based on a key",
1871
3720
(char**) &global_system_variables.max_seeks_for_key,
1872
(char**) &max_system_variables.max_seeks_for_key, 0, GET_UINT64,
3721
(char**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
1873
3722
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
1874
3723
{"max_sort_length", OPT_MAX_SORT_LENGTH,
1875
N_("The number of bytes to use when sorting BLOB or TEXT values "
1876
"(only the first max_sort_length bytes of each value are used; the "
1877
"rest are ignored)."),
3724
"The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored).",
1878
3725
(char**) &global_system_variables.max_sort_length,
1879
(char**) &max_system_variables.max_sort_length, 0, GET_SIZE,
3726
(char**) &max_system_variables.max_sort_length, 0, GET_ULONG,
1880
3727
REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3728
{"max_tmp_tables", OPT_MAX_TMP_TABLES,
3729
"Maximum number of temporary tables a client can keep open at a time.",
3730
(char**) &global_system_variables.max_tmp_tables,
3731
(char**) &max_system_variables.max_tmp_tables, 0, GET_ULONG,
3732
REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0},
1881
3733
{"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
1882
N_("After this many write locks, allow some read locks to run in between."),
1883
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULL,
3734
"After this many write locks, allow some read locks to run in between.",
3735
(char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULONG,
1884
3736
REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
1885
3737
{"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
1886
N_("Don't log queries which examine less than min_examined_row_limit "
3738
"Don't log queries which examine less than min_examined_row_limit rows to file.",
1888
3739
(char**) &global_system_variables.min_examined_row_limit,
1889
(char**) &max_system_variables.min_examined_row_limit, 0, GET_ULL,
1890
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0},
3740
(char**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG,
3741
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0},
3742
{"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
3743
"Block size to be used for MyISAM index pages.",
3744
(char**) &opt_myisam_block_size,
3745
(char**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
3746
MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
3747
0, MI_MIN_KEY_BLOCK_LENGTH, 0},
3748
{"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE,
3749
"Default pointer size to be used for MyISAM tables.",
3750
(char**) &myisam_data_pointer_size,
3751
(char**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
3753
{"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
3754
"Deprecated option",
3755
(char**) &global_system_variables.myisam_max_extra_sort_file_size,
3756
(char**) &max_system_variables.myisam_max_extra_sort_file_size,
3757
0, GET_ULL, REQUIRED_ARG, (uint64_t) MI_MAX_TEMP_LENGTH,
3758
0, (uint64_t) MAX_FILE_SIZE, 0, 1, 0},
3759
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
3760
"Don't use the fast sort index method to created index if the temporary file would get bigger than this.",
3761
(char**) &global_system_variables.myisam_max_sort_file_size,
3762
(char**) &max_system_variables.myisam_max_sort_file_size, 0,
3763
GET_ULL, REQUIRED_ARG, (int64_t) LONG_MAX, 0, (uint64_t) MAX_FILE_SIZE,
3765
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
3766
"Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.",
3767
(char**) &global_system_variables.myisam_repair_threads,
3768
(char**) &max_system_variables.myisam_repair_threads, 0,
3769
GET_ULONG, REQUIRED_ARG, 1, 1, ULONG_MAX, 0, 1, 0},
3770
{"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
3771
"The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
3772
(char**) &global_system_variables.myisam_sort_buff_size,
3773
(char**) &max_system_variables.myisam_sort_buff_size, 0,
3774
GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
3775
{"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
3776
"Specifies how MyISAM index statistics collection code should threat NULLs. "
3777
"Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
3778
"\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
3779
(char**) &myisam_stats_method_str, (char**) &myisam_stats_method_str, 0,
3780
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3781
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
3782
"Buffer length for TCP/IP and socket communication.",
3783
(char**) &global_system_variables.net_buffer_length,
3784
(char**) &max_system_variables.net_buffer_length, 0, GET_ULONG,
3785
REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0},
3786
{"net_read_timeout", OPT_NET_READ_TIMEOUT,
3787
"Number of seconds to wait for more data from a connection before aborting the read.",
3788
(char**) &global_system_variables.net_read_timeout,
3789
(char**) &max_system_variables.net_read_timeout, 0, GET_ULONG,
3790
REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3791
{"net_retry_count", OPT_NET_RETRY_COUNT,
3792
"If a read on a communication port is interrupted, retry this many times before giving up.",
3793
(char**) &global_system_variables.net_retry_count,
3794
(char**) &max_system_variables.net_retry_count,0,
3795
GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ULONG_MAX, 0, 1, 0},
3796
{"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
3797
"Number of seconds to wait for a block to be written to a connection before aborting the write.",
3798
(char**) &global_system_variables.net_write_timeout,
3799
(char**) &max_system_variables.net_write_timeout, 0, GET_ULONG,
3800
REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3801
{ "old", OPT_OLD_MODE, "Use compatible behavior.",
3802
(char**) &global_system_variables.old_mode,
3803
(char**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
3805
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
3806
"If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of files.",
3807
(char**) &open_files_limit, (char**) &open_files_limit, 0, GET_ULONG,
3808
REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0},
1891
3809
{"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL,
1892
N_("Controls the heuristic(s) applied during query optimization to prune "
1893
"less-promising partial plans from the optimizer search space. Meaning: "
1894
"false - do not apply any heuristic, thus perform exhaustive search; "
1895
"true - prune plans based on number of retrieved rows."),
1896
(char**) &global_system_variables.optimizer_prune_level,
1897
(char**) &max_system_variables.optimizer_prune_level,
1898
0, GET_BOOL, OPT_ARG, 1, 0, 1, 0, 1, 0},
3810
"Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows.",
3811
(char**) &global_system_variables.optimizer_prune_level,
3812
(char**) &max_system_variables.optimizer_prune_level,
3813
0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0},
1899
3814
{"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH,
1900
N_("Maximum depth of search performed by the query optimizer. Values "
1901
"larger than the number of relations in a query result in better query "
1902
"plans, but take longer to compile a query. Smaller values than the "
1903
"number of tables in a relation result in faster optimization, but may "
1904
"produce very bad query plans. If set to 0, the system will "
1905
"automatically pick a reasonable value; if set to MAX_TABLES+2, the "
1906
"optimizer will switch to the original find_best (used for "
1907
"testing/comparison)."),
3815
"Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Smaller values than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to MAX_TABLES+2, the optimizer will switch to the original find_best (used for testing/comparison).",
1908
3816
(char**) &global_system_variables.optimizer_search_depth,
1909
3817
(char**) &max_system_variables.optimizer_search_depth,
1910
0, GET_UINT, OPT_ARG, 0, 0, MAX_TABLES+2, 0, 1, 0},
3818
0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
1911
3819
{"plugin_dir", OPT_PLUGIN_DIR,
1912
N_("Directory for plugins."),
1914
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1915
{"plugin_add", OPT_PLUGIN_ADD,
1916
N_("Optional comma separated list of plugins to load at startup in addition "
1917
"to the default list of plugins. "
1918
"[for example: --plugin_add=crc32,logger_gearman]"),
1920
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1921
{"plugin_remove", OPT_PLUGIN_ADD,
1922
N_("Optional comma separated list of plugins to not load at startup. Effectively "
1923
"removes a plugin from the list of plugins to be loaded. "
1924
"[for example: --plugin_remove=crc32,logger_gearman]"),
3820
"Directory for plugins.",
3821
(char**) &opt_plugin_dir_ptr, (char**) &opt_plugin_dir_ptr, 0,
1926
3822
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1927
3823
{"plugin_load", OPT_PLUGIN_LOAD,
1928
N_("Optional comma separated list of plugins to load at starup instead of "
1929
"the default plugin load list. "
1930
"[for example: --plugin_load=crc32,logger_gearman]"),
3824
"Optional colon separated list of plugins to load, where each plugin is "
3825
"identified by name and path to library seperated by an equals.",
3826
(char**) &opt_plugin_load, (char**) &opt_plugin_load, 0,
1932
3827
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1933
3828
{"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
1934
N_("The size of the buffer that is allocated when preloading indexes"),
3829
"The size of the buffer that is allocated when preloading indexes",
1935
3830
(char**) &global_system_variables.preload_buff_size,
1936
(char**) &max_system_variables.preload_buff_size, 0, GET_ULL,
3831
(char**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
1937
3832
REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
1938
3833
{"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
1939
N_("Allocation block size for query parsing and execution"),
3834
"Allocation block size for query parsing and execution",
1940
3835
(char**) &global_system_variables.query_alloc_block_size,
1941
(char**) &max_system_variables.query_alloc_block_size, 0, GET_UINT,
3836
(char**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
1942
3837
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
1943
3838
{"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
1944
N_("Persistent buffer for query parsing and execution"),
3839
"Persistent buffer for query parsing and execution",
1945
3840
(char**) &global_system_variables.query_prealloc_size,
1946
(char**) &max_system_variables.query_prealloc_size, 0, GET_UINT,
3841
(char**) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
1947
3842
REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE,
1948
3843
ULONG_MAX, 0, 1024, 0},
1949
3844
{"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
1950
N_("Allocation block size for storing ranges during optimization"),
3845
"Allocation block size for storing ranges during optimization",
1951
3846
(char**) &global_system_variables.range_alloc_block_size,
1952
(char**) &max_system_variables.range_alloc_block_size, 0, GET_SIZE,
1953
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, (int64_t)SIZE_MAX,
3847
(char**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
3848
REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX,
1955
3850
{"read_buffer_size", OPT_RECORD_BUFFER,
1956
N_("Each thread that does a sequential scan allocates a buffer of this "
1957
"size for each table it scans. If you do many sequential scans, you may "
1958
"want to increase this value."),
1959
(char**) &global_system_variables.read_buff_size,
1960
(char**) &max_system_variables.read_buff_size,0, GET_UINT, REQUIRED_ARG,
1961
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE,
3851
"Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value.",
3852
(char**) &global_system_variables.read_buff_size,
3853
(char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3854
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE,
3856
{"read_only", OPT_READONLY,
3857
"Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege",
3858
(char**) &opt_readonly,
3859
(char**) &opt_readonly,
3860
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
1963
3861
{"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
1964
N_("When reading rows in sorted order after a sort, the rows are read "
1965
"through this buffer to avoid a disk seeks. If not set, then it's set "
1966
"to the value of record_buffer."),
3862
"When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks. If not set, then it's set to the value of record_buffer.",
1967
3863
(char**) &global_system_variables.read_rnd_buff_size,
1968
3864
(char**) &max_system_variables.read_rnd_buff_size, 0,
1969
GET_UINT, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
1970
UINT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
1971
/* x8 compared to MySQL's x2. We have UTF8 to consider. */
3865
GET_ULONG, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
3866
INT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
3867
{"record_buffer", OPT_RECORD_BUFFER,
3868
"Alias for read_buffer_size",
3869
(char**) &global_system_variables.read_buff_size,
3870
(char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3871
128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE, 0},
3872
{"relay_log_purge", OPT_RELAY_LOG_PURGE,
3873
"0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.",
3874
(char**) &relay_log_purge,
3875
(char**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
3877
{"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
3878
"Maximum space to use for all relay logs.",
3879
(char**) &relay_log_space_limit,
3880
(char**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
3881
(int64_t) ULONG_MAX, 0, 1, 0},
3882
{"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
3883
"Use compression on master/slave protocol.",
3884
(char**) &opt_slave_compressed_protocol,
3885
(char**) &opt_slave_compressed_protocol,
3886
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3887
{"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
3888
"Number of seconds to wait for more data from a master/slave connection before aborting the read.",
3889
(char**) &slave_net_timeout, (char**) &slave_net_timeout, 0,
3890
GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3891
{"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES,
3892
"Number of times the slave SQL thread will retry a transaction in case "
3893
"it failed with a deadlock or elapsed lock wait timeout, "
3894
"before giving up and stopping.",
3895
(char**) &slave_trans_retries, (char**) &slave_trans_retries, 0,
3896
GET_ULONG, REQUIRED_ARG, 10L, 0L, (int64_t) ULONG_MAX, 0, 1, 0},
3897
{"slave-allow-batching", OPT_SLAVE_ALLOW_BATCHING,
3898
"Allow slave to batch requests.",
3899
(char**) &slave_allow_batching, (char**) &slave_allow_batching,
3900
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3901
{"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
3902
"If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
3903
(char**) &slow_launch_time, (char**) &slow_launch_time, 0, GET_ULONG,
3904
REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
1972
3905
{"sort_buffer_size", OPT_SORT_BUFFER,
1973
N_("Each thread that needs to do a sort allocates a buffer of this size."),
3906
"Each thread that needs to do a sort allocates a buffer of this size.",
1974
3907
(char**) &global_system_variables.sortbuff_size,
1975
(char**) &max_system_variables.sortbuff_size, 0, GET_SIZE, REQUIRED_ARG,
1976
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*8, (int64_t)SIZE_MAX,
3908
(char**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
3909
MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ULONG_MAX,
1977
3910
MALLOC_OVERHEAD, 1, 0},
3911
{"sync-binlog", OPT_SYNC_BINLOG,
3912
"Synchronously flush binary log to disk after every #th event. "
3913
"Use 0 (default) to disable synchronous flushing.",
3914
(char**) &sync_binlog_period, (char**) &sync_binlog_period, 0, GET_ULONG,
3915
REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
3916
{"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.",
3917
(char**) &opt_sync_frm, (char**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
3919
{"table_cache", OPT_TABLE_OPEN_CACHE,
3920
"Deprecated; use --table_open_cache instead.",
3921
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG,
3922
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
1978
3923
{"table_definition_cache", OPT_TABLE_DEF_CACHE,
1979
N_("The number of cached table definitions."),
3924
"The number of cached table definitions.",
1980
3925
(char**) &table_def_size, (char**) &table_def_size,
1981
0, GET_SIZE, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
3926
0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
1982
3927
{"table_open_cache", OPT_TABLE_OPEN_CACHE,
1983
N_("The number of cached open tables."),
1984
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_UINT64,
1985
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, TABLE_OPEN_CACHE_MIN, 512*1024L, 0, 1, 0},
3928
"The number of cached open tables.",
3929
(char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG,
3930
REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
1986
3931
{"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT,
1987
N_("Timeout in seconds to wait for a table level lock before returning an "
1988
"error. Used only if the connection has active cursors."),
3932
"Timeout in seconds to wait for a table level lock before returning an "
3933
"error. Used only if the connection has active cursors.",
1989
3934
(char**) &table_lock_wait_timeout, (char**) &table_lock_wait_timeout,
1990
0, GET_ULL, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
3935
0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
3936
{"thread_cache_size", OPT_THREAD_CACHE_SIZE,
3937
"How many threads we should keep in a cache for reuse.",
3938
(char**) &thread_cache_size, (char**) &thread_cache_size, 0, GET_ULONG,
3939
REQUIRED_ARG, 0, 0, 16384, 0, 1, 0},
3940
{"thread_pool_size", OPT_THREAD_CACHE_SIZE,
3941
"How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'",
3942
(char**) &thread_pool_size, (char**) &thread_pool_size, 0, GET_ULONG,
3943
REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
1991
3944
{"thread_stack", OPT_THREAD_STACK,
1992
N_("The stack size for each thread."),
1993
(char**) &my_thread_stack_size,
1994
(char**) &my_thread_stack_size, 0, GET_SIZE,
1995
REQUIRED_ARG,DEFAULT_THREAD_STACK,
1996
UINT32_C(1024*512), (int64_t)SIZE_MAX, 0, 1024, 0},
3945
"The stack size for each thread.", (char**) &my_thread_stack_size,
3946
(char**) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
3947
1024L*128L, ULONG_MAX, 0, 1024, 0},
3948
{ "time_format", OPT_TIME_FORMAT,
3949
"The TIME format (for future).",
3950
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
3951
(char**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
3952
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1997
3953
{"tmp_table_size", OPT_TMP_TABLE_SIZE,
1998
N_("If an internal in-memory temporary table exceeds this size, Drizzle will"
1999
" automatically convert it to an on-disk MyISAM table."),
3954
"If an internal in-memory temporary table exceeds this size, MySQL will"
3955
" automatically convert it to an on-disk MyISAM table.",
2000
3956
(char**) &global_system_variables.tmp_table_size,
2001
3957
(char**) &max_system_variables.tmp_table_size, 0, GET_ULL,
2002
REQUIRED_ARG, 16*1024*1024L, 1024, (int64_t)MAX_MEM_TABLE_SIZE, 0, 1, 0},
3958
REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
3959
{"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
3960
"Allocation block size for transactions to be stored in binary log",
3961
(char**) &global_system_variables.trans_alloc_block_size,
3962
(char**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
3963
REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3964
{"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
3965
"Persistent buffer for transactions to be stored in binary log",
3966
(char**) &global_system_variables.trans_prealloc_size,
3967
(char**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
3968
REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3969
{"wait_timeout", OPT_WAIT_TIMEOUT,
3970
"The number of seconds the server waits for activity on a connection before closing it.",
3971
(char**) &global_system_variables.net_wait_timeout,
3972
(char**) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
3973
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT32_MAX/1000, LONG_TIMEOUT),
2003
3975
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
3978
static int show_net_compression(THD *thd __attribute__((__unused__)),
3980
char *buff __attribute__((__unused__)))
3982
var->type= SHOW_MY_BOOL;
3983
var->value= (char *)&thd->net.compress;
3987
static st_show_var_func_container
3988
show_net_compression_cont= { &show_net_compression };
3990
static int show_starttime(THD *thd, SHOW_VAR *var, char *buff)
3992
var->type= SHOW_LONG;
3994
*((long *)buff)= (long) (thd->query_start() - server_start_time);
3998
static st_show_var_func_container
3999
show_starttime_cont= { &show_starttime };
4001
static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff)
4003
var->type= SHOW_LONG;
4005
*((long *)buff)= (long) (thd->query_start() - flush_status_time);
4009
static st_show_var_func_container
4010
show_flushstatustime_cont= { &show_flushstatustime };
4012
static int show_slave_running(THD *thd __attribute__((__unused__)),
4013
SHOW_VAR *var, char *buff)
4015
var->type= SHOW_MY_BOOL;
4016
pthread_mutex_lock(&LOCK_active_mi);
4018
*((bool *)buff)= (bool) (active_mi && active_mi->slave_running &&
4019
active_mi->rli.slave_running);
4020
pthread_mutex_unlock(&LOCK_active_mi);
4024
static st_show_var_func_container
4025
show_slave_running_cont= { &show_slave_running };
4027
static int show_slave_retried_trans(THD *thd __attribute__((__unused__)),
4028
SHOW_VAR *var, char *buff)
4031
TODO: with multimaster, have one such counter per line in
4032
SHOW SLAVE STATUS, and have the sum over all lines here.
4034
pthread_mutex_lock(&LOCK_active_mi);
4037
var->type= SHOW_LONG;
4039
pthread_mutex_lock(&active_mi->rli.data_lock);
4040
*((long *)buff)= (long)active_mi->rli.retried_trans;
4041
pthread_mutex_unlock(&active_mi->rli.data_lock);
4044
var->type= SHOW_UNDEF;
4045
pthread_mutex_unlock(&LOCK_active_mi);
4049
static st_show_var_func_container
4050
show_slave_retried_trans_cont= { &show_slave_retried_trans };
4052
static int show_slave_received_heartbeats(THD *thd __attribute__((__unused__)),
4053
SHOW_VAR *var, char *buff)
4055
pthread_mutex_lock(&LOCK_active_mi);
4058
var->type= SHOW_LONGLONG;
4060
pthread_mutex_lock(&active_mi->rli.data_lock);
4061
*((int64_t *)buff)= active_mi->received_heartbeats;
4062
pthread_mutex_unlock(&active_mi->rli.data_lock);
4065
var->type= SHOW_UNDEF;
4066
pthread_mutex_unlock(&LOCK_active_mi);
4070
static st_show_var_func_container
4071
show_slave_received_heartbeats_cont= { &show_slave_received_heartbeats };
4073
static int show_heartbeat_period(THD *thd __attribute__((__unused__)),
4074
SHOW_VAR *var, char *buff)
4076
pthread_mutex_lock(&LOCK_active_mi);
4079
var->type= SHOW_CHAR;
4081
my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period));
4084
var->type= SHOW_UNDEF;
4085
pthread_mutex_unlock(&LOCK_active_mi);
4089
static st_show_var_func_container
4090
show_heartbeat_period_cont= { &show_heartbeat_period};
4092
static int show_open_tables(THD *thd __attribute__((__unused__)),
4093
SHOW_VAR *var, char *buff)
4095
var->type= SHOW_LONG;
4097
*((long *)buff)= (long)cached_open_tables();
4101
static int show_table_definitions(THD *thd __attribute__((__unused__)),
4102
SHOW_VAR *var, char *buff)
4104
var->type= SHOW_LONG;
4106
*((long *)buff)= (long)cached_table_definitions();
4110
static st_show_var_func_container
4111
show_open_tables_cont= { &show_open_tables };
4112
static st_show_var_func_container
4113
show_table_definitions_cont= { &show_table_definitions };
4116
Variables shown by SHOW STATUS in alphabetical order
4119
SHOW_VAR status_vars[]= {
4120
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
4121
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
4122
{"Binlog_cache_disk_use", (char*) &binlog_cache_disk_use, SHOW_LONG},
4123
{"Binlog_cache_use", (char*) &binlog_cache_use, SHOW_LONG},
4124
{"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS},
4125
{"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
4126
{"Com", (char*) com_status_vars, SHOW_ARRAY},
4127
{"Compression", (char*) &show_net_compression_cont, SHOW_FUNC},
4128
{"Connections", (char*) &thread_id, SHOW_LONG_NOFLUSH},
4129
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS},
4130
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG},
4131
{"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables), SHOW_LONG_STATUS},
4132
{"Flush_commands", (char*) &refresh_version, SHOW_LONG_NOFLUSH},
4133
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},
4134
{"Handler_delete", (char*) offsetof(STATUS_VAR, ha_delete_count), SHOW_LONG_STATUS},
4135
{"Handler_discover", (char*) offsetof(STATUS_VAR, ha_discover_count), SHOW_LONG_STATUS},
4136
{"Handler_prepare", (char*) offsetof(STATUS_VAR, ha_prepare_count), SHOW_LONG_STATUS},
4137
{"Handler_read_first", (char*) offsetof(STATUS_VAR, ha_read_first_count), SHOW_LONG_STATUS},
4138
{"Handler_read_key", (char*) offsetof(STATUS_VAR, ha_read_key_count), SHOW_LONG_STATUS},
4139
{"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS},
4140
{"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS},
4141
{"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS},
4142
{"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR, ha_read_rnd_next_count), SHOW_LONG_STATUS},
4143
{"Handler_rollback", (char*) offsetof(STATUS_VAR, ha_rollback_count), SHOW_LONG_STATUS},
4144
{"Handler_savepoint", (char*) offsetof(STATUS_VAR, ha_savepoint_count), SHOW_LONG_STATUS},
4145
{"Handler_savepoint_rollback",(char*) offsetof(STATUS_VAR, ha_savepoint_rollback_count), SHOW_LONG_STATUS},
4146
{"Handler_update", (char*) offsetof(STATUS_VAR, ha_update_count), SHOW_LONG_STATUS},
4147
{"Handler_write", (char*) offsetof(STATUS_VAR, ha_write_count), SHOW_LONG_STATUS},
4148
{"Key_blocks_not_flushed", (char*) offsetof(KEY_CACHE, global_blocks_changed), SHOW_KEY_CACHE_LONG},
4149
{"Key_blocks_unused", (char*) offsetof(KEY_CACHE, blocks_unused), SHOW_KEY_CACHE_LONG},
4150
{"Key_blocks_used", (char*) offsetof(KEY_CACHE, blocks_used), SHOW_KEY_CACHE_LONG},
4151
{"Key_read_requests", (char*) offsetof(KEY_CACHE, global_cache_r_requests), SHOW_KEY_CACHE_LONGLONG},
4152
{"Key_reads", (char*) offsetof(KEY_CACHE, global_cache_read), SHOW_KEY_CACHE_LONGLONG},
4153
{"Key_write_requests", (char*) offsetof(KEY_CACHE, global_cache_w_requests), SHOW_KEY_CACHE_LONGLONG},
4154
{"Key_writes", (char*) offsetof(KEY_CACHE, global_cache_write), SHOW_KEY_CACHE_LONGLONG},
4155
{"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS},
4156
{"Max_used_connections", (char*) &max_used_connections, SHOW_LONG},
4157
{"Open_files", (char*) &my_file_opened, SHOW_LONG_NOFLUSH},
4158
{"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH},
4159
{"Open_table_definitions", (char*) &show_table_definitions_cont, SHOW_FUNC},
4160
{"Open_tables", (char*) &show_open_tables_cont, SHOW_FUNC},
4161
{"Opened_files", (char*) &my_file_total_opened, SHOW_LONG_NOFLUSH},
4162
{"Opened_tables", (char*) offsetof(STATUS_VAR, opened_tables), SHOW_LONG_STATUS},
4163
{"Opened_table_definitions", (char*) offsetof(STATUS_VAR, opened_shares), SHOW_LONG_STATUS},
4164
{"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS},
4165
{"Select_full_join", (char*) offsetof(STATUS_VAR, select_full_join_count), SHOW_LONG_STATUS},
4166
{"Select_full_range_join", (char*) offsetof(STATUS_VAR, select_full_range_join_count), SHOW_LONG_STATUS},
4167
{"Select_range", (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
4168
{"Select_range_check", (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
4169
{"Select_scan", (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
4170
{"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG},
4171
{"Slave_retried_transactions",(char*) &show_slave_retried_trans_cont, SHOW_FUNC},
4172
{"Slave_heartbeat_period", (char*) &show_heartbeat_period_cont, SHOW_FUNC},
4173
{"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats_cont, SHOW_FUNC},
4174
{"Slave_running", (char*) &show_slave_running_cont, SHOW_FUNC},
4175
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
4176
{"Slow_queries", (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
4177
{"Sort_merge_passes", (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
4178
{"Sort_range", (char*) offsetof(STATUS_VAR, filesort_range_count), SHOW_LONG_STATUS},
4179
{"Sort_rows", (char*) offsetof(STATUS_VAR, filesort_rows), SHOW_LONG_STATUS},
4180
{"Sort_scan", (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
4181
{"Table_locks_immediate", (char*) &locks_immediate, SHOW_LONG},
4182
{"Table_locks_waited", (char*) &locks_waited, SHOW_LONG},
4184
{"Tc_log_max_pages_used", (char*) &tc_log_max_pages_used, SHOW_LONG},
4185
{"Tc_log_page_size", (char*) &tc_log_page_size, SHOW_LONG},
4186
{"Tc_log_page_waits", (char*) &tc_log_page_waits, SHOW_LONG},
4188
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_NOFLUSH},
4189
{"Threads_connected", (char*) &connection_count, SHOW_INT},
4190
{"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH},
4191
{"Threads_running", (char*) &thread_running, SHOW_INT},
4192
{"Uptime", (char*) &show_starttime_cont, SHOW_FUNC},
4193
{"Uptime_since_flush_status",(char*) &show_flushstatustime_cont, SHOW_FUNC},
4194
{NullS, NullS, SHOW_LONG}
2006
4197
static void print_version(void)
4199
set_server_version();
2009
4201
Note: the instance manager keys off the string 'Ver' so it can find the
2010
version from the output of 'drizzled --version', so don't change it!
4202
version from the output of 'mysqld --version', so don't change it!
2012
printf("%s Ver %s for %s-%s on %s (%s)\n",internal::my_progname,
2013
PANDORA_RELEASE_VERSION, HOST_VENDOR, HOST_OS, HOST_CPU,
2014
COMPILATION_COMMENT);
4204
printf("%s Ver %s for %s on %s (%s)\n",my_progname,
4205
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
2017
4208
static void usage(void)
2019
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, MY_CS_PRIMARY)))
4210
if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
2021
4214
if (!default_collation_name)
2022
4215
default_collation_name= (char*) default_charset_info->name;
2023
4216
print_version();
2024
puts(_("Copyright (C) 2008 Sun Microsystems\n"
2025
"This software comes with ABSOLUTELY NO WARRANTY. "
2026
"This is free software,\n"
2027
"and you are welcome to modify and redistribute it under the GPL "
2031
printf(_("Usage: %s [OPTIONS]\n"), internal::my_progname);
2033
po::options_description all_options("Drizzled Options");
2034
all_options.add(config_options);
2035
all_options.add(plugin_load_options);
2036
all_options.add(long_options);
2037
all_options.add(plugin_options);
2038
cout << all_options << endl;
4218
Copyright (C) 2000 MySQL AB, by Monty and others\n\
4219
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
4220
and you are welcome to modify and redistribute it under the GPL license\n\n\
4221
Starts the MySQL database server\n");
4223
printf("Usage: %s [OPTIONS]\n", my_progname);
4225
puts("\nFor more help options (several pages), use mysqld --verbose --help");
4228
print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
4232
/* Print out all the options including plugin supplied options */
4233
my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option));
4236
To see what values a running MySQL server is using, type\n\
4237
'mysqladmin variables' instead of 'mysqld --verbose --help'.");
2043
Initialize all Drizzle global variables to default values.
4243
Initialize all MySQL global variables to default values.
2045
4245
We don't need to set numeric variables refered to in my_long_options
2046
4246
as these are initialized by my_getopt.
2055
4255
as these are initialized by my_getopt.
2058
static void drizzle_init_variables(void)
4258
static void mysql_init_variables(void)
2060
4260
/* Things reset to zero */
4261
opt_skip_slave_start= opt_reckless_slave = 0;
4262
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
4263
opt_log= opt_slow_log= 0;
4264
log_output_options= find_bit_type(log_output_str, &log_output_typelib);
4266
opt_disable_networking= opt_skip_show_db=0;
4267
opt_logname= opt_binlog_index_name= opt_slow_logname= 0;
2061
4268
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
4270
opt_secure_file_priv= 0;
4271
opt_bootstrap= opt_myisam_log= 0;
4273
segfaulted= kill_in_progress= 0;
2062
4274
cleanup_done= 0;
2063
dropping_tables= ha_open_options=0;
2066
abort_loop= select_thread_in_use= false;
2067
shutdown_in_progress= 0;
2068
drizzled_user= drizzled_chroot= 0;
2069
memset(¤t_global_counters, 0, sizeof(current_global_counters));
4277
server_id_supplied= 0;
4278
test_flags= select_errors= dropping_tables= ha_open_options=0;
4279
thread_count= thread_running= kill_cached_threads= wake_thread=0;
4280
slave_open_temp_tables= 0;
4281
cached_thread_count= 0;
4282
opt_endinfo= using_udf_functions= 0;
4283
opt_using_transactions= using_update_log= 0;
4284
abort_loop= select_thread_in_use= signal_thread_in_use= 0;
4285
ready_to_exit= shutdown_in_progress= 0;
4286
aborted_threads= aborted_connects= 0;
4288
binlog_cache_use= binlog_cache_disk_use= 0;
4289
max_used_connections= slow_launch_threads = 0;
4290
mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0;
4292
opt_mysql_tmpdir= my_bind_addr_str= NullS;
4293
bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
4294
bzero((char *) &global_status_var, sizeof(global_status_var));
4295
key_map_full.set_all();
2072
4297
/* Character sets */
2073
4298
system_charset_info= &my_charset_utf8_general_ci;
2074
4299
files_charset_info= &my_charset_utf8_general_ci;
4300
national_charset_info= &my_charset_utf8_general_ci;
2075
4301
table_alias_charset= &my_charset_bin;
2076
4302
character_set_filesystem= &my_charset_bin;
4304
opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
2078
4306
/* Things with default values that are not zero */
2079
session_startup_options= (OPTION_AUTO_IS_NULL | OPTION_SQL_NOTES);
4307
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
4308
slave_exec_mode_options= 0;
4309
slave_exec_mode_options= (uint)
4310
find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL);
4311
opt_specialflag= SPECIAL_ENGLISH;
4312
ip_sock= INVALID_SOCKET;
4313
mysql_home_ptr= mysql_home;
4314
pidfile_name_ptr= pidfile_name;
4315
log_error_file_ptr= log_error_file;
4316
language_ptr= language;
4317
mysql_data_home= mysql_real_data_home;
4318
thd_startup_options= (OPTION_AUTO_IS_NULL | OPTION_BIN_LOG |
4319
OPTION_QUOTE_SHOW_CREATE | OPTION_SQL_NOTES);
4320
protocol_version= PROTOCOL_VERSION;
4321
what_to_log= ~ (1L << (uint) COM_TIME);
2080
4322
refresh_version= 1L; /* Increments on each reload */
2081
global_thread_id= 1UL;
2082
session::Cache::singleton().getCache().clear();
4323
global_query_id= thread_id= 1L;
4324
strmov(server_version, MYSQL_SERVER_VERSION);
4325
myisam_recover_options_str= "OFF";
4326
myisam_stats_method_str= "nulls_unequal";
4328
thread_cache.empty();
4330
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
4331
default_key_cache_base.length)))
4333
/* set key_cache_hash.default_value = dflt_key_cache */
4334
multi_keycache_init();
4336
/* Set directory paths */
4337
strmake(language, LANGUAGE, sizeof(language)-1);
4338
strmake(mysql_real_data_home, get_relative_path(DATADIR),
4339
sizeof(mysql_real_data_home)-1);
4340
mysql_data_home_buff[0]=FN_CURLIB; // all paths are relative from here
4341
mysql_data_home_buff[1]=0;
4342
mysql_data_home_len= 2;
4344
/* Replication parameters */
4345
master_info_file= (char*) "master.info",
4346
relay_log_info_file= (char*) "relay-log.info";
4347
report_user= report_password = report_host= 0; /* TO BE DELETED */
4348
opt_relay_logname= opt_relaylog_index_name= 0;
2084
4350
/* Variables in libraries */
2085
default_character_set_name= "utf8";
2086
default_collation_name= (char *)compiled_default_collation_name;
2087
character_set_filesystem_name= "binary";
4352
default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
4353
default_collation_name= compiled_default_collation_name;
4354
sys_charset_system.set((char*) system_charset_info->csname);
4355
character_set_filesystem_name= (char*) "binary";
2088
4356
lc_time_names_name= (char*) "en_US";
2089
4357
/* Set default values for some option variables */
2090
default_storage_engine_str= (char*) "innodb";
2091
global_system_variables.storage_engine= NULL;
4358
default_storage_engine_str= (char*) "MyISAM";
4359
global_system_variables.table_plugin= NULL;
2092
4360
global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
2093
4361
global_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
2094
4362
max_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
2095
4363
global_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
2096
4364
max_system_variables.max_join_size= (uint64_t) HA_POS_ERROR;
2097
max_system_variables.auto_increment_increment= UINT64_MAX;
2098
max_system_variables.auto_increment_offset= UINT64_MAX;
2099
max_system_variables.completion_type= 2;
2100
max_system_variables.log_warnings= true;
2101
max_system_variables.bulk_insert_buff_size= ULONG_MAX;
2102
max_system_variables.div_precincrement= DECIMAL_MAX_SCALE;
2103
max_system_variables.group_concat_max_len= ULONG_MAX;
2104
max_system_variables.join_buff_size= ULONG_MAX;
2105
max_system_variables.max_allowed_packet= 1024L*1024L*1024L;
2106
max_system_variables.max_error_count= 65535;
2107
max_system_variables.max_heap_table_size= MAX_MEM_TABLE_SIZE;
2108
max_system_variables.max_join_size= INT32_MAX;
2109
max_system_variables.max_length_for_sort_data= 8192*1024L;
2110
max_system_variables.max_seeks_for_key= ULONG_MAX;
2111
max_system_variables.max_sort_length= 8192*1024L;
2112
max_system_variables.min_examined_row_limit= ULONG_MAX;
2113
max_system_variables.optimizer_prune_level= 1;
2114
max_system_variables.optimizer_search_depth= MAX_TABLES+2;
2115
max_system_variables.preload_buff_size= 1024*1024*1024L;
2116
max_system_variables.query_alloc_block_size= UINT32_MAX;
2117
max_system_variables.query_prealloc_size= UINT32_MAX;
2118
max_system_variables.range_alloc_block_size= SIZE_MAX;
2119
max_system_variables.read_buff_size= INT32_MAX;
2120
max_system_variables.read_rnd_buff_size= UINT32_MAX;
2121
max_system_variables.sortbuff_size= SIZE_MAX;
2122
max_system_variables.tmp_table_size= MAX_MEM_TABLE_SIZE;
2124
opt_scheduler_default= (char*) "multi_thread";
4365
global_system_variables.old_alter_table= 0;
4366
global_system_variables.binlog_format= BINLOG_FORMAT_UNSPEC;
4368
Default behavior for 4.1 and 5.0 is to treat NULL values as unequal
4369
when collecting index statistics for MyISAM tables.
4371
global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
2126
4373
/* Variables that depends on compile options */
4374
opt_error_log= IF_WIN(1,0);
2127
4375
#ifdef HAVE_BROKEN_REALPATH
2128
4376
have_symlink=SHOW_OPTION_NO;
2130
4378
have_symlink=SHOW_OPTION_YES;
4381
have_dlopen=SHOW_OPTION_YES;
4383
have_dlopen=SHOW_OPTION_NO;
4386
have_crypt=SHOW_OPTION_YES;
4388
have_crypt=SHOW_OPTION_NO;
4390
#ifdef HAVE_COMPRESS
4391
have_compress= SHOW_OPTION_YES;
4393
have_compress= SHOW_OPTION_NO;
4397
if (!(tmpenv = getenv("MY_BASEDIR_VERSION")))
4398
tmpenv = DEFAULT_MYSQL_HOME;
4399
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
2137
- FIXME add EXIT_TOO_MANY_ARGUMENTS to "drizzled/error.h" and return that code?
2139
static void get_options()
4404
mysqld_get_one_option(int optid,
4405
const struct my_option *opt __attribute__((unused)),
2142
fs::path &data_home_catalog= getDataHomeCatalog();
2143
data_home_catalog= getDataHome();
2144
data_home_catalog /= "local";
2146
if (vm.count("user"))
2148
if (! drizzled_user || ! strcmp(drizzled_user, vm["user"].as<string>().c_str()))
2149
drizzled_user= (char *)vm["user"].as<string>().c_str();
4410
opt_endinfo=1; /* unireg: memory allocation */
4413
global_system_variables.tx_isolation= ISO_SERIALIZABLE;
4416
strmake(mysql_home,argument,sizeof(mysql_home)-1);
4419
if (default_collation_name == compiled_default_collation_name)
4420
default_collation_name= 0;
4426
strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1);
4427
/* Correct pointer set by my_getopt (for embedded library) */
4428
mysql_data_home= mysql_real_data_home;
4429
mysql_data_home_len= strlen(mysql_data_home);
4432
if (!mysqld_user || !strcmp(mysqld_user, argument))
4433
mysqld_user= argument;
2152
errmsg_printf(error::WARN, _("Ignoring user change to '%s' because the user was "
2153
"set to '%s' earlier on the command line\n"),
2154
vm["user"].as<string>().c_str(), drizzled_user);
2157
if (vm.count("version"))
4435
sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user);
4438
strmake(language, argument, sizeof(language)-1);
4440
case OPT_SLAVE_SKIP_ERRORS:
4441
init_slave_skip_errors(argument);
4443
case OPT_SLAVE_EXEC_MODE:
4444
slave_exec_mode_options= (uint)
4445
find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "");
2159
4448
print_version();
2163
if (vm.count("sort-heap-threshold"))
2165
if ((vm["sort-heap-threshold"].as<uint64_t>() > 0) and
2166
(vm["sort-heap-threshold"].as<uint64_t>() <
2167
global_system_variables.sortbuff_size))
2169
cout << _("Error: sort-heap-threshold cannot be less than sort-buffer-size") << endl;
2173
global_sort_buffer.setMaxSize(vm["sort-heap-threshold"].as<uint64_t>());
2176
if (vm.count("join-heap-threshold"))
2178
if ((vm["join-heap-threshold"].as<uint64_t>() > 0) and
2179
(vm["join-heap-threshold"].as<uint64_t>() <
2180
global_system_variables.join_buff_size))
2182
cout << _("Error: join-heap-threshold cannot be less than join-buffer-size") << endl;
2186
global_join_buffer.setMaxSize(vm["join-heap-threshold"].as<uint64_t>());
2189
if (vm.count("read-rnd-threshold"))
2191
if ((vm["read-rnd-threshold"].as<uint64_t>() > 0) and
2192
(vm["read-rnd-threshold"].as<uint64_t>() <
2193
global_system_variables.read_rnd_buff_size))
2195
cout << _("Error: read-rnd-threshold cannot be less than read-rnd-buffer-size") << endl;
2199
global_read_rnd_buffer.setMaxSize(vm["read-rnd-threshold"].as<uint64_t>());
2202
if (vm.count("read-buffer-threshold"))
2204
if ((vm["read-buffer-threshold"].as<uint64_t>() > 0) and
2205
(vm["read-buffer-threshold"].as<uint64_t>() <
2206
global_system_variables.read_buff_size))
2208
cout << _("Error: read-buffer-threshold cannot be less than read-buffer-size") << endl;
2212
global_read_buffer.setMaxSize(vm["read-buffer-threshold"].as<uint64_t>());
2215
if (vm.count("exit-info"))
2217
if (vm["exit-info"].as<long>())
2219
getDebug().set((uint32_t) vm["exit-info"].as<long>());
2223
if (vm.count("want-core"))
2225
getDebug().set(debug::CORE_ON_SIGNAL);
2228
if (vm.count("skip-stack-trace"))
2230
getDebug().set(debug::NO_STACKTRACE);
2233
if (vm.count("skip-symlinks"))
2235
internal::my_use_symdir=0;
2238
if (vm.count("transaction-isolation"))
2240
int type= tx_isolation_typelib.find_type_or_exit(vm["transaction-isolation"].as<string>().c_str(), "transaction-isolation");
2241
global_system_variables.tx_isolation= type - 1;
2244
/* @TODO Make this all strings */
2245
if (vm.count("default-storage-engine"))
2247
default_storage_engine_str= (char *)vm["default-storage-engine"].as<string>().c_str();
4452
global_system_variables.log_warnings++;
4453
else if (argument == disabled_my_option)
4454
global_system_variables.log_warnings= 0L;
4456
global_system_variables.log_warnings= atoi(argument);
4459
test_flags= argument ? (uint) atoi(argument) : 0;
4462
case (int) OPT_BIG_TABLES:
4463
thd_startup_options|=OPTION_BIG_TABLES;
4465
case (int) OPT_ISAM_LOG:
4468
case (int) OPT_BIN_LOG:
4469
opt_bin_log= test(argument != disabled_my_option);
4471
case (int) OPT_ERROR_LOG_FILE:
4474
case (int)OPT_REPLICATE_IGNORE_DB:
4476
rpl_filter->add_ignore_db(argument);
4479
case (int)OPT_REPLICATE_DO_DB:
4481
rpl_filter->add_do_db(argument);
4484
case (int)OPT_REPLICATE_REWRITE_DB:
4486
char* key = argument,*p, *val;
4488
if (!(p= strstr(argument, "->")))
4491
"Bad syntax in replicate-rewrite-db - missing '->'!\n");
4495
while (my_isspace(mysqld_charset, *p) && p > argument)
4500
"Bad syntax in replicate-rewrite-db - empty FROM db!\n");
4505
while (*val && my_isspace(mysqld_charset, *val))
4510
"Bad syntax in replicate-rewrite-db - empty TO db!\n");
4514
rpl_filter->add_db_rewrite(key, val);
4518
case (int)OPT_BINLOG_IGNORE_DB:
4520
binlog_filter->add_ignore_db(argument);
4523
case OPT_BINLOG_FORMAT:
4526
id= find_type_or_exit(argument, &binlog_format_typelib, opt->name);
4527
global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
4530
case (int)OPT_BINLOG_DO_DB:
4532
binlog_filter->add_do_db(argument);
4535
case (int)OPT_REPLICATE_DO_TABLE:
4537
if (rpl_filter->add_do_table(argument))
4539
fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
4544
case (int)OPT_REPLICATE_WILD_DO_TABLE:
4546
if (rpl_filter->add_wild_do_table(argument))
4548
fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
4553
case (int)OPT_REPLICATE_WILD_IGNORE_TABLE:
4555
if (rpl_filter->add_wild_ignore_table(argument))
4557
fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
4562
case (int)OPT_REPLICATE_IGNORE_TABLE:
4564
if (rpl_filter->add_ignore_table(argument))
4566
fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
4571
case (int) OPT_SLOW_QUERY_LOG:
4574
#ifdef WITH_CSV_STORAGE_ENGINE
4575
case OPT_LOG_OUTPUT:
4577
if (!argument || !argument[0])
4579
log_output_options= LOG_FILE;
4580
log_output_str= log_output_typelib.type_names[1];
4584
log_output_str= argument;
4586
find_bit_type_or_exit(argument, &log_output_typelib, opt->name);
4591
case (int) OPT_SKIP_NEW:
4592
opt_specialflag|= SPECIAL_NO_NEW_FUNC;
4593
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
4594
myisam_concurrent_insert=0;
4595
myisam_recover_options= HA_RECOVER_NONE;
4597
ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE);
4599
case (int) OPT_SAFE:
4600
opt_specialflag|= SPECIAL_SAFE_MODE;
4601
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
4602
myisam_recover_options= HA_RECOVER_DEFAULT;
4603
ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE);
4605
case (int) OPT_SKIP_PRIOR:
4606
opt_specialflag|= SPECIAL_NO_PRIOR;
4608
case (int) OPT_SKIP_SHOW_DB:
4610
opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
4612
case (int) OPT_WANT_CORE:
4613
test_flags |= TEST_CORE_ON_SIGNAL;
4615
case (int) OPT_SKIP_STACK_TRACE:
4616
test_flags|=TEST_NO_STACKTRACE;
4618
case (int) OPT_SKIP_SYMLINKS:
4621
case (int) OPT_BIND_ADDRESS:
4623
struct addrinfo *res_lst, hints;
4625
bzero(&hints, sizeof(struct addrinfo));
4626
hints.ai_socktype= SOCK_STREAM;
4627
hints.ai_protocol= IPPROTO_TCP;
4629
if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0)
4631
sql_print_error("Can't start server: cannot resolve hostname!");
4635
if (res_lst->ai_next)
4637
sql_print_error("Can't start server: bind-address refers to multiple interfaces!");
4640
freeaddrinfo(res_lst);
4643
case (int) OPT_PID_FILE:
4644
strmake(pidfile_name, argument, sizeof(pidfile_name)-1);
4648
opt_error_log= 0; // Force logs to stdout
4650
case OPT_LOW_PRIORITY_UPDATES:
4651
thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY;
4652
global_system_variables.low_priority_updates=1;
4655
opt_noacl=opt_bootstrap=1;
4658
server_id_supplied = 1;
4660
case OPT_DELAY_KEY_WRITE_ALL:
4661
if (argument != disabled_my_option)
4662
argument= (char*) "ALL";
4664
case OPT_DELAY_KEY_WRITE:
4665
if (argument == disabled_my_option)
4666
delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
4667
else if (! argument)
4668
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
4672
type= find_type_or_exit(argument, &delay_key_write_typelib, opt->name);
4673
delay_key_write_options= (uint) type-1;
4676
case OPT_CHARSETS_DIR:
4677
strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1);
4678
charsets_dir = mysql_charsets_dir;
4680
case OPT_TX_ISOLATION:
4683
type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name);
4684
global_system_variables.tx_isolation= (type-1);
4687
case OPT_MYISAM_RECOVER:
4691
myisam_recover_options= HA_RECOVER_DEFAULT;
4692
myisam_recover_options_str= myisam_recover_typelib.type_names[0];
4694
else if (!argument[0])
4696
myisam_recover_options= HA_RECOVER_NONE;
4697
myisam_recover_options_str= "OFF";
4701
myisam_recover_options_str=argument;
4702
myisam_recover_options=
4703
find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name);
4705
ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
4708
case OPT_TC_HEURISTIC_RECOVER:
4709
tc_heuristic_recover= find_type_or_exit(argument,
4710
&tc_heuristic_recover_typelib,
4713
case OPT_MYISAM_STATS_METHOD:
4718
myisam_stats_method_str= argument;
4719
method= find_type_or_exit(argument, &myisam_stats_method_typelib,
4723
method_conv= MI_STATS_METHOD_IGNORE_NULLS;
4726
method_conv= MI_STATS_METHOD_NULLS_EQUAL;
4730
method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL;
4733
global_system_variables.myisam_stats_method= method_conv;
4736
case OPT_LOWER_CASE_TABLE_NAMES:
4737
lower_case_table_names= argument ? atoi(argument) : 1;
4738
lower_case_table_names_used= 1;
4745
/** Handle arguments for multiple key caches. */
4747
extern "C" char **mysql_getopt_value(const char *keyname, uint key_length,
4748
const struct my_option *option);
4751
mysql_getopt_value(const char *keyname, uint key_length,
4752
const struct my_option *option)
4754
switch (option->id) {
4755
case OPT_KEY_BUFFER_SIZE:
4756
case OPT_KEY_CACHE_BLOCK_SIZE:
4757
case OPT_KEY_CACHE_DIVISION_LIMIT:
4758
case OPT_KEY_CACHE_AGE_THRESHOLD:
4760
KEY_CACHE *key_cache;
4761
if (!(key_cache= get_or_create_key_cache(keyname, key_length)))
4763
switch (option->id) {
4764
case OPT_KEY_BUFFER_SIZE:
4765
return (char**) &key_cache->param_buff_size;
4766
case OPT_KEY_CACHE_BLOCK_SIZE:
4767
return (char**) &key_cache->param_block_size;
4768
case OPT_KEY_CACHE_DIVISION_LIMIT:
4769
return (char**) &key_cache->param_division_limit;
4770
case OPT_KEY_CACHE_AGE_THRESHOLD:
4771
return (char**) &key_cache->param_age_threshold;
4775
return (char **)option->value;
4779
extern "C" void option_error_reporter(enum loglevel level, const char *format, ...);
4781
void option_error_reporter(enum loglevel level, const char *format, ...)
4784
va_start(args, format);
4786
/* Don't print warnings for --loose options during bootstrap */
4787
if (level == ERROR_LEVEL || !opt_bootstrap ||
4788
global_system_variables.log_warnings)
4790
vprint_msg_to_log(level, format, args);
4798
- FIXME add EXIT_TOO_MANY_ARGUMENTS to "mysys_err.h" and return that code?
4800
static void get_options(int *argc,char **argv)
4804
my_getopt_register_get_addr(mysql_getopt_value);
4805
my_getopt_error_reporter= option_error_reporter;
2250
4807
/* Skip unknown options so that they may be processed later by plugins */
2251
4808
my_getopt_skip_unknown= true;
4810
if ((ho_error= handle_options(argc, &argv, my_long_options,
4811
mysqld_get_one_option)))
4813
(*argc)++; /* add back one for the progname handle_options removes */
4814
/* no need to do this for argv as we are discarding it. */
4816
if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes ||
4817
opt_log_slow_slave_statements) &&
4819
sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log-slow-queries is not set");
2254
4821
#if defined(HAVE_BROKEN_REALPATH)
2255
internal::my_use_symdir=0;
2256
internal::my_disable_symlinks=1;
4823
my_disable_symlinks=1;
2257
4824
have_symlink=SHOW_OPTION_NO;
2259
if (!internal::my_use_symdir)
2261
internal::my_disable_symlinks=1;
4828
my_disable_symlinks=1;
2262
4829
have_symlink=SHOW_OPTION_DISABLED;
2265
4832
if (opt_debugging)
2267
4834
/* Allow break with SIGINT, no core or stack trace */
2268
getDebug().set(debug::ALLOW_SIGINT);
2269
getDebug().set(debug::NO_STACKTRACE);
2270
getDebug().reset(debug::CORE_ON_SIGNAL);
4835
test_flags|= TEST_SIGINT | TEST_NO_STACKTRACE;
4836
test_flags&= ~TEST_CORE_ON_SIGNAL;
4838
/* Set global MyISAM variables from delay_key_write_options */
4839
fix_delay_key_write((THD*) 0, OPT_GLOBAL);
4840
/* Set global slave_exec_mode from its option */
4841
fix_slave_exec_mode(OPT_GLOBAL);
2273
if (drizzled_chroot)
2274
set_root(drizzled_chroot);
4844
set_root(mysqld_chroot);
2277
4848
Set some global variables from the global_system_variables
2278
4849
In most cases the global variables will not be used
2280
internal::my_default_record_cache_size=global_system_variables.read_buff_size;
2284
static void fix_paths()
2286
fs::path pid_file_path(pid_file);
2287
if (pid_file_path.root_path().string() == "")
2289
pid_file_path= getDataHome();
2290
pid_file_path /= pid_file;
2292
pid_file= fs::system_complete(pid_file_path);
2296
const char *tmp_string= getenv("TMPDIR") ? getenv("TMPDIR") : NULL;
2298
drizzle_tmpdir.clear();
2300
if (vm.count("tmpdir"))
2302
drizzle_tmpdir.append(vm["tmpdir"].as<string>());
2304
else if (tmp_string == NULL)
2306
drizzle_tmpdir.append(getDataHome().file_string());
2307
drizzle_tmpdir.push_back(FN_LIBCHAR);
2308
drizzle_tmpdir.append(GLOBAL_TEMPORARY_EXT);
4851
my_default_record_cache_size=global_system_variables.read_buff_size;
4852
myisam_max_temp_length=
4853
(my_off_t) global_system_variables.myisam_max_sort_file_size;
4855
/* Set global variables based on startup options */
4856
myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
4858
/* long_query_time is in microseconds */
4859
global_system_variables.long_query_time= max_system_variables.long_query_time=
4860
(int64_t) (long_query_time * 1000000.0);
4862
if (opt_short_log_format)
4863
opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
4865
if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE,
4866
&global_system_variables.date_format) ||
4867
init_global_datetime_format(MYSQL_TIMESTAMP_TIME,
4868
&global_system_variables.time_format) ||
4869
init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME,
4870
&global_system_variables.datetime_format))
4873
pool_of_threads_scheduler(&thread_scheduler); /* purecov: tested */
4878
Create version name for running mysqld version
4879
We automaticly add suffixes -debug, -embedded and -log to the version
4880
name to make the version more descriptive.
4881
(MYSQL_SERVER_SUFFIX is set by the compilation environment)
4884
static void set_server_version(void)
4886
char *end= strxmov(server_version, MYSQL_SERVER_VERSION,
4887
MYSQL_SERVER_SUFFIX_STR, NullS);
4888
if (opt_log || opt_slow_log || opt_bin_log)
4889
strmov(end, "-log"); // This may slow down system
4893
static char *get_relative_path(const char *path)
4895
if (test_if_hard_path(path) &&
4896
is_prefix(path,DEFAULT_MYSQL_HOME) &&
4897
strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR))
4899
path+=(uint) strlen(DEFAULT_MYSQL_HOME);
4900
while (*path == FN_LIBCHAR)
4903
return (char*) path;
4908
Fix filename and replace extension where 'dir' is relative to
4909
mysql_real_data_home.
4911
1 if len(path) > FN_REFLEN
4915
fn_format_relative_to_data_home(char * to, const char *name,
4916
const char *dir, const char *extension)
4918
char tmp_path[FN_REFLEN];
4919
if (!test_if_hard_path(dir))
4921
strxnmov(tmp_path,sizeof(tmp_path)-1, mysql_real_data_home,
4925
return !fn_format(to, name, dir, extension,
4926
MY_APPEND_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH);
4930
static void fix_paths(void)
4932
char buff[FN_REFLEN],*pos;
4933
convert_dirname(mysql_home,mysql_home,NullS);
4934
/* Resolve symlinks to allow 'mysql_home' to be a relative symlink */
4935
my_realpath(mysql_home,mysql_home,MYF(0));
4936
/* Ensure that mysql_home ends in FN_LIBCHAR */
4937
pos=strend(mysql_home);
4938
if (pos[-1] != FN_LIBCHAR)
4943
convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS);
4944
(void) fn_format(buff, mysql_real_data_home, "", "",
4945
(MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
4946
(void) unpack_dirname(mysql_unpacked_real_data_home, buff);
4947
convert_dirname(language,language,NullS);
4948
(void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
4949
(void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
4950
(void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
4951
(void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr :
4952
get_relative_path(PLUGINDIR), mysql_home);
4953
opt_plugin_dir_ptr= opt_plugin_dir;
4955
char *sharedir=get_relative_path(SHAREDIR);
4956
if (test_if_hard_path(sharedir))
4957
strmake(buff,sharedir,sizeof(buff)-1); /* purecov: tested */
4959
strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS);
4960
convert_dirname(buff,buff,NullS);
4961
(void) my_load_path(language,language,buff);
4963
/* If --character-sets-dir isn't given, use shared library dir */
4964
if (charsets_dir != mysql_charsets_dir)
4966
strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff,
4967
CHARSET_DIR, NullS);
4969
(void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff);
4970
convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NullS);
4971
charsets_dir=mysql_charsets_dir;
4973
if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
4975
if (!slave_load_tmpdir)
4977
if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
4981
Convert the secure-file-priv option to system format, allowing
4982
a quick strcmp to check if read or write is in an allowed dir
4984
if (opt_secure_file_priv)
4986
convert_dirname(buff, opt_secure_file_priv, NullS);
4987
my_free(opt_secure_file_priv, MYF(0));
4988
opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
4993
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
5000
if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0)
5002
ptr= bit_lib->type_names;
5004
fprintf(stderr, "No option given to %s\n", option);
2312
drizzle_tmpdir.append(tmp_string);
2315
drizzle_tmpdir= fs::path(fs::system_complete(fs::path(drizzle_tmpdir))).file_string();
2316
assert(drizzle_tmpdir.size());
2318
if (mkdir(drizzle_tmpdir.c_str(), 0777) == -1)
2320
if (errno != EEXIST)
2322
errmsg_printf(error::ERROR, _("There was an error creating the '%s' part of the path '%s'. Please check the path exists and is writable.\n"), fs::path(drizzle_tmpdir).leaf().c_str(), drizzle_tmpdir.c_str());
2327
if (stat(drizzle_tmpdir.c_str(), &buf) || (S_ISDIR(buf.st_mode) == false))
2329
errmsg_printf(error::ERROR, _("There was an error opening the path '%s', please check the path exists and is writable.\n"), drizzle_tmpdir.c_str());
2336
} /* namespace drizzled */
5006
fprintf(stderr, "Wrong option to %s. Option(s) given: %s\n", option, x);
5007
fprintf(stderr, "Alternatives are: '%s'", *ptr);
5009
fprintf(stderr, ",'%s'", *ptr);
5010
fprintf(stderr, "\n");
5019
a bitfield from a string of substrings separated by ','
5021
~(ulong) 0 on error.
5024
static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
5028
const char *end,*i,*j;
5029
const char **array, *pos;
5030
ulong found,found_int,bit;
5035
while (*pos == ' ') pos++;
5036
found_end= *pos == 0;
5039
if (!*(end=strcend(pos,','))) /* Let end point at fieldend */
5041
while (end > pos && end[-1] == ' ')
5042
end--; /* Skip end-space */
5045
found_int=0; found_count=0;
5046
for (array=bit_lib->type_names, bit=1 ; (i= *array++) ; bit<<=1)
5051
if (my_toupper(mysqld_charset,*i++) !=
5052
my_toupper(mysqld_charset,*j++))
5061
else if (j != pos) // Half field found
5063
found_count++; // Could be one of two values
5067
if (found_count != 1)
5068
return(~(ulong) 0); // No unique value
5074
} /* find_bit_type */
5078
Check if file system used for databases is case insensitive.
5080
@param dir_name Directory to test
5083
-1 Don't know (Test failed)
5085
0 File system is case sensitive
5087
1 File system is case insensitive
5090
static int test_if_case_insensitive(const char *dir_name)
5094
char buff[FN_REFLEN], buff2[FN_REFLEN];
5095
struct stat stat_info;
5097
fn_format(buff, glob_hostname, dir_name, ".lower-test",
5098
MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR);
5099
fn_format(buff2, glob_hostname, dir_name, ".LOWER-TEST",
5100
MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR);
5101
(void) my_delete(buff2, MYF(0));
5102
if ((file= my_create(buff, 0666, O_RDWR, MYF(0))) < 0)
5104
sql_print_warning("Can't create test file %s", buff);
5107
my_close(file, MYF(0));
5108
if (!stat(buff2, &stat_info))
5109
result= 1; // Can access file
5110
(void) my_delete(buff, MYF(MY_WME));
5116
Create file to store pid number.
5118
static void create_pid_file()
5121
if ((file = my_create(pidfile_name,0664,
5122
O_WRONLY | O_TRUNC, MYF(MY_WME))) >= 0)
5124
char buff[21], *end;
5125
end= int10_to_str((long) getpid(), buff, 10);
5127
if (!my_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP)))
5129
(void) my_close(file, MYF(0));
5132
(void) my_close(file, MYF(0));
5134
sql_perror("Can't start server: can't create PID file");
5138
/** Clear most status variables. */
5139
void refresh_status(THD *thd)
5141
pthread_mutex_lock(&LOCK_status);
5143
/* Add thread's status variabes to global status */
5144
add_to_status(&global_status_var, &thd->status_var);
5146
/* Reset thread's status variables */
5147
bzero((uchar*) &thd->status_var, sizeof(thd->status_var));
5149
/* Reset some global variables */
5150
reset_status_vars();
5152
/* Reset the counters of all key caches (default and named). */
5153
process_key_caches(reset_key_cache_counters);
5154
flush_status_time= time((time_t*) 0);
5155
pthread_mutex_unlock(&LOCK_status);
5158
Set max_used_connections to the number of currently open
5159
connections. Lock LOCK_thread_count out of LOCK_status to avoid
5160
deadlocks. Status reset becomes not atomic, but status data is
5163
pthread_mutex_lock(&LOCK_thread_count);
5164
max_used_connections= thread_count;
5165
pthread_mutex_unlock(&LOCK_thread_count);
5169
/*****************************************************************************
5170
Instantiate templates
5171
*****************************************************************************/
5173
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
5174
/* Used templates */
5175
template class I_List<THD>;
5176
template class I_List_iterator<THD>;
5177
template class I_List<i_string>;
5178
template class I_List<i_string_pair>;
5179
template class I_List<NAMED_LIST>;
5180
template class I_List<Statement>;
5181
template class I_List_iterator<Statement>;