~mysql/mysql-server/mysql-6.0

« back to all changes in this revision

Viewing changes to sql/mysqld.cc

  • Committer: monty at mysql
  • Date: 2002-07-23 15:31:22 UTC
  • mto: (1110.1.7)
  • mto: This revision was merged to the branch mainline in revision 1116.
  • Revision ID: sp1r-monty@mashka.mysql.fi-20020723153122-09736
New SET syntax & system variables.
Made a some new buffers thread specific and changeable.
Resize of key_buffer.
AUTO_COMMIT -> AUTOCOMMIT
Fixed mutex bug in DROP DATABASE
Fixed bug when using auto_increment as second part of a key where first part could include NULL.
Split handler->extra() to extra() and extra_opt() to be able to support thread specific buffers.
Don't write message to error log when slave reconnects becasue of timeout.
Fixed possible update problem when using DELETE/UPDATE on small tables
(In some cases we used index even if table scanning would be better)
A lot of minior code cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
16
16
 
17
17
#include "mysql_priv.h"
18
 
#include <mysql.h>
19
18
#include <m_ctype.h>
20
19
#include <my_dir.h>
21
20
#include "sql_acl.h"
240
239
SHOW_COMP_OPTION have_query_cache=SHOW_OPTION_NO;
241
240
#endif
242
241
 
 
242
bool opt_large_files= sizeof(my_off_t) > 4;
 
243
 
 
244
/*
 
245
  Variables to store startup options
 
246
*/
 
247
 
243
248
bool opt_skip_slave_start = 0; // If set, slave is not autostarted
244
 
 
245
249
/*
246
250
  If set, some standard measures to enforce slave data integrity will not
247
251
  be performed
248
252
*/
249
253
bool opt_reckless_slave = 0; 
 
254
 
 
255
ulong back_log, connect_timeout;
 
256
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], time_zone[30];
 
257
bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
 
258
bool opt_disable_networking=0, opt_skip_show_db=0;
 
259
my_bool opt_local_infile;
 
260
 
250
261
static bool opt_do_pstack = 0;
251
262
static ulong opt_specialflag=SPECIAL_ENGLISH;
252
 
static ulong back_log,connect_timeout,concurrency;
 
263
static ulong concurrency;
253
264
static ulong opt_myisam_block_size;
254
265
static my_socket unix_sock= INVALID_SOCKET,ip_sock= INVALID_SOCKET;
255
266
static my_string opt_logname=0,opt_update_logname=0,
256
267
       opt_binlog_index_name = 0,opt_slow_logname=0;
257
 
static char mysql_home[FN_REFLEN],pidfile_name[FN_REFLEN];
 
268
 
258
269
static char* mysql_home_ptr= mysql_home;
259
270
static char* pidfile_name_ptr= pidfile_name;
260
271
static pthread_t select_thread;
261
 
static bool opt_log,opt_update_log,opt_bin_log,opt_slow_log,opt_noacl,
262
 
            opt_disable_networking=0, opt_bootstrap=0,opt_skip_show_db=0,
263
 
            opt_myisam_log=0,
264
 
            opt_large_files=sizeof(my_off_t) > 4;
265
 
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0, opt_safe_show_db=0,
266
 
  opt_show_slave_auth_info = 0, opt_old_rpl_compat = 0,
267
 
  opt_safe_user_create = 0, opt_no_mix_types = 0;
 
272
static bool opt_noacl, opt_bootstrap=0, opt_myisam_log=0;
 
273
bool opt_sql_bin_update = 0, opt_log_slave_updates = 0;
 
274
bool opt_safe_user_create = 0, opt_no_mix_types = 0;
 
275
my_bool opt_safe_show_db=0, lower_case_table_names, opt_old_rpl_compat;
 
276
my_bool opt_show_slave_auth_info;
268
277
volatile bool  mqh_used = 0;
269
278
FILE *bootstrap_file=0;
270
279
int segfaulted = 0; // ensure we do not enter SIGSEGV handler twice
277
286
static bool kill_in_progress=FALSE;
278
287
static struct rand_struct sql_rand;
279
288
static int cleanup_done;
280
 
static char **defaults_argv,time_zone[30];
281
 
static const char *default_table_type_name;
 
289
static char **defaults_argv;
282
290
char glob_hostname[FN_REFLEN];
283
291
 
284
292
#include "sslopt-vars.h"
293
301
I_List<i_string> binlog_do_db, binlog_ignore_db;
294
302
 
295
303
/* if we guessed server_id , we need to know about it */
296
 
uint32 server_id = 0;
 
304
ulong server_id= 0;                     // Must be long becasue of set_var.cc
297
305
bool server_id_supplied = 0;
298
306
 
299
307
uint mysql_port;
308
316
ulong keybuff_size,table_cache_size,
309
317
      thread_stack,
310
318
      thread_stack_min,what_to_log= ~ (1L << (uint) COM_TIME),
311
 
      query_buff_size, lower_case_table_names, mysqld_net_retry_count,
 
319
      query_buff_size, mysqld_net_retry_count,
312
320
      slow_launch_time = 2L,
313
 
      net_read_timeout,net_write_timeout,slave_open_temp_tables=0,
 
321
      slave_open_temp_tables=0,
314
322
      open_files_limit=0, max_binlog_size;
315
323
ulong com_stat[(uint) SQLCOM_END], com_other;
316
324
ulong slave_net_timeout;
317
325
ulong thread_cache_size=0, binlog_cache_size=0, max_binlog_cache_size=0;
318
326
ulong query_cache_size=0;
319
327
#ifdef HAVE_QUERY_CACHE
320
 
ulong query_cache_limit=0, query_cache_startup_type=1;
 
328
ulong query_cache_limit=0;
321
329
Query_cache query_cache;
322
330
#endif
323
331
 
339
347
ulong master_retry_count=0;
340
348
ulong bytes_sent = 0L, bytes_received = 0L;
341
349
 
342
 
bool opt_endinfo,using_udf_functions,low_priority_updates, locked_in_memory;
 
350
bool opt_endinfo,using_udf_functions, locked_in_memory;
343
351
bool opt_using_transactions, using_update_log;
344
352
bool volatile abort_loop,select_thread_in_use,grant_option;
345
353
bool volatile ready_to_exit,shutdown_in_progress;
361
369
  
362
370
char mysql_real_data_home[FN_REFLEN],
363
371
     language[LIBLEN],reg_ext[FN_EXTLEN],
364
 
     default_charset[LIBLEN],mysql_charsets_dir[FN_REFLEN], *charsets_list,
 
372
     mysql_charsets_dir[FN_REFLEN], *charsets_list,
365
373
     blob_newline,f_fyllchar,max_sort_char,*mysqld_user,*mysqld_chroot,
366
374
     *opt_init_file;
367
375
char *language_ptr= language;
368
 
char *default_charset_ptr= default_charset;
369
376
#ifndef EMBEDDED_LIBRARY
370
377
char mysql_data_home_buff[2], *mysql_data_home=mysql_data_home_buff;
371
378
bool mysql_embedded=0;
381
388
const char **errmesg;                   /* Error messages */
382
389
const char *myisam_recover_options_str="OFF";
383
390
const char *sql_mode_str="OFF";
384
 
const char *default_tx_isolation_name;
385
 
enum_tx_isolation default_tx_isolation=ISO_READ_COMMITTED;
386
 
 
387
 
uint rpl_recovery_rank=0;
388
 
 
389
 
my_string mysql_unix_port=NULL, mysql_tmpdir=NULL, allocated_mysql_tmpdir=NULL;
 
391
ulong rpl_recovery_rank=0;
 
392
 
 
393
my_string mysql_unix_port=NULL, opt_mysql_tmpdir=NULL, mysql_tmpdir=NULL;
390
394
ulong my_bind_addr;                     /* the address we bind to */
391
395
DATE_FORMAT dayord;
392
396
double log_10[32];                      /* 10 potences */
414
418
                LOCK_server_id, LOCK_global_system_variables,
415
419
                LOCK_user_conn, LOCK_slave_list, LOCK_active_mi;
416
420
 
417
 
pthread_cond_t COND_refresh,COND_thread_count,COND_binlog_update,
418
 
  COND_slave_stopped, COND_slave_start;
 
421
pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped,
 
422
               COND_slave_start;
419
423
pthread_cond_t COND_thread_cache,COND_flush_thread_cache;
420
424
pthread_t signal_thread;
421
425
pthread_attr_t connection_attrib;
422
 
enum db_type default_table_type=DB_TYPE_MYISAM;
423
426
 
424
427
#ifdef __WIN__
425
428
#undef   getpid
766
769
 
767
770
static sig_handler print_signal_warning(int sig)
768
771
{
769
 
  if (current_thd->variables.opt_warnings)
 
772
  if (global_system_variables.log_warnings)
770
773
    sql_print_error("Warning: Got signal %d from thread %d",
771
774
                    sig,my_thread_id());
772
775
#ifdef DONT_REMEMBER_SIGNAL
813
816
  hostname_cache_free();
814
817
  item_user_lock_free();
815
818
  lex_free();                           /* Free some memory */
 
819
  set_var_free();
816
820
#ifdef HAVE_DLOPEN
817
821
  if (!opt_noacl)
818
822
    udf_free();
832
836
  opt_ssl_key=opt_ssl_cert=opt_ssl_ca=opt_ssl_capath=0;
833
837
#endif /* HAVE_OPENSSL */
834
838
 
835
 
  free_defaults(defaults_argv);
 
839
  if (defaults_argv)
 
840
    free_defaults(defaults_argv);
836
841
  my_free(charsets_list, MYF(MY_ALLOW_ZERO_PTR));
837
 
  my_free(allocated_mysql_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
 
842
  my_free(mysql_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
838
843
  my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
839
844
  x_free(opt_bin_logname);
840
845
  x_free(opt_relay_logname);
1048
1053
                                 PIPE_READMODE_BYTE |
1049
1054
                                 PIPE_WAIT,
1050
1055
                                 PIPE_UNLIMITED_INSTANCES,
1051
 
                                 (int) net_buffer_length,
1052
 
                                 (int) net_buffer_length,
 
1056
                                 (int) global_variables.net_buffer_length,
 
1057
                                 (int) global_variables.net_buffer_length,
1053
1058
                                 NMPWAIT_USE_DEFAULT_WAIT,
1054
1059
                                 &saPipeSecurity )) == INVALID_HANDLE_VALUE)
1055
1060
      {
1334
1339
the problem, but since we have already crashed, something is definitely wrong\n\
1335
1340
and this may fail.\n\n");
1336
1341
  fprintf(stderr, "key_buffer_size=%ld\n", keybuff_size);
1337
 
  fprintf(stderr, "record_buffer=%ld\n", my_default_record_cache_size);
1338
 
  fprintf(stderr, "sort_buffer=%ld\n", thd->variables.sortbuff_size);
 
1342
  fprintf(stderr, "read_buffer_size=%ld\n", global_system_variables.read_buff_size);
 
1343
  fprintf(stderr, "sort_buffer_size=%ld\n", thd->variables.sortbuff_size);
1339
1344
  fprintf(stderr, "max_used_connections=%ld\n", max_used_connections);
1340
1345
  fprintf(stderr, "max_connections=%ld\n", max_connections);
1341
1346
  fprintf(stderr, "threads_connected=%d\n", thread_count);
1342
1347
  fprintf(stderr, "It is possible that mysqld could use up to \n\
1343
 
key_buffer_size + (record_buffer + sort_buffer)*max_connections = %ld K\n\
1344
 
bytes of memory\n", (keybuff_size + (my_default_record_cache_size +
 
1348
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = %ld K\n\
 
1349
bytes of memory\n", (keybuff_size + (global_system_variables.read_buff_size +
1345
1350
                                     thd->variables.sortbuff_size) *
1346
1351
                     max_connections)/ 1024);
1347
1352
  fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
1793
1798
#endif
1794
1799
  load_defaults("my",load_default_groups,&argc,&argv);
1795
1800
  defaults_argv=argv;
1796
 
  mysql_tmpdir=getenv("TMPDIR");        /* Use this if possible */
 
1801
 
 
1802
  /* Get default temporary directory */
 
1803
  opt_mysql_tmpdir=getenv("TMPDIR");    /* Use this if possible */
1797
1804
#if defined( __WIN__) || defined(OS2)
1798
 
  if (!mysql_tmpdir)
1799
 
    mysql_tmpdir=getenv("TEMP");
1800
 
  if (!mysql_tmpdir)
1801
 
    mysql_tmpdir=getenv("TMP");
 
1805
  if (!opt_mysql_tmpdir)
 
1806
    opt_mysql_tmpdir=getenv("TEMP");
 
1807
  if (!opt_mysql_tmpdir)
 
1808
    opt_mysql_tmpdir=getenv("TMP");
1802
1809
#endif
1803
 
  if (!mysql_tmpdir || !mysql_tmpdir[0])
1804
 
    mysql_tmpdir=(char*) P_tmpdir;              /* purecov: inspected */
 
1810
  if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0])
 
1811
    opt_mysql_tmpdir=(char*) P_tmpdir;          /* purecov: inspected */
1805
1812
 
1806
1813
  set_options();
1807
1814
  get_options(argc,argv);
1841
1848
  (void) pthread_cond_init(&COND_rpl_status, NULL);
1842
1849
  init_signals();
1843
1850
 
1844
 
  if (set_default_charset_by_name(default_charset, MYF(MY_WME)))
 
1851
  if (set_default_charset_by_name(sys_charset.value, MYF(MY_WME)))
1845
1852
    exit(1);
1846
1853
  charsets_list = list_charsets(MYF(MY_COMPILED_SETS|MY_CONFIG_SETS));
1847
1854
 
1900
1907
  init_errmessage();            /* Read error messages from file */
1901
1908
  lex_init();
1902
1909
  item_init();
 
1910
  set_var_init();
1903
1911
  mysys_uses_curses=0;
1904
1912
#ifdef USE_REGEX
1905
1913
  regex_init();
2284
2292
{
2285
2293
  THD *thd= new THD;
2286
2294
  int error;
 
2295
 
2287
2296
  thd->bootstrap=1;
2288
2297
  thd->client_capabilities=0;
2289
2298
  my_net_init(&thd->net,(st_vio*) 0);
2290
 
  thd->max_packet_length=thd->net.max_packet;
 
2299
  thd->max_client_packet_length= thd->net.max_packet;
2291
2300
  thd->master_access= ~0;
2292
2301
  thd->thread_id=thread_id++;
2293
2302
  thread_count++;
2332
2341
  DBUG_ENTER("create_new_thread");
2333
2342
 
2334
2343
  NET *net=&thd->net;                           // For easy ref
2335
 
  net->timeout = (uint) connect_timeout;        // Timeout for read
 
2344
  net->read_timeout = (uint) connect_timeout;
2336
2345
  if (protocol_version > 9)
2337
2346
    net->return_errno=1;
2338
2347
 
2663
2672
                                   PIPE_READMODE_BYTE |
2664
2673
                                   PIPE_WAIT,
2665
2674
                                   PIPE_UNLIMITED_INSTANCES,
2666
 
                                   (int) net_buffer_length,
2667
 
                                   (int) net_buffer_length,
 
2675
                                   (int) global_variables.net_buffer_length,
 
2676
                                   (int) global_variables.net_buffer_length,
2668
2677
                                   NMPWAIT_USE_DEFAULT_WAIT,
2669
2678
                                   &saPipeSecurity )) ==
2670
2679
          INVALID_HANDLE_VALUE )
2681
2690
                                 PIPE_READMODE_BYTE |
2682
2691
                                 PIPE_WAIT,
2683
2692
                                 PIPE_UNLIMITED_INSTANCES,
2684
 
                                 (int) net_buffer_length,
2685
 
                                 (int) net_buffer_length,
 
2693
                                 (int) global_variables.net_buffer_length,
 
2694
                                 (int) global_variables.net_buffer_length,
2686
2695
                                 NMPWAIT_USE_DEFAULT_WAIT,
2687
2696
                                 &saPipeSecurity)) ==
2688
2697
        INVALID_HANDLE_VALUE)
2800
2809
  OPT_MAX_DELAYED_THREADS, OPT_MAX_HEP_TABLE_SIZE,
2801
2810
  OPT_MAX_JOIN_SIZE, OPT_MAX_SORT_LENGTH,
2802
2811
  OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
2803
 
  OPT_MAX_WRITE_LOCK_COUNT, OPT_MYISAM_BULK_INSERT_TREE_SIZE,
 
2812
  OPT_MAX_WRITE_LOCK_COUNT, OPT_BULK_INSERT_BUFFER_SIZE,
2804
2813
  OPT_MYISAM_BLOCK_SIZE, OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
2805
2814
  OPT_MYISAM_MAX_SORT_FILE_SIZE, OPT_MYISAM_SORT_BUFFER_SIZE,
2806
2815
  OPT_NET_BUFFER_LENGTH, OPT_NET_RETRY_COUNT,
2807
2816
  OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
2808
 
  OPT_OPEN_FILES_LIMIT, OPT_QUERY_BUFFER_SIZE,
 
2817
  OPT_OPEN_FILES_LIMIT, 
2809
2818
  OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_SIZE,
2810
 
  OPT_QUERY_CACHE_STARTUP_TYPE, OPT_RECORD_BUFFER,
 
2819
  OPT_QUERY_CACHE_TYPE, OPT_RECORD_BUFFER,
2811
2820
  OPT_RECORD_RND_BUFFER, OPT_RELAY_LOG_SPACE_LIMIT,
2812
2821
  OPT_SLAVE_NET_TIMEOUT, OPT_SLOW_LAUNCH_TIME,
2813
2822
  OPT_SORT_BUFFER, OPT_TABLE_CACHE,
2832
2841
 
2833
2842
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
2834
2843
 
2835
 
static struct my_option my_long_options[] =
 
2844
struct my_option my_long_options[] =
2836
2845
{
2837
2846
  {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax", 0, 0, 0,
2838
2847
   GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
2911
2920
   0, 0, 0, 0, 0, 0},
2912
2921
#endif /* HAVE_OPENSSL */
2913
2922
  {"default-character-set", 'C', "Set the default character set",
2914
 
   (gptr*) &default_charset_ptr, (gptr*) &default_charset_ptr, 0, GET_STR,
2915
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
2923
   (gptr*) &sys_charset.value, (gptr*) &sys_charset.value, 0, GET_STR,
 
2924
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
2916
2925
  {"default-table-type", OPT_TABLE_TYPE,
2917
 
   "Set the default table type for tables", (gptr*) &default_table_type_name,
2918
 
   (gptr*) &default_table_type_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0,
2919
 
   0},
 
2926
   "Set the default table type for tables", 0, 0,
 
2927
   0, GET_NO_ARG, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2920
2928
  {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE, 
2921
2929
   "Don't flush key buffers between writes for any MyISAM table", 0, 0, 0,
2922
2930
   GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
2980
2988
   0, 0, 0, 0, 0, 0},
2981
2989
  {"local-infile", OPT_LOCAL_INFILE,
2982
2990
   "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0)",
2983
 
   (gptr*) &global_system_variables.opt_local_infile,
2984
 
   (gptr*) &max_system_variables.opt_local_infile, 0, GET_BOOL, OPT_ARG,
 
2991
   (gptr*) &opt_local_infile,
 
2992
   (gptr*) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
2985
2993
   1, 0, 0, 0, 0, 0},
2986
2994
  {"log-bin", OPT_BIN_LOG,
2987
2995
   "Log queries in new binary format (for replication)",
3006
3014
   "Log some extra information to update log", 0, 0, 0, GET_NO_ARG, NO_ARG,
3007
3015
   0, 0, 0, 0, 0, 0},
3008
3016
  {"log-slave-updates", OPT_LOG_SLAVE_UPDATES, 
3009
 
   "Tells the slave to log the updates from the slave thread to the binary log. Off by default. You will need to turn it on if you plan to daisy-chain the slaves.",
 
3017
   "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.",
3010
3018
   (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
3011
3019
   NO_ARG, 0, 0, 0, 0, 0, 0},
3012
3020
  {"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
3013
 
   "INSERT/DELETE/UPDATE has lower priority than selects", 0, 0, 0, GET_NO_ARG,
3014
 
   NO_ARG, 0, 0, 0, 0, 0, 0},
 
3021
   "INSERT/DELETE/UPDATE has lower priority than selects",
 
3022
   (gptr*) &global_system_variables.low_priority_updates,
 
3023
   (gptr*) &max_system_variables.low_priority_updates,
 
3024
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3015
3025
  {"master-host", OPT_MASTER_HOST, 
3016
3026
   "Master hostname or IP address for replication. If not set, the slave thread will not be started. Note that the setting of master-host will be ignored if there exists a valid master.info file.",
3017
3027
   (gptr*) &master_host, (gptr*) &master_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
3083
3093
  {"new", 'n', "Use very new possible 'unsafe' functions", 0, 0, 0, GET_NO_ARG,
3084
3094
   NO_ARG, 0, 0, 0, 0, 0, 0},
3085
3095
#ifdef NOT_YET
3086
 
  {"no-mix-table-types", OPT_NO_MIX_TYPE, "Undocumented",
 
3096
  {"no-mix-table-types", OPT_NO_MIX_TYPE, "Don't allow commands with uses two different table types",
3087
3097
   (gptr*) &opt_no_mix_types, (gptr*) &opt_no_mix_types, 0, GET_BOOL, NO_ARG,
3088
3098
   0, 0, 0, 0, 0, 0},
3089
3099
#endif
3090
3100
  {"old-protocol", 'o', "Use the old (3.20) protocol",
3091
3101
   (gptr*) &protocol_version, (gptr*) &protocol_version, 0, GET_UINT, NO_ARG,
3092
3102
   PROTOCOL_VERSION, 0, 0, 0, 0, 0},
3093
 
  {"old-rpl-compat", OPT_OLD_RPL_COMPAT, "Undocumented",
 
3103
  {"old-rpl-compat", OPT_OLD_RPL_COMPAT,
 
3104
   "Use old LOAD DATA format in the binary log (don't save data in file)",
3094
3105
   (gptr*) &opt_old_rpl_compat, (gptr*) &opt_old_rpl_compat, 0, GET_BOOL,
3095
3106
   NO_ARG, 0, 0, 0, 0, 0, 0},
3096
3107
#ifdef ONE_THREAD
3103
3114
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3104
3115
  {"port", 'P', "Port number to use for connection.", (gptr*) &mysql_port,
3105
3116
   (gptr*) &mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3106
 
  {"reckless-slave", OPT_RECKLESS_SLAVE, "Undocumented", 0, 0, 0, GET_NO_ARG,
 
3117
  {"reckless-slave", OPT_RECKLESS_SLAVE, "For debugging", 0, 0, 0, GET_NO_ARG,
3107
3118
   NO_ARG, 0, 0, 0, 0, 0, 0},
3108
3119
  {"replicate-do-db", OPT_REPLICATE_DO_DB,
3109
3120
   "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.%.",
3151
3162
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3152
3163
  {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
3153
3164
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3165
#ifndef TO_BE_DELETED
3154
3166
  {"safe-show-database", OPT_SAFE_SHOW_DB,
3155
3167
   "Depricated option; One should use GRANT SHOW DATABASES instead...",
3156
3168
   (gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
3157
3169
   0, 0, 0, 0, 0, 0},
 
3170
#endif
3158
3171
  {"safe-user-create", OPT_SAFE_USER_CREATE,
3159
3172
   "Don't allow new user creation by the user who has no write privileges to the mysql.user table",
3160
3173
   (gptr*) &opt_safe_user_create, (gptr*) &opt_safe_user_create, 0, GET_BOOL,
3161
3174
   NO_ARG, 0, 0, 0, 0, 0, 0},
3162
3175
  {"server-id", OPT_SERVER_ID,
3163
3176
   "Uniquely identifies the server instance in the community of replication partners",
3164
 
   (gptr*) &server_id, (gptr*) &server_id, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0,
 
3177
   (gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
3165
3178
   0, 0, 0},
3166
3179
  {"set-variable", 'O',
3167
3180
   "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
3168
3181
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3169
 
  {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO, "Undocumented",
 
3182
  {"show-slave-auth-info", OPT_SHOW_SLAVE_AUTH_INFO,
 
3183
   "Show user and password in SHOW SLAVE STATUS",
3170
3184
   (gptr*) &opt_show_slave_auth_info, (gptr*) &opt_show_slave_auth_info, 0,
3171
3185
   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3172
3186
  {"concurrent-insert", OPT_CONCURRENT_INSERT,
3173
3187
   "Use concurrent insert with MyISAM. Disable with prefix --skip-",
3174
3188
   (gptr*) &myisam_concurrent_insert, (gptr*) &myisam_concurrent_insert,
3175
 
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3189
   0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
3176
3190
  {"delay-key-write", OPT_USE_DELAY_KEY_WRITE,
3177
3191
   "Use delay_key_write option for all tables. Disable with prefix --skip-",
3178
3192
   (gptr*) &myisam_delay_key_write, (gptr*) &myisam_delay_key_write, 0,
3237
3251
   "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.",
3238
3252
   (gptr*) &use_temp_pool, (gptr*) &use_temp_pool, 0, GET_BOOL, NO_ARG, 0, 0,
3239
3253
   0, 0, 0, 0},
3240
 
  {"tmpdir", 't', "Path for temporary files", (gptr*) &mysql_tmpdir,
3241
 
   (gptr*) &mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3254
  {"tmpdir", 't', "Path for temporary files", (gptr*) &opt_mysql_tmpdir,
 
3255
   (gptr*) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3242
3256
  {"transaction-isolation", OPT_TX_ISOLATION,
3243
 
   "Default transaction isolation level", (gptr*) &default_tx_isolation_name,
3244
 
   (gptr*) &default_tx_isolation_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
 
3257
   "Default transaction isolation level", 0, 0, 0, GET_NO_ARG, REQUIRED_ARG, 0,
 
3258
   0, 0, 0,
3245
3259
   0, 0},
3246
3260
  {"use-locking", OPT_USE_LOCKING, "Use system (external) locking",
3247
3261
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3256
3270
   NO_ARG, 0, 0, 0, 0, 0, 0},
3257
3271
  {"version", 'v', "Synonym for option -v", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
3258
3272
   0, 0, 0, 0},
3259
 
  {"warnings", 'W', "Log some not critical warnings to the log file",
3260
 
   (gptr*) &global_system_variables.opt_warnings,
3261
 
   (gptr*) &max_system_variables.opt_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
 
3273
  {"log-warnings", 'W', "Log some not critical warnings to the log file",
 
3274
   (gptr*) &global_system_variables.log_warnings,
 
3275
   (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
 
3276
   0, 0, 0},
 
3277
  {"warnings", 'W', "Deprecated ; Use --log-warnings instead",
 
3278
   (gptr*) &global_system_variables.log_warnings,
 
3279
   (gptr*) &max_system_variables.log_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0,
3262
3280
   0, 0, 0},
3263
3281
  { "back_log", OPT_BACK_LOG,
3264
3282
    "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.", (gptr*) &back_log, (gptr*) &back_log, 0, GET_ULONG,
3287
3305
   REQUIRED_ARG, 32*1024L, IO_SIZE, ~0L, 0, IO_SIZE, 0},
3288
3306
  {"connect_timeout", OPT_CONNECT_TIMEOUT, 
3289
3307
   "The number of seconds the mysqld server is waiting for a connect packet before responding with Bad handshake",
3290
 
    (gptr*) &connect_timeout, (gptr*) &connect_timeout, 0, GET_ULONG,
3291
 
   REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
 
3308
    (gptr*) &connect_timeout, (gptr*) &connect_timeout,
 
3309
   0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
3292
3310
  {"delayed_insert_timeout", OPT_DELAYED_INSERT_TIMEOUT,
3293
3311
   "How long a INSERT DELAYED thread should wait for INSERT statements before terminating.",
3294
3312
   (gptr*) &delayed_insert_timeout, (gptr*) &delayed_insert_timeout, 0,
3385
3403
   "If set to 1 table names are stored in lowercase on disk and table names will be case-insensitive.",
3386
3404
   (gptr*) &lower_case_table_names,
3387
3405
   (gptr*) &lower_case_table_names, 0,
3388
 
   GET_ULONG, REQUIRED_ARG, IF_WIN(1,0), 0, 1, 0, 1, 0},
 
3406
   GET_BOOL, REQUIRED_ARG, IF_WIN(1,0), 0, 1, 0, 1, 0},
3389
3407
  {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
3390
3408
   "Max packetlength to send/receive from to server.",
3391
 
   (gptr*) &max_allowed_packet,
3392
 
   (gptr*) &max_allowed_packet, 0, GET_ULONG,
 
3409
   (gptr*) &global_system_variables.max_allowed_packet,
 
3410
   (gptr*) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
3393
3411
   REQUIRED_ARG, 1024*1024L, 80, 64*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
3394
3412
  {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
3395
3413
   "Can be used to restrict the total size used to cache a multi-transaction query.",
3423
3441
   ~0L, 1, ~0L, 0, 1, 0},
3424
3442
  {"max_sort_length", OPT_MAX_SORT_LENGTH,
3425
3443
   "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).",
3426
 
   (gptr*) &global_system_variables.max_item_sort_length,
3427
 
   (gptr*) &max_system_variables.max_item_sort_length, 0, GET_ULONG,
 
3444
   (gptr*) &global_system_variables.max_sort_length,
 
3445
   (gptr*) &max_system_variables.max_sort_length, 0, GET_ULONG,
3428
3446
   REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3429
3447
  {"max_tmp_tables", OPT_MAX_TMP_TABLES,
3430
3448
   "Maximum number of temporary tables a client can keep open at a time.",
3439
3457
   "After this many write locks, allow some read locks to run in between.",
3440
3458
   (gptr*) &max_write_lock_count, (gptr*) &max_write_lock_count, 0, GET_ULONG,
3441
3459
   REQUIRED_ARG, ~0L, 1, ~0L, 0, 1, 0},
3442
 
  {"myisam_bulk_insert_tree_size", OPT_MYISAM_BULK_INSERT_TREE_SIZE,
 
3460
  {"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
3443
3461
   "Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!",
3444
 
   (gptr*) &myisam_bulk_insert_tree_size,
3445
 
   (gptr*) &myisam_bulk_insert_tree_size,
 
3462
   (gptr*) &global_system_variables.bulk_insert_buff_size,
 
3463
   (gptr*) &max_system_variables.bulk_insert_buff_size,
3446
3464
   0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ~0L, 0, 1, 0},
3447
3465
  {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
3448
 
   "Undocumented", (gptr*) &opt_myisam_block_size,
 
3466
   "Block size to be used for MyISAM index pages",
 
3467
   (gptr*) &opt_myisam_block_size,
3449
3468
   (gptr*) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
3450
3469
   MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
3451
3470
   0, MI_MIN_KEY_BLOCK_LENGTH, 0},
3452
3471
  {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
3453
 
   "Used to help MySQL to decide when to use the slow but safe key cache index create method. Note that this parameter is given in megabytes!",
 
3472
   "Used to help MySQL to decide when to use the slow but safe key cache index create method",
3454
3473
   (gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
3455
3474
   (gptr*) &max_system_variables.myisam_max_extra_sort_file_size,
3456
 
   0, GET_ULONG, REQUIRED_ARG, (long) (MI_MAX_TEMP_LENGTH/(1024L*1024L)),
 
3475
   0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH,
3457
3476
   0, ~0L, 0, 1, 0},
3458
3477
  {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
3459
 
   "Don't use the fast sort index method to created index if the temporary file would get bigger than this. Note that this paramter is given in megabytes!",
 
3478
   "Don't use the fast sort index method to created index if the temporary file would get bigger than this!",
3460
3479
   (gptr*) &global_system_variables.myisam_max_sort_file_size,
3461
3480
   (gptr*) &max_system_variables.myisam_max_sort_file_size, 0,
3462
 
   GET_ULONG, REQUIRED_ARG, (long) (LONG_MAX/(1024L*1024L)), 0, ~0L, 0, 1, 0},
 
3481
   GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, ~0L, 0, 1024*1024, 0},
3463
3482
  {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
3464
3483
   "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
3465
 
   (gptr*) &myisam_sort_buffer_size, (gptr*) &myisam_sort_buffer_size, 0,
 
3484
   (gptr*) &global_system_variables.myisam_sort_buff_size,
 
3485
   (gptr*) &max_system_variables.myisam_sort_buff_size, 0,
3466
3486
   GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
3467
3487
  {"net_buffer_length", OPT_NET_BUFFER_LENGTH,
3468
 
   "Buffer for TCP/IP and socket communication.", 
3469
 
   (gptr*) &net_buffer_length,
3470
 
   (gptr*) &net_buffer_length, 0, GET_ULONG,
3471
 
   REQUIRED_ARG, 16384, 1024, 1024*1024L, MALLOC_OVERHEAD, 1024, 0},
 
3488
   "Buffer length for TCP/IP and socket communication.", 
 
3489
   (gptr*) &global_system_variables.net_buffer_length,
 
3490
   (gptr*) &max_system_variables.net_buffer_length, 0, GET_ULONG,
 
3491
   REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0},
3472
3492
  {"net_retry_count", OPT_NET_RETRY_COUNT,
3473
3493
   "If a read on a communication port is interrupted, retry this many times before giving up.",
3474
3494
   (gptr*) &mysqld_net_retry_count, (gptr*) &mysqld_net_retry_count, 0,
3475
3495
   GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ~0L, 0, 1, 0},
3476
3496
  {"net_read_timeout", OPT_NET_READ_TIMEOUT,
3477
3497
   "Number of seconds to wait for more data from a connection before aborting the read.",
3478
 
   (gptr*) &net_read_timeout,
3479
 
   (gptr*) &net_read_timeout, 0, GET_ULONG,
 
3498
   (gptr*) &global_system_variables.net_read_timeout,
 
3499
   (gptr*) &max_system_variables.net_read_timeout, 0, GET_ULONG,
3480
3500
   REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3481
3501
  {"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
3482
3502
   "Number of seconds to wait for a block to be written to a connection  before aborting the write.",
3483
 
   (gptr*) &net_write_timeout,
3484
 
   (gptr*) &net_write_timeout, 0, GET_ULONG,
 
3503
   (gptr*) &global_system_variables.net_write_timeout,
 
3504
   (gptr*) &max_system_variables.net_write_timeout, 0, GET_ULONG,
3485
3505
   REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3486
3506
  {"open_files_limit", OPT_OPEN_FILES_LIMIT,
3487
3507
   "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.",
3488
3508
   (gptr*) &open_files_limit, (gptr*) &open_files_limit, 0, GET_ULONG,
3489
3509
   REQUIRED_ARG, 0, 0, 65535, 0, 1, 0},
3490
 
  {"query_buffer_size", OPT_QUERY_BUFFER_SIZE,
3491
 
   "The initial allocation of the query buffer.", (gptr*) &query_buff_size,
3492
 
   (gptr*) &query_buff_size, 0, GET_ULONG, REQUIRED_ARG, 0, MALLOC_OVERHEAD,
3493
 
   (long) ~0, MALLOC_OVERHEAD, IO_SIZE, 0},
3494
3510
#ifdef HAVE_QUERY_CACHE
3495
3511
  {"query_cache_limit", OPT_QUERY_CACHE_LIMIT,
3496
3512
   "Don't cache results that are bigger than this.",
3500
3516
  {"query_cache_size", OPT_QUERY_CACHE_SIZE,
3501
3517
   "The memory allocated to store results from old queries.",
3502
3518
   (gptr*) &query_cache_size, (gptr*) &query_cache_size, 0, GET_ULONG,
3503
 
   REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1, 0},
 
3519
   REQUIRED_ARG, 0, 0, (longlong) ULONG_MAX, 0, 1024, 0},
3504
3520
#ifdef HAVE_QUERY_CACHE
3505
 
  {"query_cache_startup_type", OPT_QUERY_CACHE_STARTUP_TYPE,
 
3521
  {"query_cache_type", OPT_QUERY_CACHE_TYPE,
3506
3522
   "0 = OFF = Don't cache or retrieve results. 1 = ON = Cache all results except SELECT SQL_NO_CACHE ... queries. 2 = DEMAND = Cache only SELECT SQL_CACHE ... queries.",
3507
 
   (gptr*) &query_cache_startup_type, (gptr*) &query_cache_startup_type, 0,
3508
 
   GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0},
 
3523
   (gptr*) &global_system_variables.query_cache_type,
 
3524
   (gptr*) &max_system_variables.query_cache_type,
 
3525
   0, GET_ULONG, REQUIRED_ARG, 1, 0, 2, 0, 1, 0},
3509
3526
#endif /*HAVE_QUERY_CACHE*/
3510
 
  {"record_buffer", OPT_RECORD_BUFFER,
 
3527
  {"read_buffer_size", OPT_RECORD_BUFFER,
3511
3528
   "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.",
3512
 
   (gptr*) &my_default_record_cache_size,
3513
 
   (gptr*) &my_default_record_cache_size, 0, GET_ULONG, REQUIRED_ARG,
 
3529
   (gptr*) &global_system_variables.read_buff_size,
 
3530
   (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3514
3531
   128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
3515
 
  {"record_rnd_buffer", OPT_RECORD_RND_BUFFER,
 
3532
  {"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
3516
3533
   "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.",
3517
 
   (gptr*) &global_system_variables.record_rnd_cache_size,
3518
 
   (gptr*) &max_system_variables.record_rnd_cache_size, 0,
3519
 
   GET_ULONG, REQUIRED_ARG, 0, IO_SIZE*2+MALLOC_OVERHEAD,
 
3534
   (gptr*) &global_system_variables.read_rnd_buff_size,
 
3535
   (gptr*) &max_system_variables.read_rnd_buff_size, 0,
 
3536
   GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD,
3520
3537
   ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
 
3538
  {"record_buffer", OPT_RECORD_BUFFER,
 
3539
   "Alias for read_buffer_size",
 
3540
   (gptr*) &global_system_variables.read_buff_size,
 
3541
   (gptr*) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
 
3542
   128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ~0L, MALLOC_OVERHEAD, IO_SIZE, 0},
3521
3543
  {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
3522
3544
   "Undocumented", (gptr*) &relay_log_space_limit,
3523
3545
   (gptr*) &relay_log_space_limit, 0, GET_ULONG, REQUIRED_ARG, 0L, 0L,
3530
3552
   "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
3531
3553
   (gptr*) &slow_launch_time, (gptr*) &slow_launch_time, 0, GET_ULONG,
3532
3554
   REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
3533
 
  {"sort_buffer", OPT_SORT_BUFFER,
 
3555
  {"sort_buffer_size", OPT_SORT_BUFFER,
3534
3556
   "Each thread that needs to do a sort allocates a buffer of this size.",
3535
3557
   (gptr*) &global_system_variables.sortbuff_size,
3536
3558
   (gptr*) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
3565
3587
  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
3566
3588
};
3567
3589
 
3568
 
struct show_var_st init_vars[]= {
3569
 
  {"back_log",                (char*) &back_log,                    SHOW_LONG},
3570
 
  {"basedir",                 mysql_home,                           SHOW_CHAR},
3571
 
#ifdef HAVE_BERKELEY_DB
3572
 
  {"bdb_cache_size",          (char*) &berkeley_cache_size,         SHOW_LONG},
3573
 
  {"bdb_log_buffer_size",     (char*) &berkeley_log_buffer_size,    SHOW_LONG},
3574
 
  {"bdb_home",                (char*) &berkeley_home,               SHOW_CHAR_PTR},
3575
 
  {"bdb_max_lock",            (char*) &berkeley_max_lock,           SHOW_LONG},
3576
 
  {"bdb_logdir",              (char*) &berkeley_logdir,             SHOW_CHAR_PTR},
3577
 
  {"bdb_shared_data",         (char*) &berkeley_shared_data,        SHOW_BOOL},
3578
 
  {"bdb_tmpdir",              (char*) &berkeley_tmpdir,             SHOW_CHAR_PTR},
3579
 
  {"bdb_version",             (char*) DB_VERSION_STRING,            SHOW_CHAR},
3580
 
#endif
3581
 
  {"binlog_cache_size",       (char*) &binlog_cache_size,           SHOW_LONG},
3582
 
  {"character_set",           default_charset,                      SHOW_CHAR},
3583
 
  {"character_sets",          (char*) &charsets_list,               SHOW_CHAR_PTR},
3584
 
  {"concurrent_insert",       (char*) &myisam_concurrent_insert,    SHOW_MY_BOOL},
3585
 
  {"connect_timeout",         (char*) &connect_timeout,             SHOW_LONG},
3586
 
  {"datadir",                 mysql_real_data_home,                 SHOW_CHAR},
3587
 
  {"delay_key_write",         (char*) &myisam_delay_key_write,      SHOW_MY_BOOL},
3588
 
  {"delayed_insert_limit",    (char*) &delayed_insert_limit,        SHOW_LONG},
3589
 
  {"delayed_insert_timeout",  (char*) &delayed_insert_timeout,      SHOW_LONG},
3590
 
  {"delayed_queue_size",      (char*) &delayed_queue_size,          SHOW_LONG},
3591
 
  {"flush",                   (char*) &myisam_flush,                SHOW_MY_BOOL},
3592
 
  {"flush_time",              (char*) &flush_time,                  SHOW_LONG},
3593
 
  {"ft_min_word_len",         (char*) &ft_min_word_len,             SHOW_LONG},
3594
 
  {"ft_max_word_len",         (char*) &ft_max_word_len,             SHOW_LONG},
3595
 
  {"ft_max_word_len_for_sort",(char*) &ft_max_word_len_for_sort,    SHOW_LONG},
3596
 
  {"ft_boolean_syntax",       (char*) ft_boolean_syntax,            SHOW_CHAR},
3597
 
  {"have_bdb",                (char*) &have_berkeley_db,            SHOW_HAVE},
3598
 
  {"have_innodb",             (char*) &have_innodb,                 SHOW_HAVE},
3599
 
  {"have_isam",               (char*) &have_isam,                   SHOW_HAVE},
3600
 
  {"have_raid",               (char*) &have_raid,                   SHOW_HAVE},
3601
 
  {"have_symlink",            (char*) &have_symlink,                SHOW_HAVE},
3602
 
  {"have_openssl",            (char*) &have_openssl,                SHOW_HAVE},
3603
 
  {"have_query_cache",        (char*) &have_query_cache,            SHOW_HAVE},
3604
 
  {"init_file",               (char*) &opt_init_file,               SHOW_CHAR_PTR},
3605
 
#ifdef HAVE_INNOBASE_DB
3606
 
  {"innodb_additional_mem_pool_size", (char*) &innobase_additional_mem_pool_size, SHOW_LONG },
3607
 
  {"innodb_buffer_pool_size", (char*) &innobase_buffer_pool_size, SHOW_LONG },
3608
 
  {"innodb_data_file_path", (char*) &innobase_data_file_path,       SHOW_CHAR_PTR},
3609
 
  {"innodb_data_home_dir",  (char*) &innobase_data_home_dir,        SHOW_CHAR_PTR},
3610
 
  {"innodb_file_io_threads", (char*) &innobase_file_io_threads, SHOW_LONG },
3611
 
  {"innodb_force_recovery", (char*) &innobase_force_recovery, SHOW_LONG },
3612
 
  {"innodb_thread_concurrency", (char*) &innobase_thread_concurrency, SHOW_LONG },
3613
 
  {"innodb_flush_log_at_trx_commit", (char*) &innobase_flush_log_at_trx_commit, SHOW_MY_BOOL},
3614
 
  {"innodb_fast_shutdown", (char*) &innobase_fast_shutdown, SHOW_MY_BOOL},
3615
 
  {"innodb_flush_method",    (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR},
3616
 
  {"innodb_lock_wait_timeout", (char*) &innobase_lock_wait_timeout, SHOW_LONG },
3617
 
  {"innodb_log_arch_dir",   (char*) &innobase_log_arch_dir,         SHOW_CHAR_PTR},
3618
 
  {"innodb_log_archive",    (char*) &innobase_log_archive,          SHOW_MY_BOOL},
3619
 
  {"innodb_log_buffer_size", (char*) &innobase_log_buffer_size, SHOW_LONG },
3620
 
  {"innodb_log_file_size", (char*) &innobase_log_file_size, SHOW_LONG},
3621
 
  {"innodb_log_files_in_group", (char*) &innobase_log_files_in_group,   SHOW_LONG},
3622
 
  {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR},
3623
 
  {"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
3624
 
#endif
3625
 
  {"interactive_timeout",
3626
 
   (char*) offsetof(struct system_variables, net_interactive_timeout),
3627
 
   SHOW_LONG_OFFSET},
3628
 
  {"join_buffer_size",
3629
 
   (char*) offsetof(struct system_variables, join_buff_size),
3630
 
   SHOW_LONG_OFFSET},
3631
 
  {"key_buffer_size",         (char*) &keybuff_size,                SHOW_LONG},
3632
 
  {"language",                language,                             SHOW_CHAR},
3633
 
  {"large_files_support",     (char*) &opt_large_files,             SHOW_BOOL}, 
3634
 
  {"local_infile",
3635
 
   (char*) offsetof(struct system_variables, opt_local_infile),
3636
 
   SHOW_MY_BOOL_OFFSET},
3637
 
#ifdef HAVE_MLOCKALL
3638
 
  {"locked_in_memory",        (char*) &locked_in_memory,            SHOW_BOOL},
3639
 
#endif
3640
 
  {"log",                     (char*) &opt_log,                     SHOW_BOOL},
3641
 
  {"log_update",              (char*) &opt_update_log,              SHOW_BOOL},
3642
 
  {"log_bin",                 (char*) &opt_bin_log,                 SHOW_BOOL},
3643
 
  {"log_slave_updates",       (char*) &opt_log_slave_updates,       SHOW_BOOL},
3644
 
  {"log_slow_queries",        (char*) &opt_slow_log,                SHOW_BOOL},
3645
 
  {"long_query_time",         
3646
 
   (char*) offsetof(struct system_variables, long_query_time),
3647
 
   SHOW_LONG_OFFSET},
3648
 
  {"low_priority_updates",    (char*) &low_priority_updates,        SHOW_BOOL},
3649
 
  {"lower_case_table_names",  (char*) &lower_case_table_names,      SHOW_LONG},
3650
 
  {"max_allowed_packet",      (char*) &max_allowed_packet,          SHOW_LONG},
3651
 
  {"max_binlog_cache_size",   (char*) &max_binlog_cache_size,       SHOW_LONG},
3652
 
  {"max_binlog_size",         (char*) &max_binlog_size,             SHOW_LONG},
3653
 
  {"max_connections",         (char*) &max_connections,             SHOW_LONG},
3654
 
  {"max_connect_errors",      (char*) &max_connect_errors,          SHOW_LONG},
3655
 
  {"max_delayed_threads",     (char*) &max_insert_delayed_threads,  SHOW_LONG},
3656
 
  {"max_heap_table_size",
3657
 
   (char*) offsetof(struct system_variables, max_heap_table_size),
3658
 
   SHOW_LONG_OFFSET},
3659
 
  {"max_join_size",
3660
 
   (char*) offsetof(struct system_variables, max_join_size),
3661
 
   SHOW_LONG_OFFSET},
3662
 
  {"max_sort_length",
3663
 
   (char*) offsetof(struct system_variables, max_item_sort_length),
3664
 
   SHOW_LONG_OFFSET},
3665
 
  {"max_user_connections",    (char*) &max_user_connections,        SHOW_LONG},
3666
 
  {"max_tmp_tables",
3667
 
   (char*) offsetof(struct system_variables, max_tmp_tables),
3668
 
   SHOW_LONG_OFFSET},
3669
 
  {"max_write_lock_count",    (char*) &max_write_lock_count,        SHOW_LONG},
3670
 
    {"myisam_bulk_insert_tree_size", (char*) &myisam_bulk_insert_tree_size, SHOW_INT},
3671
 
  {"myisam_max_extra_sort_file_size",
3672
 
   (char*) offsetof(struct system_variables,
3673
 
                    myisam_max_extra_sort_file_size),
3674
 
   SHOW_LONG_OFFSET},
3675
 
  {"myisam_max_sort_file_size",
3676
 
   (char*) offsetof(struct system_variables, myisam_max_sort_file_size),
3677
 
   SHOW_LONG_OFFSET},
3678
 
  {"myisam_recover_options",  (char*) &myisam_recover_options_str,  SHOW_CHAR_PTR},
3679
 
  {"myisam_sort_buffer_size", (char*) &myisam_sort_buffer_size,     SHOW_LONG},
3680
 
#ifdef __NT__
3681
 
  {"named_pipe",              (char*) &opt_enable_named_pipe,       SHOW_BOOL},
3682
 
#endif
3683
 
  {"net_buffer_length",       (char*) &net_buffer_length,           SHOW_LONG},
3684
 
  {"net_read_timeout",        (char*) &net_read_timeout,            SHOW_LONG},
3685
 
  {"net_retry_count",         (char*) &mysqld_net_retry_count,      SHOW_LONG},
3686
 
  {"net_write_timeout",       (char*) &net_write_timeout,           SHOW_LONG},
3687
 
  {"open_files_limit",        (char*) &open_files_limit,            SHOW_LONG},
3688
 
  {"pid_file",                (char*) pidfile_name,                 SHOW_CHAR},
3689
 
  {"port",                    (char*) &mysql_port,                  SHOW_INT},
3690
 
  {"protocol_version",        (char*) &protocol_version,            SHOW_INT},
3691
 
  {"record_buffer",           (char*) &my_default_record_cache_size,SHOW_LONG},
3692
 
  {"record_rnd_buffer",
3693
 
   (char*) offsetof(struct system_variables, record_rnd_cache_size),
3694
 
   SHOW_LONG_OFFSET},
3695
 
  {"rpl_recovery_rank",       (char*) &rpl_recovery_rank,           SHOW_LONG},
3696
 
  {"query_buffer_size",       (char*) &query_buff_size,             SHOW_LONG},
3697
 
#ifdef HAVE_QUERY_CACHE
3698
 
  {"query_cache_limit",       (char*) &query_cache.query_cache_limit, SHOW_LONG},
3699
 
  {"query_cache_size",        (char*) &query_cache.query_cache_size, SHOW_LONG},
3700
 
  {"query_cache_startup_type",(char*) &query_cache_startup_type,    SHOW_LONG},
3701
 
#endif /*HAVE_QUERY_CACHE*/
3702
 
  {"safe_show_database",      (char*) &opt_safe_show_db,            SHOW_BOOL},
3703
 
  {"server_id",               (char*) &server_id,                   SHOW_LONG},
3704
 
  {"slave_net_timeout",       (char*) &slave_net_timeout,           SHOW_LONG},
3705
 
  {"skip_locking",            (char*) &my_disable_locking,          SHOW_MY_BOOL},
3706
 
  {"skip_networking",         (char*) &opt_disable_networking,      SHOW_BOOL},
3707
 
  {"skip_show_database",      (char*) &opt_skip_show_db,            SHOW_BOOL},
3708
 
  {"slow_launch_time",        (char*) &slow_launch_time,            SHOW_LONG},
3709
 
  {"socket",                  (char*) &mysql_unix_port,             SHOW_CHAR_PTR},
3710
 
  {"sort_buffer",
3711
 
   (char*) offsetof(struct system_variables, sortbuff_size),
3712
 
   SHOW_LONG_OFFSET},
3713
 
  {"sql_mode",                (char*) &opt_sql_mode,                SHOW_LONG},
3714
 
  {"table_cache",             (char*) &table_cache_size,            SHOW_LONG},
3715
 
  {"table_type",              (char*) &default_table_type_name,     SHOW_CHAR_PTR},
3716
 
  {"thread_cache_size",       (char*) &thread_cache_size,           SHOW_LONG},
3717
 
#ifdef HAVE_THR_SETCONCURRENCY
3718
 
  {"thread_concurrency",      (char*) &concurrency,                 SHOW_LONG},
3719
 
#endif
3720
 
  {"thread_stack",            (char*) &thread_stack,                SHOW_LONG},
3721
 
  {"transaction_isolation",   (char*) &default_tx_isolation_name,   SHOW_CHAR_PTR},
3722
 
#ifdef HAVE_TZNAME
3723
 
  {"timezone",                time_zone,                            SHOW_CHAR},
3724
 
#endif
3725
 
  {"tmp_table_size",
3726
 
   (char*) offsetof(struct system_variables, tmp_table_size),
3727
 
   SHOW_LONG_OFFSET},
3728
 
  {"tmpdir",                  (char*) &mysql_tmpdir,                SHOW_CHAR_PTR},
3729
 
  {"version",                 server_version,                       SHOW_CHAR},
3730
 
  {"wait_timeout",
3731
 
   (char*) offsetof(struct system_variables, net_wait_timeout),
3732
 
   SHOW_LONG_OFFSET},
3733
 
  {"warnings",
3734
 
   (char*) offsetof(struct system_variables, opt_warnings),
3735
 
   SHOW_MY_BOOL_OFFSET},
3736
 
  {NullS, NullS, SHOW_LONG}
3737
 
};
3738
3590
 
3739
3591
struct show_var_st status_vars[]= {
3740
3592
  {"Aborted_clients",          (char*) &aborted_threads,        SHOW_LONG},
3943
3795
  my_print_help(my_long_options);
3944
3796
  my_print_variables(my_long_options);
3945
3797
 
3946
 
  printf("\
 
3798
  puts("\n\
3947
3799
To see what values a running MySQL server is using, type\n\
3948
 
'mysqladmin variables' instead of 'mysqld --help'.\n\
3949
 
The default values (after parsing the command line arguments) are:\n\n");
3950
 
 
3951
 
  printf("basedir:     %s\n",mysql_home);
3952
 
  printf("datadir:     %s\n",mysql_real_data_home);
3953
 
  printf("tmpdir:      %s\n",mysql_tmpdir);
3954
 
  printf("language:    %s\n",language);
3955
 
#ifndef __WIN__
3956
 
  printf("pid file:    %s\n",pidfile_name);
3957
 
#endif
3958
 
  if (opt_logname)
3959
 
    printf("logfile:     %s\n",opt_logname);
3960
 
  if (opt_update_logname)
3961
 
    printf("update log:  %s\n",opt_update_logname);
3962
 
  if (opt_bin_log)
3963
 
  {
3964
 
    printf("binary log:  %s\n",opt_bin_logname ? opt_bin_logname : "");
3965
 
    printf("binary log index:  %s\n",
3966
 
           opt_binlog_index_name ? opt_binlog_index_name : "");
3967
 
  }
3968
 
  if (opt_slow_logname)
3969
 
    printf("update log:  %s\n",opt_slow_logname);
3970
 
  printf("TCP port:    %d\n",mysql_port);
3971
 
#if defined(HAVE_SYS_UN_H)
3972
 
  printf("Unix socket: %s\n",mysql_unix_port);
3973
 
#endif
3974
 
  if (my_disable_locking)
3975
 
    puts("\nsystem locking is not in use");
3976
 
  if (opt_noacl)
3977
 
    puts("\nGrant tables are not used. All users have full access rights");
 
3800
'mysqladmin variables' instead of 'mysqld --help'.");
3978
3801
}
3979
3802
 
3980
3803
 
3984
3807
  opt_specialflag |= SPECIAL_NO_PRIOR;
3985
3808
#endif
3986
3809
 
3987
 
  (void) strmake(default_charset, MYSQL_CHARSET, sizeof(default_charset)-1);
 
3810
  sys_charset.value= (char*) MYSQL_CHARSET;
3988
3811
  (void) strmake(language, LANGUAGE, sizeof(language)-1);
3989
3812
  (void) strmake(mysql_real_data_home, get_relative_path(DATADIR),
3990
3813
                 sizeof(mysql_real_data_home-1));
 
3814
 
 
3815
  /* Set default values for some variables */
 
3816
  global_system_variables.table_type=DB_TYPE_MYISAM;
 
3817
  global_system_variables.tx_isolation=ISO_READ_COMMITTED;
 
3818
  global_system_variables.select_limit= (ulong) HA_POS_ERROR;
 
3819
  max_system_variables.select_limit= (ulong) HA_POS_ERROR;
 
3820
  global_system_variables.max_join_size= (ulong) HA_POS_ERROR;
 
3821
  max_system_variables.max_join_size= (ulong) HA_POS_ERROR;
 
3822
 
3991
3823
#ifdef __WIN__
3992
3824
  /* Allow Win32 users to move MySQL anywhere */
3993
3825
  {
4025
3857
    opt_sql_mode = (MODE_REAL_AS_FLOAT | MODE_PIPES_AS_CONCAT |
4026
3858
                    MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_SERIALIZABLE
4027
3859
                    | MODE_ONLY_FULL_GROUP_BY);
4028
 
    default_tx_isolation= ISO_SERIALIZABLE;
 
3860
    global_system_variables.tx_isolation= ISO_SERIALIZABLE;
4029
3861
    break;
4030
3862
  case 'b':
4031
3863
    strmake(mysql_home,argument,sizeof(mysql_home)-1);
4313
4145
    flush_time=0;                       // No auto flush
4314
4146
    break;
4315
4147
  case OPT_LOW_PRIORITY_UPDATES:
4316
 
    thd_startup_options|=OPTION_LOW_PRIORITY_UPDATES;
4317
4148
    thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY;
4318
 
    low_priority_updates=1;
 
4149
    global_system_variables.low_priority_updates=1;
4319
4150
    break;
4320
4151
  case OPT_BOOTSTRAP:
4321
4152
    opt_noacl=opt_bootstrap=1;
4328
4159
      fprintf(stderr,"Unknown table type: %s\n",argument);
4329
4160
      exit(1);
4330
4161
    }
4331
 
    default_table_type= (enum db_type) type;
 
4162
    global_system_variables.table_type= type-1;
4332
4163
    break;
4333
4164
  }
4334
4165
  case OPT_SERVER_ID:
4338
4169
    ha_open_options|=HA_OPEN_DELAY_KEY_WRITE;
4339
4170
    myisam_delay_key_write=1;
4340
4171
    break;
4341
 
  case 'C':
4342
 
    strmake(default_charset, argument, sizeof(default_charset)-1);
4343
 
    break;
4344
4172
  case OPT_CHARSETS_DIR:
4345
4173
    strmake(mysql_charsets_dir, argument, sizeof(mysql_charsets_dir)-1);
4346
4174
    charsets_dir = mysql_charsets_dir;
4361
4189
      fprintf(stderr,"Unknown transaction isolation type: %s\n",argument);
4362
4190
      exit(1);
4363
4191
    }
4364
 
    default_tx_isolation= (enum_tx_isolation) (type-1);
 
4192
    global_system_variables.tx_isolation= (type-1);
4365
4193
    break;
4366
4194
  }
4367
4195
#ifdef HAVE_BERKELEY_DB
4450
4278
      fprintf(stderr, "Unknown option to sql-mode: %s\n", argument);
4451
4279
      exit(1);
4452
4280
    }
4453
 
    default_tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ?
4454
 
                           ISO_SERIALIZABLE :
4455
 
                           ISO_READ_COMMITTED);
 
4281
    global_system_variables.tx_isolation= ((opt_sql_mode & MODE_SERIALIZABLE) ?
 
4282
                                           ISO_SERIALIZABLE :
 
4283
                                           ISO_READ_COMMITTED);
4456
4284
    break;
4457
4285
  }
4458
4286
  case OPT_MASTER_PASSWORD:
4490
4318
  if (mysqld_chroot)
4491
4319
    set_root(mysqld_chroot);
4492
4320
  fix_paths();
4493
 
  default_table_type_name=ha_table_typelib.type_names[default_table_type-1];
4494
 
  default_tx_isolation_name=tx_isolation_typelib.type_names[default_tx_isolation];
4495
 
  /* To be deleted in MySQL 4.0 */
4496
 
  if (!thd->variables.record_rnd_cache_size)
4497
 
    thd->variables.record_rnd_cache_size= my_default_record_cache_size;
4498
4321
 
4499
 
  /* Fix variables that are base 1024*1024 */
 
4322
  /*
 
4323
    Set some global variables from the global_system_variables
 
4324
    In most cases the global variables will not be used
 
4325
  */
 
4326
  my_default_record_cache_size=global_system_variables.read_buff_size;
4500
4327
  myisam_max_temp_length=
4501
 
    (my_off_t) min(((ulonglong)
4502
 
                    thd->variables.myisam_max_sort_file_size)*1024 * 1024,
 
4328
    (my_off_t) min(global_system_variables.myisam_max_sort_file_size,
4503
4329
                   (ulonglong) MAX_FILE_SIZE);
4504
4330
  myisam_max_extra_temp_length= 
4505
 
    (my_off_t) min(((ulonglong)
4506
 
                    thd->variables.myisam_max_extra_sort_file_size)*1024*1024,
 
4331
    (my_off_t) min(global_system_variables.myisam_max_extra_sort_file_size,
4507
4332
                   (ulonglong) MAX_FILE_SIZE);
4508
4333
 
 
4334
  /* Set global variables based on startup options */
4509
4335
  myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
4510
4336
}
4511
4337
 
4548
4374
 
4549
4375
static void fix_paths(void)
4550
4376
{
 
4377
  char buff[FN_REFLEN];
4551
4378
  (void) fn_format(mysql_home,mysql_home,"","",16); // Remove symlinks
4552
4379
  convert_dirname(mysql_home,mysql_home,NullS);
4553
4380
  convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS);
4556
4383
  (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
4557
4384
  (void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
4558
4385
 
4559
 
  char buff[FN_REFLEN],*sharedir=get_relative_path(SHAREDIR);
 
4386
  char *sharedir=get_relative_path(SHAREDIR);
4560
4387
  if (test_if_hard_path(sharedir))
4561
4388
    strmake(buff,sharedir,sizeof(buff)-1);              /* purecov: tested */
4562
4389
  else
4572
4399
    charsets_dir=mysql_charsets_dir;
4573
4400
  }
4574
4401
 
4575
 
  /* Add '/' to TMPDIR if needed */
4576
 
  char *tmp= (char*) my_malloc(FN_REFLEN,MYF(MY_FAE));
4577
 
  if (tmp)
4578
 
  {
4579
 
    char *end=convert_dirname(tmp, mysql_tmpdir, NullS);
4580
 
 
4581
 
    mysql_tmpdir=(char*) my_realloc(tmp,(uint) (end-tmp)+1,
4582
 
                                    MYF(MY_HOLD_ON_ERROR));
4583
 
    allocated_mysql_tmpdir=mysql_tmpdir;
4584
 
  }
 
4402
  char *end=convert_dirname(buff, opt_mysql_tmpdir, NullS);
 
4403
  if (!(mysql_tmpdir= my_memdup(buff,(uint) (end-buff)+1, MYF(MY_FAE))))
 
4404
    exit(1);
4585
4405
  if (!slave_load_tmpdir)
4586
4406
  {
4587
 
    // no need to check return value, if we fail, my_malloc() never returns
4588
 
    slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE));
 
4407
    if (!(slave_load_tmpdir = (char*) my_strdup(mysql_tmpdir, MYF(MY_FAE))))
 
4408
      exit(1);
4589
4409
  }
4590
4410
}
4591
4411
 
4592
4412
 
 
4413
 
4593
4414
#ifdef SET_RLIMIT_NOFILE
4594
4415
static uint set_maximum_open_files(uint max_file_limit)
4595
4416
{