~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/drizzled.cc

  • Committer: Brian Aker
  • Date: 2008-07-14 03:04:13 UTC
  • mfrom: (77.1.90 codestyle)
  • Revision ID: brian@tangent.org-20080714030413-dpv6opb0eoy1rd3f
Merging Monty's code, I did remove error on compile though (since it does
not currently work because of sql_plugin.cc)

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include <drizzled/server_includes.h>
17
 
#include <mysys/my_bit.h>
 
16
#include "mysql_priv.h"
 
17
#include <m_ctype.h>
 
18
#include <my_dir.h>
 
19
#include <my_bit.h>
18
20
#include "slave.h"
19
21
#include "rpl_mi.h"
20
22
#include "sql_repl.h"
21
23
#include "rpl_filter.h"
 
24
#include "repl_failsafe.h"
22
25
#include "stacktrace.h"
23
 
#include <mysys/mysys_err.h>
24
 
#include <sys/poll.h>
25
 
#include <netinet/tcp.h>
26
 
#include <drizzled/drizzled_error_messages.h>
27
 
 
28
 
#if TIME_WITH_SYS_TIME
29
 
# include <sys/time.h>
30
 
# include <time.h>
31
 
#else
32
 
# if HAVE_SYS_TIME_H
33
 
#  include <sys/time.h>
34
 
# else
35
 
#  include <time.h>
36
 
# endif
37
 
#endif
38
 
 
39
 
#include <storage/myisam/ha_myisam.h>
 
26
#include "mysqld_suffix.h"
 
27
#include "mysys_err.h"
 
28
 
 
29
#include "../storage/myisam/ha_myisam.h"
40
30
 
41
31
#ifdef HAVE_SYS_PRCTL_H
42
32
#include <sys/prctl.h>
46
36
#define DEFAULT_SKIP_THREAD_PRIORITY 0
47
37
#endif
48
38
 
49
 
#include <mysys/thr_alarm.h>
50
 
#include <libdrizzle/errmsg.h>
51
 
#include <locale.h>
 
39
#include <thr_alarm.h>
 
40
#include <errmsg.h>
52
41
 
53
 
#define mysqld_charset &my_charset_utf8_general_ci
 
42
#define mysqld_charset &my_charset_latin1
54
43
 
55
44
#ifdef HAVE_purify
56
45
#define IF_PURIFY(A,B) (A)
58
47
#define IF_PURIFY(A,B) (B)
59
48
#endif
60
49
 
61
 
#define MAX_MEM_TABLE_SIZE SIZE_MAX
 
50
#if SIZEOF_CHARP == 4
 
51
#define MAX_MEM_TABLE_SIZE ~(ulong) 0
 
52
#else
 
53
#define MAX_MEM_TABLE_SIZE ~(uint64_t) 0
 
54
#endif
62
55
 
63
56
/* We have HAVE_purify below as this speeds up the shutdown of MySQL */
64
57
 
72
65
#ifndef __GNU_LIBRARY__
73
66
#define __GNU_LIBRARY__                         // Skip warnings in getopt.h
74
67
#endif
75
 
#include <mysys/my_getopt.h>
 
68
#include <my_getopt.h>
76
69
#ifdef HAVE_SYSENT_H
77
70
#include <sysent.h>
78
71
#endif
82
75
#ifdef HAVE_GRP_H
83
76
#include <grp.h>
84
77
#endif
 
78
#include <my_net.h>
85
79
 
86
80
#include <sys/resource.h>
87
81
 
100
94
#endif
101
95
 
102
96
#define SIGNAL_FMT "signal %d"
103
 
 
 
97
  
104
98
 
105
99
#if defined(__FreeBSD__) && defined(HAVE_IEEEFP_H)
106
100
#include <ieeefp.h>
149
143
 
150
144
} /* cplusplus */
151
145
 
152
 
#define DRIZZLE_KILL_SIGNAL SIGTERM
153
 
 
154
 
#include <mysys/my_pthread.h>                   // For thr_setconcurency()
155
 
 
156
 
#include <libdrizzle/gettext.h>
 
146
#define MYSQL_KILL_SIGNAL SIGTERM
 
147
 
 
148
#include <my_pthread.h>                 // For thr_setconcurency()
157
149
 
158
150
#ifdef SOLARIS
159
151
extern "C" int gethostname(char *name, int namelen);
160
152
#endif
161
153
 
162
 
extern "C" RETSIGTYPE handle_segfault(int sig);
 
154
extern "C" sig_handler handle_segfault(int sig);
163
155
 
164
156
/* Constants */
165
157
 
172
164
static const char *optimizer_switch_names[]=
173
165
{
174
166
  "no_materialization", "no_semijoin",
175
 
  NULL
 
167
  NullS
176
168
};
177
169
 
178
170
/* Corresponding defines are named OPTIMIZER_SWITCH_XXX */
188
180
 
189
181
static const char *tc_heuristic_recover_names[]=
190
182
{
191
 
  "COMMIT", "ROLLBACK", NULL
 
183
  "COMMIT", "ROLLBACK", NullS
192
184
};
193
185
static TYPELIB tc_heuristic_recover_typelib=
194
186
{
207
199
/*
208
200
  Used with --help for detailed option
209
201
*/
210
 
static bool opt_help= false;
 
202
static bool opt_help= 0, opt_verbose= 0;
211
203
 
212
204
arg_cmp_func Arg_comparator::comparator_matrix[5][2] =
213
205
{{&Arg_comparator::compare_string,     &Arg_comparator::compare_e_string},
216
208
 {&Arg_comparator::compare_row,        &Arg_comparator::compare_e_row},
217
209
 {&Arg_comparator::compare_decimal,    &Arg_comparator::compare_e_decimal}};
218
210
 
219
 
const char *log_output_names[] = { "NONE", "FILE", NULL};
220
 
static const unsigned int log_output_names_len[]= { 4, 4, 0 };
 
211
const char *log_output_names[] = { "NONE", "FILE", "TABLE", NullS};
 
212
static const unsigned int log_output_names_len[]= { 4, 4, 5, 0 };
221
213
TYPELIB log_output_typelib= {array_elements(log_output_names)-1,"",
222
 
                             log_output_names,
 
214
                             log_output_names, 
223
215
                             (unsigned int *) log_output_names_len};
224
216
 
225
217
/* static variables */
226
218
 
227
219
/* the default log output is log tables */
 
220
static bool lower_case_table_names_used= 0;
228
221
static bool volatile select_thread_in_use, signal_thread_in_use;
229
222
static bool volatile ready_to_exit;
230
 
static bool opt_debugging= 0, opt_console= 0;
231
 
static uint32_t kill_cached_threads, wake_thread;
232
 
static uint32_t killed_threads, thread_created;
233
 
static uint32_t max_used_connections;
234
 
static volatile uint32_t cached_thread_count= 0;
 
223
static bool opt_debugging= 0, opt_external_locking= 0, opt_console= 0;
 
224
static bool opt_short_log_format= 0;
 
225
static uint kill_cached_threads, wake_thread;
 
226
static ulong killed_threads, thread_created;
 
227
static ulong max_used_connections;
 
228
static volatile ulong cached_thread_count= 0;
235
229
static char *mysqld_user, *mysqld_chroot, *log_error_file_ptr;
236
230
static char *opt_init_slave, *language_ptr, *opt_init_connect;
237
231
static char *default_character_set_name;
238
232
static char *character_set_filesystem_name;
239
233
static char *lc_time_names_name;
240
234
static char *my_bind_addr_str;
241
 
static char *default_collation_name;
 
235
static char *default_collation_name; 
242
236
static char *default_storage_engine_str;
243
 
static char compiled_default_collation_name[]= DRIZZLE_DEFAULT_COLLATION_NAME;
 
237
static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME;
244
238
static I_List<THD> thread_cache;
245
239
static double long_query_time;
246
240
 
249
243
/* Global variables */
250
244
 
251
245
bool opt_bin_log;
 
246
bool opt_log; 
 
247
bool opt_slow_log;
252
248
ulong log_output_options;
253
249
bool opt_log_queries_not_using_indexes= false;
254
 
bool opt_error_log= 0;
 
250
bool opt_error_log= IF_WIN(1,0);
 
251
bool opt_disable_networking= false;
255
252
bool opt_skip_show_db= false;
256
253
bool opt_character_set_client_handshake= 1;
257
254
bool server_id_supplied = 0;
268
265
bool opt_safe_user_create = 0;
269
266
bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
270
267
bool opt_log_slave_updates= 0;
271
 
static struct pollfd fds[UINT8_MAX];
272
 
static uint8_t pollfd_count= 0;
273
268
 
274
269
/*
275
270
  Legacy global handlerton. These will be removed (please do not add more).
280
275
bool opt_readonly;
281
276
bool use_temp_pool;
282
277
bool relay_log_purge;
 
278
bool opt_sync_frm;
 
279
bool opt_secure_auth= false;
283
280
char* opt_secure_file_priv= 0;
 
281
bool opt_log_slow_admin_statements= 0;
 
282
bool opt_log_slow_slave_statements= 0;
 
283
bool lower_case_file_system= 0;
 
284
bool opt_old_style_user_limits= 0;
 
285
bool trust_function_creators= 0;
284
286
/*
285
287
  True if there is at least one per-hour limit for some user, so we should
286
288
  check them before each query (and possibly reset counters when hour is
287
289
  changed). False otherwise.
288
290
*/
 
291
volatile bool mqh_used = 0;
289
292
bool opt_noacl;
290
293
 
291
294
ulong opt_binlog_rows_event_max_size;
292
 
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NULL};
 
295
const char *binlog_format_names[]= {"MIXED", "STATEMENT", "ROW", NullS};
293
296
TYPELIB binlog_format_typelib=
294
297
  { array_elements(binlog_format_names) - 1, "",
295
298
    binlog_format_names, NULL };
296
 
uint32_t opt_binlog_format_id= (uint32_t) BINLOG_FORMAT_UNSPEC;
 
299
ulong opt_binlog_format_id= (ulong) BINLOG_FORMAT_UNSPEC;
297
300
const char *opt_binlog_format= binlog_format_names[opt_binlog_format_id];
298
301
#ifdef HAVE_INITGROUPS
299
 
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
 
302
static bool calling_initgroups= FALSE; /**< Used in SIGSEGV handler. */
300
303
#endif
301
 
uint32_t mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
302
 
uint32_t mysqld_port_timeout;
303
 
uint32_t delay_key_write_options, protocol_version;
304
 
uint32_t lower_case_table_names= 1;
305
 
uint32_t tc_heuristic_recover= 0;
306
 
uint32_t volatile thread_count, thread_running;
 
304
uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options;
 
305
uint mysqld_port_timeout;
 
306
uint delay_key_write_options, protocol_version;
 
307
uint lower_case_table_names;
 
308
uint tc_heuristic_recover= 0;
 
309
uint volatile thread_count, thread_running;
307
310
uint64_t thd_startup_options;
308
311
ulong back_log, connect_timeout, server_id;
309
312
ulong table_cache_size, table_def_size;
310
313
ulong what_to_log;
311
 
ulong slow_launch_time, slave_open_temp_tables;
312
 
ulong open_files_limit;
313
 
ulong max_binlog_size;
314
 
ulong max_relay_log_size;
315
 
ulong slave_net_timeout;
316
 
ulong slave_trans_retries;
 
314
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
 
315
ulong open_files_limit, max_binlog_size, max_relay_log_size;
 
316
ulong slave_net_timeout, slave_trans_retries;
317
317
bool slave_allow_batching;
318
318
ulong slave_exec_mode_options;
319
319
const char *slave_exec_mode_str= "STRICT";
320
 
ulong thread_cache_size= 0;
321
 
ulong thread_pool_size= 0;
322
 
ulong binlog_cache_size= 0;
323
 
ulong max_binlog_cache_size= 0;
324
 
uint32_t refresh_version;  /* Increments on each reload */
 
320
ulong thread_cache_size=0, thread_pool_size= 0;
 
321
ulong binlog_cache_size=0, max_binlog_cache_size=0;
 
322
ulong refresh_version;  /* Increments on each reload */
325
323
query_id_t global_query_id;
326
 
ulong aborted_threads;
327
 
ulong aborted_connects;
328
 
ulong specialflag= 0;
329
 
ulong binlog_cache_use= 0;
330
 
ulong binlog_cache_disk_use= 0;
331
 
ulong max_connections;
332
 
ulong max_connect_errors;
333
 
uint32_t  max_user_connections= 0;
334
 
ulong thread_id=1L;
335
 
ulong current_pid;
336
 
ulong slow_launch_threads = 0;
337
 
ulong sync_binlog_period;
 
324
ulong aborted_threads, aborted_connects;
 
325
ulong flush_time;
 
326
ulong specialflag=0;
 
327
ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
 
328
ulong max_connections, max_connect_errors;
 
329
uint  max_user_connections= 0;
 
330
ulong thread_id=1L,current_pid;
 
331
ulong slow_launch_threads = 0, sync_binlog_period;
338
332
ulong expire_logs_days = 0;
339
333
ulong rpl_recovery_rank=0;
340
334
const char *log_output_str= "FILE";
382
376
     language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
383
377
     *opt_init_file, *opt_tc_log_file;
384
378
char mysql_unpacked_real_data_home[FN_REFLEN];
385
 
uint32_t reg_ext_length;
 
379
uint reg_ext_length;
386
380
const key_map key_map_empty(0);
387
381
key_map key_map_full(0);                        // Will be initialized later
388
382
 
389
383
const char *opt_date_time_formats[3];
390
384
 
391
 
uint32_t mysql_data_home_len;
 
385
uint mysql_data_home_len;
392
386
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
393
387
char server_version[SERVER_VERSION_LENGTH];
394
388
char *opt_mysql_tmpdir;
 
389
const char **errmesg;                   /**< Error messages */
395
390
const char *myisam_recover_options_str="OFF";
396
391
const char *myisam_stats_method_str="nulls_unequal";
397
392
 
410
405
Ge_creator ge_creator;
411
406
Le_creator le_creator;
412
407
 
 
408
FILE *bootstrap_file;
 
409
int bootstrap_error;
413
410
FILE *stderror_file=0;
414
411
 
415
412
I_List<THD> threads;
424
421
MY_TMPDIR mysql_tmpdir_list;
425
422
MY_BITMAP temp_pool;
426
423
 
427
 
const CHARSET_INFO *system_charset_info, *files_charset_info ;
428
 
const CHARSET_INFO *national_charset_info, *table_alias_charset;
429
 
const CHARSET_INFO *character_set_filesystem;
 
424
CHARSET_INFO *system_charset_info, *files_charset_info ;
 
425
CHARSET_INFO *national_charset_info, *table_alias_charset;
 
426
CHARSET_INFO *character_set_filesystem;
430
427
 
431
428
MY_LOCALE *my_default_lc_time_names;
432
429
 
433
 
SHOW_COMP_OPTION have_symlink;
434
 
SHOW_COMP_OPTION have_compress;
 
430
SHOW_COMP_OPTION have_symlink, have_dlopen;
 
431
SHOW_COMP_OPTION have_crypt, have_compress;
435
432
 
436
433
/* Thread specific variables */
437
434
 
438
435
pthread_key(MEM_ROOT**,THR_MALLOC);
439
436
pthread_key(THD*, THR_THD);
440
437
pthread_mutex_t LOCK_mysql_create_db, LOCK_open, LOCK_thread_count,
441
 
                LOCK_status, LOCK_global_read_lock,
 
438
                LOCK_mapped_file, LOCK_status, LOCK_global_read_lock,
442
439
                LOCK_error_log, LOCK_uuid_generator,
 
440
                LOCK_crypt,
443
441
                LOCK_global_system_variables,
444
442
                LOCK_user_conn, LOCK_slave_list, LOCK_active_mi,
445
443
                LOCK_connection_count;
452
450
pthread_cond_t  COND_server_started;
453
451
 
454
452
/* replication parameters, if master_host is not NULL, we are a slave */
455
 
uint32_t report_port= DRIZZLE_PORT;
 
453
uint report_port= MYSQL_PORT;
456
454
uint32_t master_retry_count= 0;
457
455
char *master_info_file;
458
456
char *relay_log_info_file, *report_user, *report_password, *report_host;
459
457
char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
460
 
char *opt_logname;
 
458
char *opt_logname, *opt_slow_logname;
461
459
 
462
460
/* Static variables */
463
461
 
465
463
#ifdef HAVE_STACK_TRACE_ON_SEGV
466
464
static bool opt_do_pstack;
467
465
#endif /* HAVE_STACK_TRACE_ON_SEGV */
 
466
static bool opt_bootstrap, opt_myisam_log;
468
467
static int cleanup_done;
469
 
static uint32_t opt_myisam_block_size;
 
468
static ulong opt_specialflag, opt_myisam_block_size;
470
469
static char *opt_binlog_index_name;
471
470
static char *opt_tc_heuristic_recover;
472
471
static char *mysql_home_ptr, *pidfile_name_ptr;
474
473
static char **defaults_argv;
475
474
static char *opt_bin_logname;
476
475
 
 
476
static my_socket ip_sock;
477
477
struct rand_struct sql_rand; ///< used by sql_class.cc:THD::THD()
478
478
 
479
479
struct passwd *user_info;
480
480
static pthread_t select_thread;
481
 
static uint32_t thr_kill_signal;
 
481
static uint thr_kill_signal;
482
482
 
483
483
/* OS specific variables */
484
484
 
490
490
  Number of currently active user connections. The variable is protected by
491
491
  LOCK_connection_count.
492
492
*/
493
 
uint32_t connection_count= 0;
 
493
uint connection_count= 0;
494
494
 
495
495
/* Function declarations */
496
496
 
505
505
void handle_connections_sockets();
506
506
pthread_handler_t kill_server_thread(void *arg);
507
507
pthread_handler_t handle_slave(void *arg);
508
 
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib);
509
 
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
 
508
static ulong find_bit_type(const char *x, TYPELIB *bit_lib);
 
509
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
510
510
                                   const char *option);
511
511
static void clean_up(bool print_message);
 
512
static int test_if_case_insensitive(const char *dir_name);
512
513
 
513
514
static void usage(void);
514
515
static void start_signal_handler(void);
532
533
  kill_cached_threads++;
533
534
  flush_thread_cache();
534
535
 
 
536
  /* kill flush thread */
 
537
  (void) pthread_mutex_lock(&LOCK_manager);
 
538
  if (manager_thread_in_use)
 
539
  {
 
540
   (void) pthread_cond_signal(&COND_manager);
 
541
  }
 
542
  (void) pthread_mutex_unlock(&LOCK_manager);
 
543
 
535
544
  /* kill connection thread */
536
545
  (void) pthread_mutex_lock(&LOCK_thread_count);
537
546
 
545
554
      break;                                    // allready dead
546
555
#endif
547
556
    set_timespec(abstime, 2);
548
 
    for (uint32_t tmp=0 ; tmp < 10 && select_thread_in_use; tmp++)
 
557
    for (uint tmp=0 ; tmp < 10 && select_thread_in_use; tmp++)
549
558
    {
550
559
      error=pthread_cond_timedwait(&COND_thread_count,&LOCK_thread_count,
551
560
                                   &abstime);
554
563
    }
555
564
#ifdef EXTRA_DEBUG
556
565
    if (error != 0 && !count++)
557
 
      sql_print_error(_("Got error %d from pthread_cond_timedwait"),error);
 
566
      sql_print_error("Got error %d from pthread_cond_timedwait",error);
558
567
#endif
559
568
    close_server_sock();
560
569
  }
562
571
 
563
572
 
564
573
  /* Abort listening to new connections */
 
574
  if (!opt_disable_networking )
565
575
  {
566
 
    int x;
567
 
 
568
 
    for (x= 0; x < pollfd_count; x++)
 
576
    if (ip_sock != INVALID_SOCKET)
569
577
    {
570
 
      if (fds[x].fd != -1)
571
 
      {
572
 
        (void) shutdown(fds[x].fd, SHUT_RDWR);
573
 
        (void) close(fds[x].fd);
574
 
        fds[x].fd= -1;
575
 
      }
 
578
      (void) shutdown(ip_sock, SHUT_RDWR);
 
579
      (void) closesocket(ip_sock);
 
580
      ip_sock= INVALID_SOCKET;
576
581
    }
577
582
  }
578
 
 
579
583
  end_thr_alarm(0);                      // Abort old alarms.
580
584
 
581
585
  /*
656
660
static void close_server_sock()
657
661
{
658
662
#ifdef HAVE_CLOSE_SERVER_SOCK
 
663
  my_socket tmp_sock;
 
664
  tmp_sock=ip_sock;
 
665
  if (tmp_sock != INVALID_SOCKET)
659
666
  {
660
 
    int x;
661
 
 
662
 
    for (x= 0; x < pollfd_count; x++)
663
 
    {
664
 
      if (fds[x].fd != -1)
665
 
      {
666
 
        (void) shutdown(fds[x].fd, SHUT_RDWR);
667
 
        (void) close(fds[x].fd);
668
 
        fds[x].fd= -1;
669
 
      }
670
 
    }
 
667
    ip_sock=INVALID_SOCKET;
 
668
    VOID(shutdown(tmp_sock, SHUT_RDWR));
671
669
  }
 
670
  return;;
672
671
#endif
673
672
}
674
673
 
682
681
#endif
683
682
 
684
683
#if defined(HAVE_PTHREAD_KILL)
685
 
  pthread_kill(signal_thread, DRIZZLE_KILL_SIGNAL);
 
684
  pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
686
685
#elif !defined(SIGNALS_DONT_BREAK_READ)
687
 
  kill(current_pid, DRIZZLE_KILL_SIGNAL);
 
686
  kill(current_pid, MYSQL_KILL_SIGNAL);
688
687
#endif
689
688
  shutdown_in_progress=1;                       // Safety if kill didn't work
690
689
#ifdef SIGNALS_DONT_BREAK_READ
694
693
    abort_loop=1;
695
694
    if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
696
695
                           (void*) 0))
697
 
      sql_print_error(_("Can't create thread to kill server"));
 
696
      sql_print_error("Can't create thread to kill server");
698
697
  }
699
698
#endif
700
699
  return;;
718
717
  // if there is a signal during the kill in progress, ignore the other
719
718
  if (kill_in_progress)                         // Safety
720
719
    RETURN_FROM_KILL_SERVER;
721
 
  kill_in_progress=true;
 
720
  kill_in_progress=TRUE;
722
721
  abort_loop=1;                                 // This should be set
723
722
  if (sig != 0) // 0 is not a valid signal number
724
723
    my_sigset(sig, SIG_IGN);                    /* purify inspected */
725
 
  if (sig == DRIZZLE_KILL_SIGNAL || sig == 0)
726
 
    sql_print_information(_(ER(ER_NORMAL_SHUTDOWN)),my_progname);
 
724
  if (sig == MYSQL_KILL_SIGNAL || sig == 0)
 
725
    sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname);
727
726
  else
728
 
    sql_print_error(_(ER(ER_GOT_SIGNAL)),my_progname,sig); /* purecov: inspected */
729
 
 
 
727
    sql_print_error(ER(ER_GOT_SIGNAL),my_progname,sig); /* purecov: inspected */
 
728
  
730
729
  close_connections();
731
 
  if (sig != DRIZZLE_KILL_SIGNAL &&
 
730
  if (sig != MYSQL_KILL_SIGNAL &&
732
731
      sig != 0)
733
732
    unireg_abort(1);                            /* purecov: inspected */
734
733
  else
758
757
#endif
759
758
 
760
759
 
761
 
extern "C" RETSIGTYPE print_signal_warning(int sig)
 
760
extern "C" sig_handler print_signal_warning(int sig)
762
761
{
763
762
  if (global_system_variables.log_warnings)
764
 
    sql_print_warning(_("Got signal %d from thread %lud"), sig,my_thread_id());
765
 
#ifndef HAVE_BSD_SIGNALS
 
763
    sql_print_warning("Got signal %d from thread %ld", sig,my_thread_id());
 
764
#ifdef DONT_REMEMBER_SIGNAL
766
765
  my_sigset(sig,print_signal_warning);          /* int. thread system calls */
767
766
#endif
768
767
  if (sig == SIGALRM)
795
794
{
796
795
 
797
796
  if (exit_code)
798
 
    sql_print_error(_("Aborting\n"));
 
797
    sql_print_error("Aborting\n");
799
798
  else if (opt_help)
800
799
    usage();
801
 
  clean_up(!opt_help && (exit_code)); /* purecov: inspected */
 
800
  clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
802
801
  mysqld_exit(exit_code);
803
802
}
804
803
 
817
816
  if (cleanup_done++)
818
817
    return; /* purecov: inspected */
819
818
 
 
819
  /*
 
820
    make sure that handlers finish up
 
821
    what they have that is dependent on the binlog
 
822
  */
 
823
  ha_binlog_end(current_thd);
 
824
 
820
825
  logger.cleanup_base();
821
826
 
822
827
  mysql_bin_log.cleanup();
836
841
  if (tc_log)
837
842
    tc_log->close();
838
843
  xid_cache_free();
839
 
  delete_elements(&key_caches, (void (*)(const char*, unsigned char*)) free_key_cache);
 
844
  delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache);
840
845
  multi_keycache_free();
841
846
  free_status_vars();
842
847
  end_thr_alarm(1);                     /* Free allocated memory */
843
848
  my_free_open_file_info();
844
 
  free((char*) global_system_variables.date_format);
845
 
  free((char*) global_system_variables.time_format);
846
 
  free((char*) global_system_variables.datetime_format);
 
849
  my_free((char*) global_system_variables.date_format,
 
850
          MYF(MY_ALLOW_ZERO_PTR));
 
851
  my_free((char*) global_system_variables.time_format,
 
852
          MYF(MY_ALLOW_ZERO_PTR));
 
853
  my_free((char*) global_system_variables.datetime_format,
 
854
          MYF(MY_ALLOW_ZERO_PTR));
847
855
  if (defaults_argv)
848
856
    free_defaults(defaults_argv);
849
 
  free(sys_init_connect.value);
850
 
  free(sys_init_slave.value);
 
857
  my_free(sys_init_connect.value, MYF(MY_ALLOW_ZERO_PTR));
 
858
  my_free(sys_init_slave.value, MYF(MY_ALLOW_ZERO_PTR));
 
859
  my_free(sys_var_general_log_path.value, MYF(MY_ALLOW_ZERO_PTR));
 
860
  my_free(sys_var_slow_log_path.value, MYF(MY_ALLOW_ZERO_PTR));
851
861
  free_tmpdir(&mysql_tmpdir_list);
852
 
  free(slave_load_tmpdir);
853
 
  if (opt_bin_logname)
854
 
    free(opt_bin_logname);
855
 
  if (opt_relay_logname)
856
 
    free(opt_relay_logname);
857
 
  if (opt_secure_file_priv)
858
 
    free(opt_secure_file_priv);
 
862
  my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
 
863
  x_free(opt_bin_logname);
 
864
  x_free(opt_relay_logname);
 
865
  x_free(opt_secure_file_priv);
859
866
  bitmap_free(&temp_pool);
 
867
  end_slave_list();
860
868
  delete binlog_filter;
861
869
  delete rpl_filter;
862
 
 
863
 
  (void) my_delete(pidfile_name,MYF(0));        // This may not always exist
864
 
 
865
 
  if (print_message && server_start_time)
866
 
    sql_print_information(_(ER(ER_SHUTDOWN_COMPLETE)),my_progname);
 
870
  vio_end();
 
871
 
 
872
  if (!opt_bootstrap)
 
873
    (void) my_delete(pidfile_name,MYF(0));      // This may not always exist
 
874
  if (print_message && errmesg && server_start_time)
 
875
    sql_print_information(ER(ER_SHUTDOWN_COMPLETE),my_progname);
867
876
  thread_scheduler.end();
868
 
  /* Returns NULL on globerrs, we don't want to try to free that */
869
 
  //void *freeme=
870
 
  (void *)my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST);
871
 
  // TODO!!!! EPIC FAIL!!!! This sefaults if uncommented.
872
 
/*  if (freeme != NULL)
873
 
    free(freeme);  */
 
877
  finish_client_errs();
 
878
  my_free((uchar*) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
 
879
          MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
874
880
  /* Tell main we are ready */
875
881
  logger.cleanup_end();
876
882
  (void) pthread_mutex_lock(&LOCK_thread_count);
892
898
*/
893
899
static void wait_for_signal_thread_to_end()
894
900
{
895
 
  uint32_t i;
 
901
  uint i;
896
902
  /*
897
903
    Wait up to 10 seconds for signal thread to die. We use this mainly to
898
904
    avoid getting warnings that my_thread_end has not been called
899
905
  */
900
906
  for (i= 0 ; i < 100 && signal_thread_in_use; i++)
901
907
  {
902
 
    if (pthread_kill(signal_thread, DRIZZLE_KILL_SIGNAL) != ESRCH)
 
908
    if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL) != ESRCH)
903
909
      break;
904
910
    my_sleep(100);                              // Give it time to die
905
911
  }
912
918
  (void) pthread_mutex_destroy(&LOCK_lock_db);
913
919
  (void) pthread_mutex_destroy(&LOCK_open);
914
920
  (void) pthread_mutex_destroy(&LOCK_thread_count);
 
921
  (void) pthread_mutex_destroy(&LOCK_mapped_file);
915
922
  (void) pthread_mutex_destroy(&LOCK_status);
916
923
  (void) pthread_mutex_destroy(&LOCK_error_log);
 
924
  (void) pthread_mutex_destroy(&LOCK_manager);
 
925
  (void) pthread_mutex_destroy(&LOCK_crypt);
917
926
  (void) pthread_mutex_destroy(&LOCK_user_conn);
918
927
  (void) pthread_mutex_destroy(&LOCK_connection_count);
 
928
  (void) pthread_mutex_destroy(&LOCK_rpl_status);
 
929
  (void) pthread_cond_destroy(&COND_rpl_status);
919
930
  (void) pthread_mutex_destroy(&LOCK_active_mi);
920
931
  (void) rwlock_destroy(&LOCK_sys_init_connect);
921
932
  (void) rwlock_destroy(&LOCK_sys_init_slave);
928
939
  (void) pthread_cond_destroy(&COND_global_read_lock);
929
940
  (void) pthread_cond_destroy(&COND_thread_cache);
930
941
  (void) pthread_cond_destroy(&COND_flush_thread_cache);
 
942
  (void) pthread_cond_destroy(&COND_manager);
931
943
}
932
944
 
933
945
 
938
950
static void set_ports()
939
951
{
940
952
  char  *env;
941
 
  if (!mysqld_port)
 
953
  if (!mysqld_port && !opt_disable_networking)
942
954
  {                                     // Get port if not from commandline
943
 
    mysqld_port= DRIZZLE_PORT;
 
955
    mysqld_port= MYSQL_PORT;
944
956
 
945
957
    /*
946
958
      if builder specifically requested a default port, use that
947
959
      (even if it coincides with our factory default).
948
960
      only if they didn't do we check /etc/services (and, failing
949
 
      on that, fall back to the factory default of 4427).
 
961
      on that, fall back to the factory default of 3306).
950
962
      either default can be overridden by the environment variable
951
 
      DRIZZLE_TCP_PORT, which in turn can be overridden with command
 
963
      MYSQL_TCP_PORT, which in turn can be overridden with command
952
964
      line options.
953
965
    */
954
966
 
 
967
#if MYSQL_PORT_DEFAULT == 0
955
968
    struct  servent *serv_ptr;
956
 
    if ((serv_ptr= getservbyname("drizzle", "tcp")))
 
969
    if ((serv_ptr= getservbyname("mysql", "tcp")))
957
970
      mysqld_port= ntohs((u_short) serv_ptr->s_port); /* purecov: inspected */
958
 
 
959
 
    if ((env = getenv("DRIZZLE_TCP_PORT")))
 
971
#endif
 
972
    if ((env = getenv("MYSQL_TCP_PORT")))
960
973
      mysqld_port= (uint) atoi(env);            /* purecov: inspected */
961
 
 
962
 
    assert(mysqld_port);
963
974
  }
964
975
}
965
976
 
979
990
      /* purecov: begin tested */
980
991
      tmp_user_info= getpwnam(user);
981
992
      if ((!tmp_user_info || user_id != tmp_user_info->pw_uid) &&
982
 
          global_system_variables.log_warnings)
983
 
        sql_print_warning(_("One can only use the --user switch "
984
 
                            "if running as root\n"));
 
993
          global_system_variables.log_warnings)
 
994
        sql_print_warning(
 
995
                    "One can only use the --user switch if running as root\n");
985
996
      /* purecov: end */
986
997
    }
987
998
    return NULL;
988
999
  }
989
1000
  if (!user)
990
1001
  {
991
 
    sql_print_error(_("Fatal error: Please read \"Security\" section of "
992
 
                      "the manual to find out how to run mysqld as root!\n"));
993
 
    unireg_abort(1);
994
 
 
 
1002
    if (!opt_bootstrap)
 
1003
    {
 
1004
      sql_print_error("Fatal error: Please read \"Security\" section of the manual to find out how to run mysqld as root!\n");
 
1005
      unireg_abort(1);
 
1006
    }
995
1007
    return NULL;
996
1008
  }
997
1009
  /* purecov: begin tested */
1012
1024
  /* purecov: end */
1013
1025
 
1014
1026
err:
1015
 
  sql_print_error(_("Fatal error: Can't change to run as user '%s' ;  "
1016
 
                    "Please check that the user exists!\n"),user);
 
1027
  sql_print_error("Fatal error: Can't change to run as user '%s' ;  Please check that the user exists!\n",user);
1017
1028
  unireg_abort(1);
1018
1029
 
1019
1030
#ifdef PR_SET_DUMPABLE
1038
1049
    calling_initgroups as a flag to the SIGSEGV handler that is then used to
1039
1050
    output a specific message to help the user resolve this problem.
1040
1051
  */
1041
 
  calling_initgroups= true;
 
1052
  calling_initgroups= TRUE;
1042
1053
  initgroups((char*) user, user_info_arg->pw_gid);
1043
 
  calling_initgroups= false;
 
1054
  calling_initgroups= FALSE;
1044
1055
#endif
1045
1056
  if (setgid(user_info_arg->pw_gid) == -1)
1046
1057
  {
1086
1097
 
1087
1098
static void network_init(void)
1088
1099
{
 
1100
  int   arg;
1089
1101
  int   ret;
1090
 
  uint32_t  waited;
1091
 
  uint32_t  this_wait;
1092
 
  uint32_t  retry;
 
1102
  uint  waited;
 
1103
  uint  this_wait;
 
1104
  uint  retry;
1093
1105
  char port_buf[NI_MAXSERV];
1094
 
  struct addrinfo *ai;
1095
 
  struct addrinfo *next;
1096
 
  struct addrinfo hints;
1097
 
  int error;
1098
1106
 
1099
1107
  if (thread_scheduler.init())
1100
1108
    unireg_abort(1);                    /* purecov: inspected */
1101
1109
 
1102
1110
  set_ports();
1103
1111
 
1104
 
  memset(fds, 0, sizeof(struct pollfd) * UINT8_MAX);
1105
 
  memset(&hints, 0, sizeof (hints));
1106
 
  hints.ai_flags= AI_PASSIVE;
1107
 
  hints.ai_socktype= SOCK_STREAM;
1108
 
 
1109
 
  snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port);
1110
 
  error= getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai);
1111
 
  if (error != 0)
1112
 
  {
1113
 
    sql_perror(ER(ER_IPSOCK_ERROR));            /* purecov: tested */
1114
 
    unireg_abort(1);                            /* purecov: tested */
1115
 
  }
1116
 
 
1117
 
  for (next= ai, pollfd_count= 0; next; next= next->ai_next, pollfd_count++)
1118
 
  {
1119
 
    int ip_sock;
1120
 
 
1121
 
    ip_sock= socket(next->ai_family, next->ai_socktype, next->ai_protocol);
1122
 
 
1123
 
    if (ip_sock == -1)
1124
 
    {
1125
 
      sql_perror(ER(ER_IPSOCK_ERROR));          /* purecov: tested */
1126
 
      unireg_abort(1);                          /* purecov: tested */
1127
 
    }
1128
 
 
1129
 
    fds[pollfd_count].fd= ip_sock;
1130
 
    fds[pollfd_count].events= POLLIN | POLLERR;
1131
 
 
1132
 
    /* Add options for our listening socket */
1133
 
    {
1134
 
      int error;
1135
 
      struct linger ling = {0, 0};
1136
 
      int flags =1;
 
1112
  if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap)
 
1113
  {
 
1114
    struct addrinfo *ai;
 
1115
    struct addrinfo hints;
 
1116
    int error;
 
1117
 
 
1118
    bzero(&hints, sizeof (hints));
 
1119
    hints.ai_flags= AI_PASSIVE;
 
1120
    hints.ai_socktype= SOCK_STREAM;
 
1121
    hints.ai_family= AF_UNSPEC;
 
1122
 
 
1123
    snprintf(port_buf, NI_MAXSERV, "%d", mysqld_port);
 
1124
    error= getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai);
 
1125
    if (error != 0)
 
1126
    {
 
1127
      sql_perror(ER(ER_IPSOCK_ERROR));          /* purecov: tested */
 
1128
      unireg_abort(1);                          /* purecov: tested */
 
1129
    }
 
1130
 
 
1131
 
 
1132
    ip_sock= socket(ai->ai_family, ai->ai_socktype,
 
1133
                    ai->ai_protocol);
 
1134
 
 
1135
    if (ip_sock == INVALID_SOCKET)
 
1136
    {
 
1137
      sql_perror(ER(ER_IPSOCK_ERROR));          /* purecov: tested */
 
1138
      unireg_abort(1);                          /* purecov: tested */
 
1139
    }
 
1140
 
 
1141
    /*
 
1142
      We should not use SO_REUSEADDR on windows as this would enable a
 
1143
      user to open two mysqld servers with the same TCP/IP port.
 
1144
    */
 
1145
    arg= 1;
 
1146
    (void) setsockopt(ip_sock,SOL_SOCKET,SO_REUSEADDR,(char*)&arg,sizeof(arg));
1137
1147
 
1138
1148
#ifdef IPV6_V6ONLY
1139
 
      if (next->ai_family == AF_INET6) 
1140
 
      {
1141
 
        error= setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &flags, sizeof(flags));
1142
 
        if (error != 0)
1143
 
        {
1144
 
          perror("setsockopt");
1145
 
          assert(error == 0);
1146
 
        }
1147
 
      }
1148
 
#endif   
1149
 
      error= setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&flags, sizeof(flags));
1150
 
      if (error != 0)
1151
 
      {
1152
 
        perror("setsockopt");
1153
 
        assert(error == 0);
1154
 
      }
1155
 
      error= setsockopt(ip_sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags, sizeof(flags));
1156
 
      if (error != 0)
1157
 
      {
1158
 
        perror("setsockopt");
1159
 
        assert(error == 0);
1160
 
      }
1161
 
      error= setsockopt(ip_sock, SOL_SOCKET, SO_LINGER, (void *)&ling, sizeof(ling));
1162
 
      if (error != 0)
1163
 
      {
1164
 
        perror("setsockopt");
1165
 
        assert(error == 0);
1166
 
      }
1167
 
      error= setsockopt(ip_sock, IPPROTO_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags));
1168
 
      if (error != 0)
1169
 
      {
1170
 
        perror("setsockopt");
1171
 
        assert(error == 0);
1172
 
      }
 
1149
     /*
 
1150
       For interoperability with older clients, IPv6 socket should
 
1151
       listen on both IPv6 and IPv4 wildcard addresses.
 
1152
       Turn off IPV6_V6ONLY option.
 
1153
     */
 
1154
    if (ai->ai_family == AF_INET6)
 
1155
    {
 
1156
      arg= 0;      
 
1157
      (void) setsockopt(ip_sock, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&arg,
 
1158
                sizeof(arg));
1173
1159
    }
1174
 
 
1175
 
 
 
1160
#endif
1176
1161
    /*
1177
1162
      Sometimes the port is not released fast enough when stopping and
1178
1163
      restarting the server. This happens quite often with the test suite
1183
1168
    */
1184
1169
    for (waited= 0, retry= 1; ; retry++, waited+= this_wait)
1185
1170
    {
1186
 
      if (((ret= bind(ip_sock, next->ai_addr, next->ai_addrlen)) >= 0 ) ||
1187
 
          (errno != EADDRINUSE) ||
 
1171
      if (((ret= bind(ip_sock, ai->ai_addr, ai->ai_addrlen)) >= 0 ) ||
 
1172
          (socket_errno != SOCKET_EADDRINUSE) ||
1188
1173
          (waited >= mysqld_port_timeout))
1189
1174
        break;
1190
 
      sql_print_information(_("Retrying bind on TCP/IP port %u"), mysqld_port);
 
1175
      sql_print_information("Retrying bind on TCP/IP port %u", mysqld_port);
1191
1176
      this_wait= retry * retry / 3 + 1;
1192
1177
      sleep(this_wait);
1193
1178
    }
 
1179
    freeaddrinfo(ai);
1194
1180
    if (ret < 0)
1195
1181
    {
1196
 
      sql_perror(_("Can't start server: Bind on TCP/IP port"));
1197
 
      sql_print_error(_("Do you already have another drizzled server running "
1198
 
                        "on port: %d ?"),mysqld_port);
 
1182
      sql_perror("Can't start server: Bind on TCP/IP port");
 
1183
      sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port);
1199
1184
      unireg_abort(1);
1200
1185
    }
1201
1186
    if (listen(ip_sock,(int) back_log) < 0)
1202
1187
    {
1203
 
      sql_perror(_("Can't start server: listen() on TCP/IP port"));
1204
 
      sql_print_error(_("listen() on TCP/IP failed with error %d"),
1205
 
                      errno);
 
1188
      sql_perror("Can't start server: listen() on TCP/IP port");
 
1189
      sql_print_error("listen() on TCP/IP failed with error %d",
 
1190
                      socket_errno);
1206
1191
      unireg_abort(1);
1207
1192
    }
1208
1193
  }
1209
1194
 
1210
 
  freeaddrinfo(ai);
1211
 
  return;
 
1195
  return;;
1212
1196
}
1213
1197
 
1214
1198
/**
1221
1205
  @note
1222
1206
    For the connection that is doing shutdown, this is called twice
1223
1207
*/
1224
 
void close_connection(THD *thd, uint32_t errcode, bool lock)
 
1208
void close_connection(THD *thd, uint errcode, bool lock)
1225
1209
{
1226
1210
  st_vio *vio;
1227
1211
  if (lock)
1231
1215
  {
1232
1216
    if (errcode)
1233
1217
      net_send_error(thd, errcode, ER(errcode)); /* purecov: inspected */
1234
 
    net_close(&(thd->net));             /* vio is freed in delete thd */
 
1218
    vio_close(vio);                     /* vio is freed in delete thd */
1235
1219
  }
1236
1220
  if (lock)
1237
1221
    (void) pthread_mutex_unlock(&LOCK_thread_count);
1241
1225
 
1242
1226
/** Called when a thread is aborted. */
1243
1227
/* ARGSUSED */
1244
 
extern "C" RETSIGTYPE end_thread_signal(int sig __attribute__((unused)))
 
1228
extern "C" sig_handler end_thread_signal(int sig __attribute__((unused)))
1245
1229
{
1246
1230
  THD *thd=current_thd;
1247
 
  if (thd)
 
1231
  if (thd && ! thd->bootstrap)
1248
1232
  {
1249
1233
    statistic_increment(killed_threads, &LOCK_status);
1250
1234
    thread_scheduler.end_thread(thd,0);         /* purecov: inspected */
1388
1372
  @todo
1389
1373
    One should have to fix that thr_alarm know about this thread too.
1390
1374
*/
1391
 
extern "C" RETSIGTYPE abort_thread(int sig __attribute__((unused)))
 
1375
extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
1392
1376
{
1393
1377
  THD *thd=current_thd;
1394
1378
  if (thd)
1406
1390
#endif
1407
1391
 
1408
1392
 
1409
 
extern "C" RETSIGTYPE handle_segfault(int sig)
 
1393
extern "C" sig_handler handle_segfault(int sig)
1410
1394
{
1411
1395
  time_t curr_time;
1412
1396
  struct tm tm;
 
1397
  THD *thd=current_thd;
1413
1398
 
1414
1399
  /*
1415
1400
    Strictly speaking, one needs a mutex here
1419
1404
  */
1420
1405
  if (segfaulted)
1421
1406
  {
1422
 
    fprintf(stderr, _("Fatal " SIGNAL_FMT " while backtracing\n"), sig);
 
1407
    fprintf(stderr, "Fatal " SIGNAL_FMT " while backtracing\n", sig);
1423
1408
    exit(1);
1424
1409
  }
1425
1410
 
1428
1413
  curr_time= my_time(0);
1429
1414
  localtime_r(&curr_time, &tm);
1430
1415
 
1431
 
  fprintf(stderr,"%02d%02d%02d %2d:%02d:%02d - mysqld got "
1432
 
          SIGNAL_FMT " ;\n"
1433
 
          "This could be because you hit a bug. It is also possible that "
1434
 
          "this binary\n or one of the libraries it was linked against is "
1435
 
          "corrupt, improperly built,\n or misconfigured. This error can "
1436
 
          "also be caused by malfunctioning hardware.\n",
 
1416
  fprintf(stderr,"\
 
1417
%02d%02d%02d %2d:%02d:%02d - mysqld got " SIGNAL_FMT " ;\n\
 
1418
This could be because you hit a bug. It is also possible that this binary\n\
 
1419
or one of the libraries it was linked against is corrupt, improperly built,\n\
 
1420
or misconfigured. This error can also be caused by malfunctioning hardware.\n",
1437
1421
          tm.tm_year % 100, tm.tm_mon+1, tm.tm_mday,
1438
1422
          tm.tm_hour, tm.tm_min, tm.tm_sec,
1439
 
          sig);
1440
 
  fprintf(stderr, _("We will try our best to scrape up some info that "
1441
 
                    "will hopefully help diagnose\n"
1442
 
                    "the problem, but since we have already crashed, "
1443
 
                    "something is definitely wrong\nand this may fail.\n\n"));
1444
 
  fprintf(stderr, "key_buffer_size=%u\n",
1445
 
          (uint32_t) dflt_key_cache->key_cache_mem_size);
 
1423
          sig);
 
1424
  fprintf(stderr, "\
 
1425
We will try our best to scrape up some info that will hopefully help diagnose\n\
 
1426
the problem, but since we have already crashed, something is definitely wrong\n\
 
1427
and this may fail.\n\n");
 
1428
  fprintf(stderr, "key_buffer_size=%lu\n",
 
1429
          (ulong) dflt_key_cache->key_cache_mem_size);
1446
1430
  fprintf(stderr, "read_buffer_size=%ld\n", (long) global_system_variables.read_buff_size);
1447
 
  fprintf(stderr, "max_used_connections=%u\n", max_used_connections);
 
1431
  fprintf(stderr, "max_used_connections=%lu\n", max_used_connections);
1448
1432
  fprintf(stderr, "max_threads=%u\n", thread_scheduler.max_threads);
1449
1433
  fprintf(stderr, "thread_count=%u\n", thread_count);
1450
1434
  fprintf(stderr, "connection_count=%u\n", connection_count);
1451
 
  fprintf(stderr, _("It is possible that mysqld could use up to \n"
1452
 
                    "key_buffer_size + (read_buffer_size + "
1453
 
                    "sort_buffer_size)*max_threads = %lu K\n"
1454
 
                    "bytes of memory\n"
1455
 
                    "Hope that's ok; if not, decrease some variables in the "
1456
 
                    "equation.\n\n"),
1457
 
                    ((uint32_t) dflt_key_cache->key_cache_mem_size +
1458
 
                     (global_system_variables.read_buff_size +
1459
 
                      global_system_variables.sortbuff_size) *
1460
 
                     thread_scheduler.max_threads +
 
1435
  fprintf(stderr, "It is possible that mysqld could use up to \n\
 
1436
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = %lu K\n\
 
1437
bytes of memory\n", ((ulong) dflt_key_cache->key_cache_mem_size +
 
1438
                     (global_system_variables.read_buff_size +
 
1439
                      global_system_variables.sortbuff_size) *
 
1440
                     thread_scheduler.max_threads +
1461
1441
                     max_connections * sizeof(THD)) / 1024);
 
1442
  fprintf(stderr, "Hope that's ok; if not, decrease some variables in the equation.\n\n");
1462
1443
 
1463
1444
#ifdef HAVE_STACKTRACE
1464
 
  THD *thd= current_thd;
1465
 
 
1466
1445
  if (!(test_flags & TEST_NO_STACKTRACE))
1467
1446
  {
1468
1447
    fprintf(stderr,"thd: 0x%lx\n",(long) thd);
1469
 
    fprintf(stderr,_("Attempting backtrace. You can use the following "
1470
 
                     "information to find out\n"
1471
 
                     "where mysqld died. If you see no messages after this, "
1472
 
                     "something went\n"
1473
 
                     "terribly wrong...\n"));
1474
 
    print_stacktrace(thd ? (unsigned char*) thd->thread_stack : (unsigned char*) 0,
 
1448
    fprintf(stderr,"\
 
1449
Attempting backtrace. You can use the following information to find out\n\
 
1450
where mysqld died. If you see no messages after this, something went\n\
 
1451
terribly wrong...\n");  
 
1452
    print_stacktrace(thd ? (uchar*) thd->thread_stack : (uchar*) 0,
1475
1453
                     my_thread_stack_size);
1476
1454
  }
1477
1455
  if (thd)
1494
1472
      kreason= "KILLED_NO_VALUE";
1495
1473
      break;
1496
1474
    }
1497
 
    fprintf(stderr, _("Trying to get some variables.\n"
1498
 
                      "Some pointers may be invalid and cause the "
1499
 
                      "dump to abort...\n"));
 
1475
    fprintf(stderr, "Trying to get some variables.\n\
 
1476
Some pointers may be invalid and cause the dump to abort...\n");
1500
1477
    safe_print_str("thd->query", thd->query, 1024);
1501
 
    fprintf(stderr, "thd->thread_id=%"PRIu32"\n", (uint32_t) thd->thread_id);
 
1478
    fprintf(stderr, "thd->thread_id=%lu\n", (ulong) thd->thread_id);
1502
1479
    fprintf(stderr, "thd->killed=%s\n", kreason);
1503
1480
  }
 
1481
  fprintf(stderr, "\
 
1482
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains\n\
 
1483
information that should help you find out what is causing the crash.\n");
1504
1484
  fflush(stderr);
1505
1485
#endif /* HAVE_STACKTRACE */
1506
1486
 
1507
1487
#ifdef HAVE_INITGROUPS
1508
1488
  if (calling_initgroups)
1509
 
    fprintf(stderr, _("\nThis crash occured while the server was calling "
1510
 
                      "initgroups(). This is\n"
1511
 
                      "often due to the use of a drizzled that is statically "
1512
 
                      "linked against glibc\n"
1513
 
                      "and configured to use LDAP in /etc/nsswitch.conf. "
1514
 
                      "You will need to either\n"
1515
 
                      "upgrade to a version of glibc that does not have this "
1516
 
                      "problem (2.3.4 or\n"
1517
 
                      "later when used with nscd), disable LDAP in your "
1518
 
                      "nsswitch.conf, or use a\n"
1519
 
                      "drizzled that is not statically linked.\n"));
 
1489
    fprintf(stderr, "\n\
 
1490
This crash occured while the server was calling initgroups(). This is\n\
 
1491
often due to the use of a mysqld that is statically linked against glibc\n\
 
1492
and configured to use LDAP in /etc/nsswitch.conf. You will need to either\n\
 
1493
upgrade to a version of glibc that does not have this problem (2.3.4 or\n\
 
1494
later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\
 
1495
mysqld that is not statically linked.\n");
1520
1496
#endif
1521
1497
 
1522
1498
  if (thd_lib_detected == THD_LIB_LT && !getenv("LD_ASSUME_KERNEL"))
1523
 
    fprintf(stderr,
1524
 
            _("\nYou are running a statically-linked LinuxThreads binary "
1525
 
              "on an NPTL system.\n"
1526
 
              "This can result in crashes on some distributions due "
1527
 
              "to LT/NPTL conflicts.\n"
1528
 
              "You should either build a dynamically-linked binary, or force "
1529
 
              "LinuxThreads\n"
1530
 
              "to be used with the LD_ASSUME_KERNEL environment variable. "
1531
 
              "Please consult\n"
1532
 
              "the documentation for your distribution on how to do that.\n"));
1533
 
 
 
1499
    fprintf(stderr,"\n\
 
1500
You are running a statically-linked LinuxThreads binary on an NPTL system.\n\
 
1501
This can result in crashes on some distributions due to LT/NPTL conflicts.\n\
 
1502
You should either build a dynamically-linked binary, or force LinuxThreads\n\
 
1503
to be used with the LD_ASSUME_KERNEL environment variable. Please consult\n\
 
1504
the documentation for your distribution on how to do that.\n");
 
1505
  
1534
1506
  if (locked_in_memory)
1535
1507
  {
1536
 
    fprintf(stderr,
1537
 
            _("\nThe '--memlock' argument, which was enabled, uses system "
1538
 
              "calls that are\n"
1539
 
              "unreliable and unstable on some operating systems and "
1540
 
              "operating-system\n"
1541
 
              "versions (notably, some versions of Linux).  "
1542
 
              "This crash could be due to use\n"
1543
 
              "of those buggy OS calls.  You should consider whether you "
1544
 
              "really need the\n"
1545
 
              "'--memlock' parameter and/or consult the OS "
1546
 
              "distributor about 'mlockall'\n bugs.\n"));
 
1508
    fprintf(stderr, "\n\
 
1509
The \"--memlock\" argument, which was enabled, uses system calls that are\n\
 
1510
unreliable and unstable on some operating systems and operating-system\n\
 
1511
versions (notably, some versions of Linux).  This crash could be due to use\n\
 
1512
of those buggy OS calls.  You should consider whether you really need the\n\
 
1513
\"--memlock\" parameter and/or consult the OS distributer about \"mlockall\"\n\
 
1514
bugs.\n");
1547
1515
  }
1548
1516
 
1549
1517
#ifdef HAVE_WRITE_CORE
1550
1518
  if (test_flags & TEST_CORE_ON_SIGNAL)
1551
1519
  {
1552
 
    fprintf(stderr, _("Writing a core file\n"));
 
1520
    fprintf(stderr, "Writing a core file\n");
1553
1521
    fflush(stderr);
1554
1522
    write_core(sig);
1555
1523
  }
1596
1564
    STRUCT_RLIMIT rl;
1597
1565
    rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
1598
1566
    if (setrlimit(RLIMIT_CORE, &rl) && global_system_variables.log_warnings)
1599
 
      sql_print_warning(_("setrlimit could not change the size of core files "
1600
 
                          "to 'infinity';  We may not be able to generate a "
1601
 
                          "core file on signals"));
 
1567
      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");
1602
1568
  }
1603
1569
#endif
1604
1570
  (void) sigemptyset(&set);
1645
1611
  (void) pthread_attr_init(&thr_attr);
1646
1612
  pthread_attr_setscope(&thr_attr, PTHREAD_SCOPE_SYSTEM);
1647
1613
  (void) pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED);
 
1614
  if (!(opt_specialflag & SPECIAL_NO_PRIOR))
1648
1615
  {
1649
1616
    struct sched_param tmp_sched_param;
1650
1617
 
1664
1631
  (void) pthread_mutex_lock(&LOCK_thread_count);
1665
1632
  if ((error=pthread_create(&signal_thread,&thr_attr,signal_hand,0)))
1666
1633
  {
1667
 
    sql_print_error(_("Can't create interrupt-thread (error %d, errno: %d)"),
1668
 
                    error,errno);
 
1634
    sql_print_error("Can't create interrupt-thread (error %d, errno: %d)",
 
1635
                    error,errno);
1669
1636
    exit(1);
1670
1637
  }
1671
1638
  (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
1709
1676
  (void) sigaddset(&set,SIGTSTP);
1710
1677
 
1711
1678
  /* Save pid to this process (or thread on Linux) */
1712
 
  create_pid_file();
 
1679
  if (!opt_bootstrap)
 
1680
    create_pid_file();
1713
1681
 
1714
1682
#ifdef HAVE_STACK_TRACE_ON_SEGV
1715
1683
  if (opt_do_pstack)
1716
1684
  {
1717
 
    sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (uint32_t)getpid());
 
1685
    sprintf(pstack_file_name,"mysqld-%lu-%%d-%%d.backtrace", (ulong)getpid());
1718
1686
    pstack_install_segv_action(pstack_file_name);
1719
1687
  }
1720
1688
#endif /* HAVE_STACK_TRACE_ON_SEGV */
1752
1720
    case SIGQUIT:
1753
1721
    case SIGKILL:
1754
1722
#ifdef EXTRA_DEBUG
1755
 
      sql_print_information(_("Got signal %d to shutdown mysqld"),sig);
 
1723
      sql_print_information("Got signal %d to shutdown mysqld",sig);
1756
1724
#endif
1757
1725
      /* switch to the old log message processing */
 
1726
      logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
 
1727
                          opt_log ? LOG_FILE:LOG_NONE);
1758
1728
      if (!abort_loop)
1759
1729
      {
1760
1730
        abort_loop=1;                           // mark abort for threads
1761
1731
#ifdef USE_ONE_SIGNAL_HAND
1762
1732
        pthread_t tmp;
 
1733
        if (!(opt_specialflag & SPECIAL_NO_PRIOR))
1763
1734
        {
1764
1735
          struct sched_param tmp_sched_param;
1765
1736
 
1769
1740
        }
1770
1741
        if (pthread_create(&tmp,&connection_attrib, kill_server_thread,
1771
1742
                           (void*) &sig))
1772
 
          sql_print_error(_("Can't create thread to kill server"));
 
1743
          sql_print_error("Can't create thread to kill server");
1773
1744
#else
1774
1745
        kill_server((void*) sig);       // MIT THREAD has a alarm thread
1775
1746
#endif
1783
1754
                     (REFRESH_LOG | REFRESH_TABLES | REFRESH_FAST |
1784
1755
                      REFRESH_GRANT |
1785
1756
                      REFRESH_THREADS | REFRESH_HOSTS),
1786
 
                     (TableList*) 0, &not_used); // Flush logs
 
1757
                     (TABLE_LIST*) 0, &not_used); // Flush logs
 
1758
      }
 
1759
      /* reenable logs after the options were reloaded */
 
1760
      if (log_output_options & LOG_NONE)
 
1761
      {
 
1762
        logger.set_handlers(LOG_FILE,
 
1763
                            opt_slow_log ? LOG_TABLE : LOG_NONE,
 
1764
                            opt_log ? LOG_TABLE : LOG_NONE);
 
1765
      }
 
1766
      else
 
1767
      {
 
1768
        logger.set_handlers(LOG_FILE,
 
1769
                            opt_slow_log ? log_output_options : LOG_NONE,
 
1770
                            opt_log ? log_output_options : LOG_NONE);
1787
1771
      }
1788
1772
      break;
1789
1773
#ifdef USE_ONE_SIGNAL_HAND
1793
1777
#endif
1794
1778
    default:
1795
1779
#ifdef EXTRA_DEBUG
1796
 
      sql_print_warning(_("Got signal: %d  error: %d"),sig,error); /* purecov: tested */
 
1780
      sql_print_warning("Got signal: %d  error: %d",sig,error); /* purecov: tested */
1797
1781
#endif
1798
1782
      break;                                    /* purecov: tested */
1799
1783
    }
1801
1785
  return(0);                                    /* purecov: deadcode */
1802
1786
}
1803
1787
 
1804
 
static void check_data_home(const char *path __attribute__((unused)))
 
1788
static void check_data_home(const char *path __attribute__((__unused__)))
1805
1789
{}
1806
1790
 
1807
1791
#endif  /* __WIN__*/
1812
1796
  for the client.
1813
1797
*/
1814
1798
/* ARGSUSED */
1815
 
extern "C" void my_message_sql(uint32_t error, const char *str, myf MyFlags);
 
1799
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
1816
1800
 
1817
 
void my_message_sql(uint32_t error, const char *str, myf MyFlags)
 
1801
void my_message_sql(uint error, const char *str, myf MyFlags)
1818
1802
{
1819
1803
  THD *thd;
1820
1804
  /*
1826
1810
    if (MyFlags & ME_FATALERROR)
1827
1811
      thd->is_fatal_error= 1;
1828
1812
 
 
1813
#ifdef BUG_36098_FIXED
 
1814
    mysql_audit_general(thd,MYSQL_AUDIT_GENERAL_ERROR,error,my_time(0),
 
1815
                        0,0,str,str ? strlen(str) : 0,
 
1816
                        thd->query,thd->query_length,
 
1817
                        thd->variables.character_set_client,
 
1818
                        thd->row_count);
 
1819
#endif
 
1820
 
 
1821
 
1829
1822
    /*
1830
1823
      TODO: There are two exceptions mechanism (THD and sp_rcontext),
1831
1824
      this could be improved by having a common stack of handlers.
1832
1825
    */
1833
1826
    if (thd->handle_error(error, str,
1834
 
                          DRIZZLE_ERROR::WARN_LEVEL_ERROR))
 
1827
                          MYSQL_ERROR::WARN_LEVEL_ERROR))
1835
1828
      return;;
1836
1829
 
1837
1830
    thd->is_slave_error=  1; // needed to catch query errors during replication
1859
1852
        Suppress infinite recursion if there a memory allocation error
1860
1853
        inside push_warning.
1861
1854
      */
1862
 
      thd->no_warnings_for_error= true;
1863
 
      push_warning(thd, DRIZZLE_ERROR::WARN_LEVEL_ERROR, error, str);
1864
 
      thd->no_warnings_for_error= false;
 
1855
      thd->no_warnings_for_error= TRUE;
 
1856
      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, error, str);
 
1857
      thd->no_warnings_for_error= FALSE;
1865
1858
    }
1866
1859
  }
1867
1860
  if (!thd || MyFlags & ME_NOREFRESH)
1881
1874
 
1882
1875
void my_str_free_mysqld(void *ptr)
1883
1876
{
1884
 
  free((unsigned char*)ptr);
 
1877
  my_free((uchar*)ptr, MYF(MY_FAE));
1885
1878
}
1886
1879
 
1887
1880
 
1888
1881
static const char *load_default_groups[]= {
1889
 
"mysqld","server", DRIZZLE_BASE_VERSION, 0, 0};
 
1882
"mysqld","server", MYSQL_BASE_VERSION, 0, 0};
1890
1883
 
1891
1884
 
1892
1885
/**
1905
1898
    1 error
1906
1899
*/
1907
1900
 
1908
 
static bool init_global_datetime_format(enum enum_drizzle_timestamp_type format_type,
 
1901
static bool init_global_datetime_format(timestamp_type format_type,
1909
1902
                                        DATE_TIME_FORMAT **var_ptr)
1910
1903
{
1911
1904
  /* Get command line option */
1923
1916
  }
1924
1917
  if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
1925
1918
  {
1926
 
    fprintf(stderr, _("Wrong date/time format specifier: %s\n"), str);
 
1919
    fprintf(stderr, "Wrong date/time format specifier: %s\n", str);
1927
1920
    return 1;
1928
1921
  }
1929
1922
  return 0;
1933
1926
  {"admin_commands",       (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
1934
1927
  {"assign_to_keycache",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ASSIGN_TO_KEYCACHE]), SHOW_LONG_STATUS},
1935
1928
  {"alter_db",             (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
 
1929
  {"alter_db_upgrade",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB_UPGRADE]), SHOW_LONG_STATUS},
1936
1930
  {"alter_table",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
1937
1931
  {"analyze",              (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
1938
1932
  {"begin",                (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
1971
1965
  {"savepoint",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
1972
1966
  {"select",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS},
1973
1967
  {"set_option",           (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
 
1968
  {"show_binlog_events",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOG_EVENTS]), SHOW_LONG_STATUS},
1974
1969
  {"show_binlogs",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
 
1970
  {"show_charsets",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CHARSETS]), SHOW_LONG_STATUS},
 
1971
  {"show_collations",      (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_COLLATIONS]), SHOW_LONG_STATUS},
1975
1972
  {"show_create_db",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
1976
1973
  {"show_create_table",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
1977
1974
  {"show_databases",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS},
1983
1980
  {"show_open_tables",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
1984
1981
  {"show_plugins",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
1985
1982
  {"show_processlist",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
 
1983
  {"show_slave_hosts",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS},
1986
1984
  {"show_slave_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
1987
1985
  {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
1988
1986
  {"show_table_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
1995
1993
  {"unlock_tables",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
1996
1994
  {"update",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
1997
1995
  {"update_multi",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE_MULTI]), SHOW_LONG_STATUS},
1998
 
  {NULL, NULL, SHOW_LONG}
 
1996
  {NullS, NullS, SHOW_LONG}
1999
1997
};
2000
1998
 
2001
1999
static int init_common_variables(const char *conf_file_name, int argc,
2002
2000
                                 char **argv, const char **groups)
2003
2001
{
 
2002
  char buff[FN_REFLEN], *s;
2004
2003
  umask(((~my_umask) & 0666));
2005
2004
  my_decimal_set_zero(&decimal_zero); // set decimal_zero constant;
2006
2005
  tzset();                      // Set tzname
2007
2006
 
2008
 
  max_system_variables.pseudo_thread_id= UINT32_MAX;
 
2007
  max_system_variables.pseudo_thread_id= (ulong)~0;
2009
2008
  server_start_time= flush_status_time= my_time(0);
2010
2009
  rpl_filter= new Rpl_filter;
2011
2010
  binlog_filter= new Rpl_filter;
2012
 
  if (!rpl_filter || !binlog_filter)
 
2011
  if (!rpl_filter || !binlog_filter) 
2013
2012
  {
2014
2013
    sql_perror("Could not allocate replication and binlog filters");
2015
2014
    exit(1);
2037
2036
  global_system_variables.time_zone= my_tz_SYSTEM;
2038
2037
 
2039
2038
  /*
2040
 
    Init mutexes for the global DRIZZLE_BIN_LOG objects.
 
2039
    Init mutexes for the global MYSQL_BIN_LOG objects.
2041
2040
    As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
2042
 
    global DRIZZLE_BIN_LOGs in their constructors, because then they would be
 
2041
    global MYSQL_BIN_LOGs in their constructors, because then they would be
2043
2042
    inited before MY_INIT(). So we do it here.
2044
2043
  */
2045
2044
  mysql_bin_log.init_pthread_objects();
2047
2046
  if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
2048
2047
  {
2049
2048
    strmake(glob_hostname, STRING_WITH_LEN("localhost"));
2050
 
    sql_print_warning(_("gethostname failed, using '%s' as hostname"),
 
2049
    sql_print_warning("gethostname failed, using '%s' as hostname",
2051
2050
                      glob_hostname);
2052
2051
    strmake(pidfile_name, STRING_WITH_LEN("mysql"));
2053
2052
  }
2054
2053
  else
2055
2054
  strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
2056
 
  my_stpcpy(fn_ext(pidfile_name),".pid");               // Add proper extension
 
2055
  strmov(fn_ext(pidfile_name),".pid");          // Add proper extension
2057
2056
 
2058
2057
  /*
2059
2058
    Add server status variables to the dynamic list of
2073
2072
 
2074
2073
  /* connections and databases needs lots of files */
2075
2074
  {
2076
 
    uint32_t files, wanted_files, max_open_files;
 
2075
    uint files, wanted_files, max_open_files;
2077
2076
 
2078
2077
    /* MyISAM requires two file handles per table. */
2079
2078
    wanted_files= 10+max_connections+table_cache_size*2;
2087
2086
      can't get max_connections*5 but still got no less than was
2088
2087
      requested (value of wanted_files).
2089
2088
    */
2090
 
    max_open_files= cmax(cmax((uint32_t)wanted_files, max_connections*5),
2091
 
                         open_files_limit);
 
2089
    max_open_files= max(max(wanted_files, max_connections*5),
 
2090
                        open_files_limit);
2092
2091
    files= my_set_max_open_files(max_open_files);
2093
2092
 
2094
2093
    if (files < wanted_files)
2099
2098
          If we have requested too much file handles than we bring
2100
2099
          max_connections in supported bounds.
2101
2100
        */
2102
 
        max_connections= (uint32_t) cmin((uint32_t)files-10-TABLE_OPEN_CACHE_MIN*2,
 
2101
        max_connections= (ulong) min(files-10-TABLE_OPEN_CACHE_MIN*2,
2103
2102
                                     max_connections);
2104
2103
        /*
2105
2104
          Decrease table_cache_size according to max_connections, but
2106
 
          not below TABLE_OPEN_CACHE_MIN.  Outer cmin() ensures that we
 
2105
          not below TABLE_OPEN_CACHE_MIN.  Outer min() ensures that we
2107
2106
          never increase table_cache_size automatically (that could
2108
2107
          happen if max_connections is decreased above).
2109
2108
        */
2110
 
        table_cache_size= (uint32_t) cmin(cmax((files-10-max_connections)/2,
2111
 
                                          (uint32_t)TABLE_OPEN_CACHE_MIN),
 
2109
        table_cache_size= (ulong) min(max((files-10-max_connections)/2,
 
2110
                                          TABLE_OPEN_CACHE_MIN),
2112
2111
                                      table_cache_size);
2113
 
        if (global_system_variables.log_warnings)
2114
 
          sql_print_warning(_("Changed limits: max_open_files: %u  "
2115
 
                              "max_connections: %ld  table_cache: %ld"),
2116
 
                            files, max_connections, table_cache_size);
 
2112
        if (global_system_variables.log_warnings)
 
2113
          sql_print_warning("Changed limits: max_open_files: %u  max_connections: %ld  table_cache: %ld",
 
2114
                        files, max_connections, table_cache_size);
2117
2115
      }
2118
2116
      else if (global_system_variables.log_warnings)
2119
 
        sql_print_warning(_("Could not increase number of max_open_files "
2120
 
                            "to more than %u (request: %u)"),
2121
 
                          files, wanted_files);
 
2117
        sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files);
2122
2118
    }
2123
2119
    open_files_limit= files;
2124
2120
  }
2125
 
  unireg_init(0); /* Set up extern variabels */
 
2121
  unireg_init(opt_specialflag); /* Set up extern variabels */
2126
2122
  if (init_errmessage())        /* Read error messages from file */
2127
2123
    return 1;
 
2124
  init_client_errs();
2128
2125
  lex_init();
2129
2126
  if (item_create_init())
2130
2127
    return 1;
2133
2130
    return 1;
2134
2131
  if (init_replication_sys_vars())
2135
2132
    return 1;
 
2133
  mysys_uses_curses=0;
2136
2134
  /*
2137
2135
    Process a comma-separated character set list and choose
2138
2136
    the first available character set. This is mostly for
2162
2160
 
2163
2161
  if (default_collation_name)
2164
2162
  {
2165
 
    const CHARSET_INFO * const default_collation=
2166
 
      get_charset_by_name(default_collation_name, MYF(0));
 
2163
    CHARSET_INFO *default_collation;
 
2164
    default_collation= get_charset_by_name(default_collation_name, MYF(0));
2167
2165
    if (!default_collation)
2168
2166
    {
2169
 
      sql_print_error(_(ER(ER_UNKNOWN_COLLATION)), default_collation_name);
 
2167
      sql_print_error(ER(ER_UNKNOWN_COLLATION), default_collation_name);
2170
2168
      return 1;
2171
2169
    }
2172
2170
    if (!my_charset_same(default_charset_info, default_collation))
2173
2171
    {
2174
 
      sql_print_error(_(ER(ER_COLLATION_CHARSET_MISMATCH)),
2175
 
                      default_collation_name,
2176
 
                      default_charset_info->csname);
 
2172
      sql_print_error(ER(ER_COLLATION_CHARSET_MISMATCH),
 
2173
                      default_collation_name,
 
2174
                      default_charset_info->csname);
2177
2175
      return 1;
2178
2176
    }
2179
2177
    default_charset_info= default_collation;
2188
2186
  global_system_variables.optimizer_use_mrr= 1;
2189
2187
  global_system_variables.optimizer_switch= 0;
2190
2188
 
2191
 
  if (!(character_set_filesystem=
 
2189
  if (!(character_set_filesystem= 
2192
2190
        get_charset_by_csname(character_set_filesystem_name,
2193
2191
                              MY_CS_PRIMARY, MYF(MY_WME))))
2194
2192
    return 1;
2197
2195
  if (!(my_default_lc_time_names=
2198
2196
        my_locale_by_name(lc_time_names_name)))
2199
2197
  {
2200
 
    sql_print_error(_("Unknown locale: '%s'"), lc_time_names_name);
 
2198
    sql_print_error("Unknown locale: '%s'", lc_time_names_name);
2201
2199
    return 1;
2202
2200
  }
2203
2201
  global_system_variables.lc_time_names= my_default_lc_time_names;
2204
 
 
 
2202
  
2205
2203
  sys_init_connect.value_length= 0;
2206
2204
  if ((sys_init_connect.value= opt_init_connect))
2207
2205
    sys_init_connect.value_length= strlen(opt_init_connect);
2214
2212
  else
2215
2213
    sys_init_slave.value=my_strdup("",MYF(0));
2216
2214
 
 
2215
  /* check log options and issue warnings if needed */
 
2216
  if (opt_log && opt_logname && !(log_output_options & LOG_FILE) &&
 
2217
      !(log_output_options & LOG_NONE))
 
2218
    sql_print_warning("Although a path was specified for the "
 
2219
                      "--log option, log tables are used. "
 
2220
                      "To enable logging to files use the --log-output option.");
 
2221
 
 
2222
  if (opt_slow_log && opt_slow_logname && !(log_output_options & LOG_FILE)
 
2223
      && !(log_output_options & LOG_NONE))
 
2224
    sql_print_warning("Although a path was specified for the "
 
2225
                      "--log-slow-queries option, log tables are used. "
 
2226
                      "To enable logging to files use the --log-output=file option.");
 
2227
 
 
2228
  s= opt_logname ? opt_logname : make_default_log_name(buff, ".log");
 
2229
  sys_var_general_log_path.value= my_strdup(s, MYF(0));
 
2230
  sys_var_general_log_path.value_length= strlen(s);
 
2231
 
 
2232
  s= opt_slow_logname ? opt_slow_logname : make_default_log_name(buff, "-slow.log");
 
2233
  sys_var_slow_log_path.value= my_strdup(s, MYF(0));
 
2234
  sys_var_slow_log_path.value_length= strlen(s);
 
2235
 
2217
2236
  if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
2218
2237
    return 1;
2219
2238
  if (my_database_names_init())
2220
2239
    return 1;
2221
2240
 
 
2241
  /*
 
2242
    Ensure that lower_case_table_names is set on system where we have case
 
2243
    insensitive names.  If this is not done the users MyISAM tables will
 
2244
    get corrupted if accesses with names of different case.
 
2245
  */
 
2246
  lower_case_file_system= test_if_case_insensitive(mysql_real_data_home);
 
2247
  if (!lower_case_table_names && lower_case_file_system == 1)
 
2248
  {
 
2249
    if (lower_case_table_names_used)
 
2250
    {
 
2251
      if (global_system_variables.log_warnings)
 
2252
        sql_print_warning("\
 
2253
You have forced lower_case_table_names to 0 through a command-line \
 
2254
option, even though your file system '%s' is case insensitive.  This means \
 
2255
that you can corrupt a MyISAM table by accessing it with different cases. \
 
2256
You should consider changing lower_case_table_names to 1 or 2",
 
2257
                        mysql_real_data_home);
 
2258
    }
 
2259
    else
 
2260
    {
 
2261
      if (global_system_variables.log_warnings)
 
2262
        sql_print_warning("Setting lower_case_table_names=2 because file system for %s is case insensitive", mysql_real_data_home);
 
2263
      lower_case_table_names= 2;
 
2264
    }
 
2265
  }
 
2266
  else if (lower_case_table_names == 2 &&
 
2267
           !(lower_case_file_system=
 
2268
             (test_if_case_insensitive(mysql_real_data_home) == 1)))
 
2269
  {
 
2270
    if (global_system_variables.log_warnings)
 
2271
      sql_print_warning("lower_case_table_names was set to 2, even though your "
 
2272
                        "the file system '%s' is case sensitive.  Now setting "
 
2273
                        "lower_case_table_names to 0 to avoid future problems.",
 
2274
                        mysql_real_data_home);
 
2275
    lower_case_table_names= 0;
 
2276
  }
 
2277
  else
 
2278
  {
 
2279
    lower_case_file_system=
 
2280
      (test_if_case_insensitive(mysql_real_data_home) == 1);
 
2281
  }
2222
2282
 
2223
2283
  /* Reset table_alias_charset, now that lower_case_table_names is set. */
2224
 
  lower_case_table_names= 1; /* This we need to look at */
2225
 
  table_alias_charset= files_charset_info;
 
2284
  table_alias_charset= (lower_case_table_names ?
 
2285
                        files_charset_info :
 
2286
                        &my_charset_bin);
2226
2287
 
2227
2288
  return 0;
2228
2289
}
2234
2295
  (void) pthread_mutex_init(&LOCK_lock_db,MY_MUTEX_INIT_SLOW);
2235
2296
  (void) pthread_mutex_init(&LOCK_open, NULL);
2236
2297
  (void) pthread_mutex_init(&LOCK_thread_count,MY_MUTEX_INIT_FAST);
 
2298
  (void) pthread_mutex_init(&LOCK_mapped_file,MY_MUTEX_INIT_SLOW);
2237
2299
  (void) pthread_mutex_init(&LOCK_status,MY_MUTEX_INIT_FAST);
2238
2300
  (void) pthread_mutex_init(&LOCK_error_log,MY_MUTEX_INIT_FAST);
 
2301
  (void) pthread_mutex_init(&LOCK_manager,MY_MUTEX_INIT_FAST);
 
2302
  (void) pthread_mutex_init(&LOCK_crypt,MY_MUTEX_INIT_FAST);
2239
2303
  (void) pthread_mutex_init(&LOCK_user_conn, MY_MUTEX_INIT_FAST);
2240
2304
  (void) pthread_mutex_init(&LOCK_active_mi, MY_MUTEX_INIT_FAST);
2241
2305
  (void) pthread_mutex_init(&LOCK_global_system_variables, MY_MUTEX_INIT_FAST);
2250
2314
  (void) pthread_cond_init(&COND_global_read_lock,NULL);
2251
2315
  (void) pthread_cond_init(&COND_thread_cache,NULL);
2252
2316
  (void) pthread_cond_init(&COND_flush_thread_cache,NULL);
 
2317
  (void) pthread_cond_init(&COND_manager,NULL);
 
2318
  (void) pthread_mutex_init(&LOCK_rpl_status, MY_MUTEX_INIT_FAST);
 
2319
  (void) pthread_cond_init(&COND_rpl_status, NULL);
2253
2320
 
2254
2321
  /* Parameter for threads created for connections */
2255
2322
  (void) pthread_attr_init(&connection_attrib);
2256
2323
  (void) pthread_attr_setdetachstate(&connection_attrib,
2257
2324
                                     PTHREAD_CREATE_DETACHED);
2258
2325
  pthread_attr_setscope(&connection_attrib, PTHREAD_SCOPE_SYSTEM);
 
2326
  if (!(opt_specialflag & SPECIAL_NO_PRIOR))
2259
2327
  {
2260
2328
    struct sched_param tmp_sched_param;
2261
2329
 
2267
2335
  if (pthread_key_create(&THR_THD,NULL) ||
2268
2336
      pthread_key_create(&THR_MALLOC,NULL))
2269
2337
  {
2270
 
    sql_print_error(_("Can't create thread-keys"));
 
2338
    sql_print_error("Can't create thread-keys");
2271
2339
    return 1;
2272
2340
  }
2273
2341
  return 0;
2283
2351
  if (table_cache_init() | table_def_init())
2284
2352
    unireg_abort(1);
2285
2353
 
2286
 
  randominit(&sql_rand,(uint32_t) server_start_time,(uint32_t) server_start_time/2);
 
2354
  randominit(&sql_rand,(ulong) server_start_time,(ulong) server_start_time/2);
2287
2355
  setup_fpu();
2288
2356
  init_thr_lock();
 
2357
  init_slave_list();
2289
2358
 
2290
2359
  /* Setup logs */
2291
2360
 
2313
2382
 
2314
2383
  if (xid_cache_init())
2315
2384
  {
2316
 
    sql_print_error(_("Out of memory"));
 
2385
    sql_print_error("Out of memory");
2317
2386
    unireg_abort(1);
2318
2387
  }
2319
2388
 
2320
2389
  if (!opt_bin_log)
2321
2390
    if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC)
2322
2391
    {
2323
 
      sql_print_error(_("You need to use --log-bin to make "
2324
 
                        "--binlog-format work."));
 
2392
      sql_print_error("You need to use --log-bin to make "
 
2393
                      "--binlog-format work.");
2325
2394
      unireg_abort(1);
2326
2395
    }
2327
2396
    else
2332
2401
    if (opt_binlog_format_id == BINLOG_FORMAT_UNSPEC)
2333
2402
      global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
2334
2403
    else
2335
 
    {
 
2404
    { 
2336
2405
      assert(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
2337
2406
    }
2338
2407
 
2342
2411
 
2343
2412
  if (opt_log_slave_updates && replicate_same_server_id)
2344
2413
  {
2345
 
    sql_print_error(_("using --replicate-same-server-id in conjunction with "
2346
 
                      "--log-slave-updates is impossible, it would lead to "
2347
 
                      "infinite loops in this server."));
 
2414
    sql_print_error("\
 
2415
using --replicate-same-server-id in conjunction with \
 
2416
--log-slave-updates is impossible, it would lead to infinite loops in this \
 
2417
server.");
2348
2418
    unireg_abort(1);
2349
2419
  }
2350
2420
 
2362
2432
        require a name. But as we don't want to break many existing setups, we
2363
2433
        only give warning, not error.
2364
2434
      */
2365
 
      sql_print_warning(_("No argument was provided to --log-bin, and "
2366
 
                          "--log-bin-index was not used; so replication "
2367
 
                          "may break when this Drizzle server acts as a "
2368
 
                          "master and has his hostname changed!! Please "
2369
 
                          "use '--log-bin=%s' to avoid this problem."), ln);
 
2435
      sql_print_warning("No argument was provided to --log-bin, and "
 
2436
                        "--log-bin-index was not used; so replication "
 
2437
                        "may break when this MySQL server acts as a "
 
2438
                        "master and has his hostname changed!! Please "
 
2439
                        "use '--log-bin=%s' to avoid this problem.", ln);
2370
2440
    }
2371
2441
    if (ln == buf)
2372
2442
    {
2373
 
      free(opt_bin_logname);
 
2443
      my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR));
2374
2444
      opt_bin_logname=my_strdup(buf, MYF(0));
2375
2445
    }
2376
2446
    if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln))
2396
2466
                  (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
2397
2467
                  (opt_help ? PLUGIN_INIT_SKIP_INITIALIZATION : 0)))
2398
2468
  {
2399
 
    sql_print_error(_("Failed to initialize plugins."));
 
2469
    sql_print_error("Failed to initialize plugins.");
2400
2470
    unireg_abort(1);
2401
2471
  }
2402
2472
 
2426
2496
 
2427
2497
    if (defaults_argc)
2428
2498
    {
2429
 
      fprintf(stderr,
2430
 
              _("%s: Too many arguments (first extra is '%s').\n"
2431
 
                "Use --verbose --help to get a list of available options\n"),
 
2499
      fprintf(stderr, "%s: Too many arguments (first extra is '%s').\n"
 
2500
              "Use --verbose --help to get a list of available options\n",
2432
2501
              my_progname, *tmp_argv);
2433
2502
      unireg_abort(1);
2434
2503
    }
2435
2504
  }
2436
2505
 
 
2506
  /* if the errmsg.sys is not loaded, terminate to maintain behaviour */
 
2507
  if (!errmesg[0][0])
 
2508
    unireg_abort(1);
 
2509
 
2437
2510
  /* We have to initialize the storage engines before CSV logging */
2438
2511
  if (ha_init())
2439
2512
  {
2440
 
    sql_print_error(_("Can't init databases"));
 
2513
    sql_print_error("Can't init databases");
2441
2514
    unireg_abort(1);
2442
2515
  }
2443
2516
 
 
2517
  logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
 
2518
                      opt_log ? LOG_FILE:LOG_NONE);
 
2519
 
2444
2520
  /*
2445
2521
    Check that the default storage engine is actually available.
2446
2522
  */
2450
2526
                       strlen(default_storage_engine_str) };
2451
2527
    plugin_ref plugin;
2452
2528
    handlerton *hton;
2453
 
 
 
2529
    
2454
2530
    if ((plugin= ha_resolve_by_name(0, &name)))
2455
 
    {
2456
 
      hton= plugin_data(plugin,handlerton *);
2457
 
    }
 
2531
      hton= plugin_data(plugin, handlerton*);
2458
2532
    else
2459
2533
    {
2460
 
      sql_print_error(_("Unknown/unsupported table type: %s"),
 
2534
      sql_print_error("Unknown/unsupported table type: %s",
2461
2535
                      default_storage_engine_str);
2462
2536
      unireg_abort(1);
2463
2537
    }
2464
2538
    if (!ha_storage_engine_is_enabled(hton))
2465
2539
    {
2466
 
      sql_print_error(_("Default storage engine (%s) is not available"),
2467
 
                      default_storage_engine_str);
2468
 
      unireg_abort(1);
 
2540
      if (!opt_bootstrap)
 
2541
      {
 
2542
        sql_print_error("Default storage engine (%s) is not available",
 
2543
                        default_storage_engine_str);
 
2544
        unireg_abort(1);
 
2545
      }
2469
2546
      assert(global_system_variables.table_plugin);
2470
2547
    }
2471
2548
    else
2472
2549
    {
2473
2550
      /*
2474
 
        Need to unlock as global_system_variables.table_plugin
 
2551
        Need to unlock as global_system_variables.table_plugin 
2475
2552
        was acquired during plugin_init()
2476
2553
      */
2477
2554
      plugin_unlock(0, global_system_variables.table_plugin);
2486
2563
 
2487
2564
  if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file))
2488
2565
  {
2489
 
    sql_print_error(_("Can't initialize tc_log"));
 
2566
    sql_print_error("Can't init tc log");
2490
2567
    unireg_abort(1);
2491
2568
  }
2492
2569
 
2506
2583
      mysql_bin_log.purge_logs_before_date(purge_time);
2507
2584
  }
2508
2585
 
 
2586
  if (opt_myisam_log)
 
2587
    (void) mi_log(1);
 
2588
 
2509
2589
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
2510
2590
  if (locked_in_memory && !getuid())
2511
2591
  {
2517
2597
    if (mlockall(MCL_CURRENT))
2518
2598
    {
2519
2599
      if (global_system_variables.log_warnings)
2520
 
        sql_print_warning(_("Failed to lock memory. Errno: %d\n"),errno);
 
2600
        sql_print_warning("Failed to lock memory. Errno: %d\n",errno);
2521
2601
      locked_in_memory= 0;
2522
2602
    }
2523
2603
    if (user_info)
2532
2612
}
2533
2613
 
2534
2614
 
 
2615
static void create_maintenance_thread()
 
2616
{
 
2617
  if (flush_time && flush_time != ~(ulong) 0L)
 
2618
  {
 
2619
    pthread_t hThread;
 
2620
    if (pthread_create(&hThread,&connection_attrib,handle_manager,0))
 
2621
      sql_print_warning("Can't create thread to manage maintenance");
 
2622
  }
 
2623
}
 
2624
 
 
2625
 
2535
2626
int main(int argc, char **argv)
2536
2627
{
2537
 
#if defined(ENABLE_NLS)
2538
 
# if defined(HAVE_LOCALE_H)
2539
 
  setlocale(LC_ALL, "");
2540
 
# endif
2541
 
  bindtextdomain("drizzle", LOCALEDIR);
2542
 
  textdomain("drizzle");
2543
 
#endif
2544
 
 
2545
2628
  MY_INIT(argv[0]);             // init my_sys library & pthreads
2546
2629
  /* nothing should come before this line ^^^ */
2547
2630
 
2566
2649
  }
2567
2650
#endif
2568
2651
 
2569
 
  if (init_common_variables(DRIZZLE_CONFIG_NAME,
 
2652
  if (init_common_variables(MYSQL_CONFIG_NAME,
2570
2653
                            argc, argv, load_default_groups))
2571
2654
    unireg_abort(1);                            // Will do exit
2572
2655
 
2573
2656
  init_signals();
 
2657
  if (!(opt_specialflag & SPECIAL_NO_PRIOR))
 
2658
  {
 
2659
    struct sched_param tmp_sched_param;
2574
2660
 
 
2661
    memset(&tmp_sched_param, 0, sizeof(tmp_sched_param));
 
2662
    tmp_sched_param.sched_priority= my_thread_stack_size*2;
 
2663
    (void)pthread_setschedparam(pthread_self(), SCHED_OTHER, &tmp_sched_param);
 
2664
  }
2575
2665
  pthread_attr_setstacksize(&connection_attrib,my_thread_stack_size);
2576
 
 
2577
2666
#ifdef HAVE_PTHREAD_ATTR_GETSTACKSIZE
2578
2667
  {
2579
2668
    /* Retrieve used stack size;  Needed for checking stack overflows */
2583
2672
    if (stack_size && stack_size < my_thread_stack_size)
2584
2673
    {
2585
2674
      if (global_system_variables.log_warnings)
2586
 
      {
2587
 
        /* %zu is not yet in C++ */
2588
 
        uint64_t size_tmp= (uint64_t)stack_size;
2589
 
        sql_print_warning(_("Asked for %u thread stack, but got %"PRIu64),
2590
 
                          my_thread_stack_size, size_tmp);
2591
 
      }
 
2675
        sql_print_warning("Asked for %lu thread stack, but got %ld",
 
2676
                          my_thread_stack_size, (long) stack_size);
2592
2677
      my_thread_stack_size= stack_size;
2593
2678
    }
2594
2679
  }
2622
2707
  {
2623
2708
    server_id= 1;
2624
2709
#ifdef EXTRA_DEBUG
2625
 
    sql_print_warning(_("You have enabled the binary log, but you haven't set "
2626
 
                        "server-id to a non-zero value: we force server id to "
2627
 
                        "1; updates will be logged to the binary log, but "
2628
 
                        "connections from slaves will not be accepted."));
 
2710
    sql_print_warning("You have enabled the binary log, but you haven't set "
 
2711
                      "server-id to a non-zero value: we force server id to 1; "
 
2712
                      "updates will be logged to the binary log, but "
 
2713
                      "connections from slaves will not be accepted.");
2629
2714
#endif
2630
2715
  }
2631
2716
 
2647
2732
  error_handler_hook= my_message_sql;
2648
2733
  start_signal_handler();                               // Creates pidfile
2649
2734
 
2650
 
  if (mysql_rm_tmp_tables() || my_tz_init((THD *)0, default_tz_name))
 
2735
  if (mysql_rm_tmp_tables() || my_tz_init((THD *)0, default_tz_name, opt_bootstrap))
2651
2736
  {
2652
2737
    abort_loop=1;
2653
2738
    select_thread_in_use=0;
2654
 
    (void) pthread_kill(signal_thread, DRIZZLE_KILL_SIGNAL);
 
2739
    (void) pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
2655
2740
 
2656
 
    (void) my_delete(pidfile_name,MYF(MY_WME)); // Not needed anymore
 
2741
    if (!opt_bootstrap)
 
2742
      (void) my_delete(pidfile_name,MYF(MY_WME));       // Not needed anymore
2657
2743
 
2658
2744
    exit(1);
2659
2745
  }
2660
2746
 
2661
2747
  init_status_vars();
 
2748
  if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
 
2749
    opt_skip_slave_start= 1;
2662
2750
  /*
2663
2751
    init_slave() must be called after the thread keys are created.
2664
2752
    Some parts of the code (e.g. SHOW STATUS LIKE 'slave_running' and other
2670
2758
    unireg_abort(1);
2671
2759
  }
2672
2760
 
2673
 
  sql_print_information(_(ER(ER_STARTUP)),my_progname,server_version,
2674
 
                        "", mysqld_port, DRIZZLE_COMPILATION_COMMENT);
 
2761
  create_maintenance_thread();
 
2762
 
 
2763
  sql_print_information(ER(ER_STARTUP),my_progname,server_version,
 
2764
                        "", mysqld_port, MYSQL_COMPILATION_COMMENT);
2675
2765
 
2676
2766
 
2677
2767
  handle_connections_sockets();
2678
2768
 
2679
2769
  /* (void) pthread_attr_destroy(&connection_attrib); */
2680
 
 
 
2770
  
2681
2771
 
2682
2772
#ifdef EXTRA_DEBUG2
2683
 
  sql_print_error(_("Before Lock_thread_count"));
 
2773
  sql_print_error("Before Lock_thread_count");
2684
2774
#endif
2685
2775
  (void) pthread_mutex_lock(&LOCK_thread_count);
2686
2776
  select_thread_in_use=0;                       // For close_connections
2687
2777
  (void) pthread_mutex_unlock(&LOCK_thread_count);
2688
2778
  (void) pthread_cond_broadcast(&COND_thread_count);
2689
2779
#ifdef EXTRA_DEBUG2
2690
 
  sql_print_error(_("After lock_thread_count"));
 
2780
  sql_print_error("After lock_thread_count");
2691
2781
#endif
2692
2782
 
2693
2783
  /* Wait until cleanup is done */
2763
2853
inline void kill_broken_server()
2764
2854
{
2765
2855
  /* hack to get around signals ignored in syscalls for problem OS's */
2766
 
  if ((ip_sock == -1))
 
2856
  if ((!opt_disable_networking && ip_sock == INVALID_SOCKET))
2767
2857
  {
2768
2858
    select_thread_in_use = 0;
2769
2859
    /* The following call will never return */
2770
 
    kill_server((void*) DRIZZLE_KILL_SIGNAL);
 
2860
    kill_server((void*) MYSQL_KILL_SIGNAL);
2771
2861
  }
2772
2862
}
2773
2863
#define MAYBE_BROKEN_SYSCALL kill_broken_server();
2779
2869
 
2780
2870
void handle_connections_sockets()
2781
2871
{
2782
 
  int x;
2783
 
  int sock,new_sock;
2784
 
  uint32_t error_count=0;
 
2872
  my_socket sock,new_sock;
 
2873
  uint error_count=0;
 
2874
  uint max_used_connection= (uint)ip_sock+1;
 
2875
  fd_set readFDs,clientFDs;
2785
2876
  THD *thd;
2786
2877
  struct sockaddr_storage cAddr;
 
2878
  int ip_flags=0, flags;
 
2879
  st_vio *vio_tmp;
2787
2880
 
 
2881
  FD_ZERO(&clientFDs);
 
2882
  if (ip_sock != INVALID_SOCKET)
 
2883
  {
 
2884
    FD_SET(ip_sock,&clientFDs);
 
2885
    ip_flags = fcntl(ip_sock, F_GETFL, 0);
 
2886
  }
2788
2887
  MAYBE_BROKEN_SYSCALL;
2789
2888
  while (!abort_loop)
2790
2889
  {
2791
 
    int number_of;
2792
 
 
2793
 
    if ((number_of= poll(fds, pollfd_count, -1)) == -1)
 
2890
    readFDs=clientFDs;
 
2891
    if (select((int) max_used_connection,&readFDs,0,0,0) < 0)
2794
2892
    {
2795
 
      if (errno != EINTR)
 
2893
      if (socket_errno != SOCKET_EINTR)
2796
2894
      {
2797
 
        if (!select_errors++ && !abort_loop)    /* purecov: inspected */
2798
 
          sql_print_error(_("drizzled: Got error %d from select"),
2799
 
                          errno); /* purecov: inspected */
 
2895
        if (!select_errors++ && !abort_loop)    /* purecov: inspected */
 
2896
          sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
2800
2897
      }
2801
2898
      MAYBE_BROKEN_SYSCALL
2802
2899
      continue;
2803
2900
    }
2804
 
    if (number_of == 0)
2805
 
      continue;
2806
 
 
2807
 
#ifdef FIXME_IF_WE_WERE_KEEPING_THIS
2808
 
    assert(number_of > 1); /* Not handling this at the moment */
2809
 
#endif
2810
 
 
2811
2901
    if (abort_loop)
2812
2902
    {
2813
2903
      MAYBE_BROKEN_SYSCALL;
2814
2904
      break;
2815
2905
    }
2816
2906
 
2817
 
    for (x= 0, sock= -1; x < pollfd_count; x++)
 
2907
    /* Is this a new connection request ? */
2818
2908
    {
2819
 
      if (fds[x].revents == POLLIN)
2820
 
      {
2821
 
        sock= fds[x].fd;
2822
 
        break;
2823
 
      }
 
2909
      sock = ip_sock;
 
2910
      flags= ip_flags;
2824
2911
    }
2825
 
    assert(sock != -1);
2826
2912
 
2827
 
    for (uint32_t retry=0; retry < MAX_ACCEPT_RETRY; retry++)
2828
 
    {
2829
 
      SOCKET_SIZE_TYPE length= sizeof(struct sockaddr_storage);
 
2913
#if !defined(NO_FCNTL_NONBLOCK)
 
2914
    if (!(test_flags & TEST_BLOCKING))
 
2915
    {
 
2916
#if defined(O_NONBLOCK)
 
2917
      fcntl(sock, F_SETFL, flags | O_NONBLOCK);
 
2918
#elif defined(O_NDELAY)
 
2919
      fcntl(sock, F_SETFL, flags | O_NDELAY);
 
2920
#endif
 
2921
    }
 
2922
#endif /* NO_FCNTL_NONBLOCK */
 
2923
    for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++)
 
2924
    {
 
2925
      size_socket length= sizeof(struct sockaddr_storage);
2830
2926
      new_sock= accept(sock, (struct sockaddr *)(&cAddr),
2831
2927
                       &length);
2832
 
      if (new_sock != -1 || (errno != EINTR && errno != EAGAIN))
 
2928
      if (new_sock != INVALID_SOCKET ||
 
2929
          (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
2833
2930
        break;
 
2931
      MAYBE_BROKEN_SYSCALL;
 
2932
#if !defined(NO_FCNTL_NONBLOCK)
 
2933
      if (!(test_flags & TEST_BLOCKING))
 
2934
      {
 
2935
        if (retry == MAX_ACCEPT_RETRY - 1)
 
2936
          fcntl(sock, F_SETFL, flags);          // Try without O_NONBLOCK
 
2937
      }
 
2938
#endif
2834
2939
    }
2835
 
 
2836
 
 
2837
 
    if (new_sock == -1)
 
2940
#if !defined(NO_FCNTL_NONBLOCK)
 
2941
    if (!(test_flags & TEST_BLOCKING))
 
2942
      fcntl(sock, F_SETFL, flags);
 
2943
#endif
 
2944
    if (new_sock == INVALID_SOCKET)
2838
2945
    {
2839
2946
      if ((error_count++ & 255) == 0)           // This can happen often
2840
2947
        sql_perror("Error in accept");
2841
2948
      MAYBE_BROKEN_SYSCALL;
2842
 
      if (errno == ENFILE || errno == EMFILE)
 
2949
      if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
2843
2950
        sleep(1);                               // Give other threads some time
2844
2951
      continue;
2845
2952
    }
2846
2953
 
2847
2954
    {
2848
 
      SOCKET_SIZE_TYPE dummyLen;
 
2955
      size_socket dummyLen;
2849
2956
      struct sockaddr_storage dummy;
2850
2957
      dummyLen = sizeof(dummy);
2851
 
      if (  getsockname(new_sock,(struct sockaddr *)&dummy,
2852
 
                        (socklen_t *)&dummyLen) < 0  )
2853
 
      {
2854
 
        sql_perror("Error on new connection socket");
2855
 
        (void) shutdown(new_sock, SHUT_RDWR);
2856
 
        (void) close(new_sock);
2857
 
        continue;
2858
 
      }
2859
 
      dummyLen = sizeof(dummy);
2860
 
      if ( getpeername(new_sock, (struct sockaddr *)&dummy,
2861
 
                       (socklen_t *)&dummyLen) < 0)
2862
 
      {
2863
 
        sql_perror("Error on new connection socket");
2864
 
        (void) shutdown(new_sock, SHUT_RDWR);
2865
 
        (void) close(new_sock);
2866
 
         continue;
 
2958
      if (  getsockname(new_sock,(struct sockaddr *)&dummy, 
 
2959
                  (socklen_t *)&dummyLen) < 0  )
 
2960
      {
 
2961
        sql_perror("Error on new connection socket");
 
2962
        (void) shutdown(new_sock, SHUT_RDWR);
 
2963
        (void) closesocket(new_sock);
 
2964
        continue;
2867
2965
      }
2868
2966
    }
2869
2967
 
2874
2972
    if (!(thd= new THD))
2875
2973
    {
2876
2974
      (void) shutdown(new_sock, SHUT_RDWR);
2877
 
      close(new_sock);
 
2975
      VOID(closesocket(new_sock));
2878
2976
      continue;
2879
2977
    }
2880
 
    if (net_init_sock(&thd->net, new_sock, sock == 0))
 
2978
    if (!(vio_tmp=vio_new(new_sock, VIO_TYPE_TCPIP, sock == 0)) ||
 
2979
        my_net_init(&thd->net,vio_tmp))
2881
2980
    {
 
2981
      /*
 
2982
        Only delete the temporary vio if we didn't already attach it to the
 
2983
        NET object. The destructor in THD will delete any initialized net
 
2984
        structure.
 
2985
      */
 
2986
      if (vio_tmp && thd->net.vio != vio_tmp)
 
2987
        vio_delete(vio_tmp);
 
2988
      else
 
2989
      {
 
2990
        (void) shutdown(new_sock, SHUT_RDWR);
 
2991
        (void) closesocket(new_sock);
 
2992
      }
2882
2993
      delete thd;
2883
2994
      continue;
2884
2995
    }
2894
3005
 
2895
3006
enum options_mysqld
2896
3007
{
2897
 
  OPT_ISAM_LOG=256,            OPT_SKIP_NEW,
2898
 
  OPT_SKIP_GRANT,
 
3008
  OPT_ISAM_LOG=256,            OPT_SKIP_NEW, 
 
3009
  OPT_SKIP_GRANT,              OPT_SKIP_LOCK, 
2899
3010
  OPT_ENABLE_LOCK,             OPT_USE_LOCKING,
2900
3011
  OPT_SOCKET,                  OPT_UPDATE_LOG,
2901
 
  OPT_BIN_LOG,
 
3012
  OPT_BIN_LOG,                 
2902
3013
  OPT_BIN_LOG_INDEX,
2903
3014
  OPT_BIND_ADDRESS,            OPT_PID_FILE,
2904
 
  OPT_SKIP_PRIOR,
 
3015
  OPT_SKIP_PRIOR,              OPT_BIG_TABLES,
2905
3016
  OPT_STANDALONE,
2906
3017
  OPT_CONSOLE,                 OPT_LOW_PRIORITY_UPDATES,
2907
3018
  OPT_SHORT_LOG_FORMAT,
2908
3019
  OPT_FLUSH,                   OPT_SAFE,
 
3020
  OPT_BOOTSTRAP,               OPT_SKIP_SHOW_DB,
2909
3021
  OPT_STORAGE_ENGINE,          OPT_INIT_FILE,
2910
 
  OPT_DELAY_KEY_WRITE_ALL,
 
3022
  OPT_DELAY_KEY_WRITE_ALL,     OPT_SLOW_QUERY_LOG,
2911
3023
  OPT_DELAY_KEY_WRITE,         OPT_CHARSETS_DIR,
2912
3024
  OPT_MASTER_INFO_FILE,
2913
3025
  OPT_MASTER_RETRY_COUNT,      OPT_LOG_TC, OPT_LOG_TC_SIZE,
2915
3027
  OPT_REPLICATE_IGNORE_DB,     OPT_LOG_SLAVE_UPDATES,
2916
3028
  OPT_BINLOG_DO_DB,            OPT_BINLOG_IGNORE_DB,
2917
3029
  OPT_BINLOG_FORMAT,
2918
 
  OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
 
3030
  OPT_BINLOG_ROWS_EVENT_MAX_SIZE, 
2919
3031
  OPT_WANT_CORE,
2920
3032
  OPT_MEMLOCK,                 OPT_MYISAM_RECOVER,
2921
3033
  OPT_REPLICATE_REWRITE_DB,    OPT_SERVER_ID,
2925
3037
  OPT_REPLICATE_WILD_IGNORE_TABLE, OPT_REPLICATE_SAME_SERVER_ID,
2926
3038
  OPT_DISCONNECT_SLAVE_EVENT_COUNT, OPT_TC_HEURISTIC_RECOVER,
2927
3039
  OPT_ABORT_SLAVE_EVENT_COUNT,
2928
 
  OPT_ENGINE_CONDITION_PUSHDOWN,
 
3040
  OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
 
3041
  OPT_ENGINE_CONDITION_PUSHDOWN, 
2929
3042
  OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
2930
3043
  OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
2931
3044
  OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
2941
3054
  OPT_SSL_CAPATH, OPT_SSL_CIPHER,
2942
3055
  OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE,
2943
3056
  OPT_CONNECT_TIMEOUT,
2944
 
  OPT_FLUSH_TIME,
 
3057
  OPT_FLUSH_TIME, OPT_FT_MIN_WORD_LEN, OPT_FT_BOOLEAN_SYNTAX,
2945
3058
  OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
2946
3059
  OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE,
2947
3060
  OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
2950
3063
  OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
2951
3064
  OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
2952
3065
  OPT_MAX_HEP_TABLE_SIZE,
2953
 
  OPT_MAX_JOIN_SIZE,
 
3066
  OPT_MAX_JOIN_SIZE, OPT_MAX_PREPARED_STMT_COUNT,
2954
3067
  OPT_MAX_RELAY_LOG_SIZE, OPT_MAX_SORT_LENGTH,
2955
3068
  OPT_MAX_SEEKS_FOR_KEY, OPT_MAX_TMP_TABLES, OPT_MAX_USER_CONNECTIONS,
2956
3069
  OPT_MAX_LENGTH_FOR_SORT_DATA,
2964
3077
  OPT_NET_READ_TIMEOUT, OPT_NET_WRITE_TIMEOUT,
2965
3078
  OPT_OPEN_FILES_LIMIT,
2966
3079
  OPT_PRELOAD_BUFFER_SIZE,
2967
 
  OPT_RECORD_BUFFER,
 
3080
  OPT_QUERY_CACHE_LIMIT, OPT_QUERY_CACHE_MIN_RES_UNIT, OPT_QUERY_CACHE_SIZE,
 
3081
  OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER,
2968
3082
  OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT,
2969
3083
  OPT_RELAY_LOG_PURGE,
2970
3084
  OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME,
2997
3111
  OPT_DATE_FORMAT,
2998
3112
  OPT_TIME_FORMAT,
2999
3113
  OPT_DATETIME_FORMAT,
 
3114
  OPT_LOG_QUERIES_NOT_USING_INDEXES,
3000
3115
  OPT_DEFAULT_TIME_ZONE,
3001
3116
  OPT_SYSDATE_IS_NOW,
3002
3117
  OPT_OPTIMIZER_SEARCH_DEPTH,
3006
3121
  OPT_ENABLE_LARGE_PAGES,
3007
3122
  OPT_TIMED_MUTEXES,
3008
3123
  OPT_OLD_STYLE_USER_LIMITS,
 
3124
  OPT_LOG_SLOW_ADMIN_STATEMENTS,
3009
3125
  OPT_TABLE_LOCK_WAIT_TIMEOUT,
3010
3126
  OPT_PLUGIN_LOAD,
3011
3127
  OPT_PLUGIN_DIR,
 
3128
  OPT_LOG_OUTPUT,
3012
3129
  OPT_PORT_OPEN_TIMEOUT,
3013
3130
  OPT_PROFILING,
3014
3131
  OPT_KEEP_FILES_ON_CREATE,
3015
3132
  OPT_GENERAL_LOG,
 
3133
  OPT_SLOW_LOG,
3016
3134
  OPT_THREAD_HANDLING,
3017
3135
  OPT_INNODB_ROLLBACK_ON_TIMEOUT,
3018
3136
  OPT_SECURE_FILE_PRIV,
3019
3137
  OPT_MIN_EXAMINED_ROW_LIMIT,
 
3138
  OPT_LOG_SLOW_SLAVE_STATEMENTS,
3020
3139
  OPT_OLD_MODE,
3021
3140
  OPT_POOL_OF_THREADS,
3022
3141
  OPT_SLAVE_EXEC_MODE
3023
3142
};
3024
3143
 
3025
3144
 
3026
 
#define LONG_TIMEOUT ((uint32_t) 3600L*24L*365L)
 
3145
#define LONG_TIMEOUT ((ulong) 3600L*24L*365L)
3027
3146
 
3028
3147
struct my_option my_long_options[] =
3029
3148
{
3030
 
  {"help", '?', N_("Display this help and exit."),
 
3149
  {"help", '?', "Display this help and exit.", 
3031
3150
   (char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
3032
3151
   0, 0},
3033
3152
  {"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
3034
 
   N_("Option used by mysql-test for debugging and testing of replication."),
 
3153
   "Option used by mysql-test for debugging and testing of replication.",
3035
3154
   (char**) &abort_slave_event_count,  (char**) &abort_slave_event_count,
3036
3155
   0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3156
  {"ansi", 'a', "Use ANSI SQL syntax instead of MySQL syntax. This mode will also set transaction isolation level 'serializable'.", 0, 0, 0,
 
3157
   GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3037
3158
  {"auto-increment-increment", OPT_AUTO_INCREMENT,
3038
 
   N_("Auto-increment columns are incremented by this"),
 
3159
   "Auto-increment columns are incremented by this",
3039
3160
   (char**) &global_system_variables.auto_increment_increment,
3040
3161
   (char**) &max_system_variables.auto_increment_increment, 0, GET_ULONG,
3041
3162
   OPT_ARG, 1, 1, 65535, 0, 1, 0 },
3042
3163
  {"auto-increment-offset", OPT_AUTO_INCREMENT_OFFSET,
3043
 
   N_("Offset added to Auto-increment columns. Used when "
3044
 
      "auto-increment-increment != 1"),
 
3164
   "Offset added to Auto-increment columns. Used when auto-increment-increment != 1",
3045
3165
   (char**) &global_system_variables.auto_increment_offset,
3046
3166
   (char**) &max_system_variables.auto_increment_offset, 0, GET_ULONG, OPT_ARG,
3047
3167
   1, 1, 65535, 0, 1, 0 },
3048
3168
  {"basedir", 'b',
3049
 
   N_("Path to installation directory. All paths are usually resolved "
3050
 
      "relative to this."),
 
3169
   "Path to installation directory. All paths are usually resolved relative to this.",
3051
3170
   (char**) &mysql_home_ptr, (char**) &mysql_home_ptr, 0, GET_STR, REQUIRED_ARG,
3052
3171
   0, 0, 0, 0, 0, 0},
3053
 
  {"bind-address", OPT_BIND_ADDRESS, N_("IP address to bind to."),
 
3172
  {"big-tables", OPT_BIG_TABLES,
 
3173
   "Allow big result sets by saving all temporary sets on file (Solves most 'table full' errors).",
 
3174
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3175
  {"bind-address", OPT_BIND_ADDRESS, "IP address to bind to.",
3054
3176
   (char**) &my_bind_addr_str, (char**) &my_bind_addr_str, 0, GET_STR,
3055
3177
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3056
3178
  {"binlog_format", OPT_BINLOG_FORMAT,
3057
 
   N_("Does not have any effect without '--log-bin'. "
3058
 
      "Tell the master the form of binary logging to use: either 'row' for "
3059
 
      "row-based binary logging, or 'statement' for statement-based binary "
3060
 
      "logging, or 'mixed'. 'mixed' is statement-based binary logging except "
3061
 
      "for those statements where only row-based is correct: those which "
3062
 
      "involve user-defined functions (i.e. UDFs) or the UUID() function; for "
3063
 
      "those, row-based binary logging is automatically used. ")
 
3179
   "Does not have any effect without '--log-bin'. "
 
3180
   "Tell the master the form of binary logging to use: either 'row' for "
 
3181
   "row-based binary logging, or 'statement' for statement-based binary "
 
3182
   "logging, or 'mixed'. 'mixed' is statement-based binary logging except "
 
3183
   "for those statements where only row-based is correct: those which "
 
3184
   "involve user-defined functions (i.e. UDFs) or the UUID() function; for "
 
3185
   "those, row-based binary logging is automatically used. "
3064
3186
   ,(char**) &opt_binlog_format, (char**) &opt_binlog_format,
3065
3187
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3066
3188
  {"binlog-do-db", OPT_BINLOG_DO_DB,
3067
 
   N_("Tells the master it should log updates for the specified database, and "
3068
 
      "exclude all others not explicitly mentioned."),
 
3189
   "Tells the master it should log updates for the specified database, and exclude all others not explicitly mentioned.",
3069
3190
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3070
3191
  {"binlog-ignore-db", OPT_BINLOG_IGNORE_DB,
3071
 
   N_("Tells the master that updates to the given database should not "
3072
 
      "be logged tothe binary log."),
 
3192
   "Tells the master that updates to the given database should not be logged tothe binary log.",
3073
3193
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3074
3194
  {"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
3075
 
   N_("The maximum size of a row-based binary log event in bytes. Rows will "
3076
 
      "be grouped into events smaller than this size if possible. "
3077
 
      "The value has to be a multiple of 256."),
3078
 
   (char**) &opt_binlog_rows_event_max_size,
3079
 
   (char**) &opt_binlog_rows_event_max_size, 0,
3080
 
   GET_ULONG, REQUIRED_ARG,
3081
 
   /* def_value */ 1024, /* min_value */  256, /* max_value */ ULONG_MAX,
3082
 
   /* sub_size */     0, /* block_size */ 256,
 
3195
   "The maximum size of a row-based binary log event in bytes. Rows will be "
 
3196
   "grouped into events smaller than this size if possible. "
 
3197
   "The value has to be a multiple of 256.",
 
3198
   (char**) &opt_binlog_rows_event_max_size, 
 
3199
   (char**) &opt_binlog_rows_event_max_size, 0, 
 
3200
   GET_ULONG, REQUIRED_ARG, 
 
3201
   /* def_value */ 1024, /* min_value */  256, /* max_value */ ULONG_MAX, 
 
3202
   /* sub_size */     0, /* block_size */ 256, 
3083
3203
   /* app_type */ 0
3084
3204
  },
 
3205
#ifndef DISABLE_GRANT_OPTIONS
 
3206
  {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0,
 
3207
   GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3208
#endif
3085
3209
  {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
3086
 
   N_("Don't ignore client side character set value sent during handshake."),
 
3210
   "Don't ignore client side character set value sent during handshake.",
3087
3211
   (char**) &opt_character_set_client_handshake,
3088
3212
   (char**) &opt_character_set_client_handshake,
3089
3213
    0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
3090
3214
  {"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
3091
 
   N_("Set the filesystem character set."),
 
3215
   "Set the filesystem character set.",
3092
3216
   (char**) &character_set_filesystem_name,
3093
3217
   (char**) &character_set_filesystem_name,
3094
3218
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3095
 
  {"character-set-server", 'C',
3096
 
   N_("Set the default character set."),
 
3219
  {"character-set-server", 'C', "Set the default character set.",
3097
3220
   (char**) &default_character_set_name, (char**) &default_character_set_name,
3098
3221
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3099
3222
  {"character-sets-dir", OPT_CHARSETS_DIR,
3100
 
   N_("Directory where character sets are."), (char**) &charsets_dir,
 
3223
   "Directory where character sets are.", (char**) &charsets_dir,
3101
3224
   (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3102
 
  {"chroot", 'r',
3103
 
   N_("Chroot mysqld daemon during startup."),
 
3225
  {"chroot", 'r', "Chroot mysqld daemon during startup.",
3104
3226
   (char**) &mysqld_chroot, (char**) &mysqld_chroot, 0, GET_STR, REQUIRED_ARG,
3105
3227
   0, 0, 0, 0, 0, 0},
3106
 
  {"collation-server", OPT_DEFAULT_COLLATION,
3107
 
   N_("Set the default collation."),
 
3228
  {"collation-server", OPT_DEFAULT_COLLATION, "Set the default collation.",
3108
3229
   (char**) &default_collation_name, (char**) &default_collation_name,
3109
3230
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3110
 
  {"completion-type", OPT_COMPLETION_TYPE,
3111
 
   N_("Default completion type."),
 
3231
  {"completion-type", OPT_COMPLETION_TYPE, "Default completion type.",
3112
3232
   (char**) &global_system_variables.completion_type,
3113
3233
   (char**) &max_system_variables.completion_type, 0, GET_ULONG,
3114
3234
   REQUIRED_ARG, 0, 0, 2, 0, 1, 0},
3115
 
  {"console", OPT_CONSOLE,
3116
 
   N_("Write error output on screen."),
 
3235
  {"console", OPT_CONSOLE, "Write error output on screen; Don't remove the console window on windows.",
3117
3236
   (char**) &opt_console, (char**) &opt_console, 0, GET_BOOL, NO_ARG, 0, 0, 0,
3118
3237
   0, 0, 0},
3119
 
  {"core-file", OPT_WANT_CORE,
3120
 
   N_("Write core on errors."),
3121
 
   0, 0, 0, GET_NO_ARG,
 
3238
  {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG,
3122
3239
   NO_ARG, 0, 0, 0, 0, 0, 0},
3123
 
  {"datadir", 'h',
3124
 
   N_("Path to the database root."),
3125
 
   (char**) &mysql_data_home,
 
3240
  {"datadir", 'h', "Path to the database root.", (char**) &mysql_data_home,
3126
3241
   (char**) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3242
  {"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).",
 
3243
   (char**) &default_character_set_name, (char**) &default_character_set_name,
 
3244
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
 
3245
  {"default-collation", OPT_DEFAULT_COLLATION, "Set the default collation (deprecated option, use --collation-server instead).",
 
3246
   (char**) &default_collation_name, (char**) &default_collation_name,
 
3247
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3127
3248
  {"default-storage-engine", OPT_STORAGE_ENGINE,
3128
 
   N_("Set the default storage engine (table type) for tables."),
3129
 
   (char**)&default_storage_engine_str, (char**)&default_storage_engine_str,
3130
 
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3131
 
  {"default-time-zone", OPT_DEFAULT_TIME_ZONE,
3132
 
   N_("Set the default time zone."),
 
3249
   "Set the default storage engine (table type) for tables.",
 
3250
   (char**)&default_storage_engine_str, (char**)&default_storage_engine_str,
 
3251
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3252
  {"default-table-type", OPT_STORAGE_ENGINE,
 
3253
   "(deprecated) Use --default-storage-engine.",
 
3254
   (char**)&default_storage_engine_str, (char**)&default_storage_engine_str,
 
3255
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3256
  {"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.",
3133
3257
   (char**) &default_tz_name, (char**) &default_tz_name,
3134
3258
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3135
 
  {"delay-key-write", OPT_DELAY_KEY_WRITE,
3136
 
   N_("Type of DELAY_KEY_WRITE."),
 
3259
  {"delay-key-write", OPT_DELAY_KEY_WRITE, "Type of DELAY_KEY_WRITE.",
3137
3260
   0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 
3261
  {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL,
 
3262
   "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).",
 
3263
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3138
3264
  {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
3139
 
   N_("Option used by mysql-test for debugging and testing of replication."),
 
3265
   "Option used by mysql-test for debugging and testing of replication.",
3140
3266
   (char**) &disconnect_slave_event_count,
3141
3267
   (char**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
3142
3268
   0, 0, 0},
3143
3269
#ifdef HAVE_STACK_TRACE_ON_SEGV
3144
 
  {"enable-pstack", OPT_DO_PSTACK,
3145
 
   N_("Print a symbolic stack trace on failure."),
 
3270
  {"enable-pstack", OPT_DO_PSTACK, "Print a symbolic stack trace on failure.",
3146
3271
   (char**) &opt_do_pstack, (char**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0,
3147
3272
   0, 0, 0, 0},
3148
3273
#endif /* HAVE_STACK_TRACE_ON_SEGV */
3149
3274
  {"engine-condition-pushdown",
3150
3275
   OPT_ENGINE_CONDITION_PUSHDOWN,
3151
 
   N_("Push supported query conditions to the storage engine."),
 
3276
   "Push supported query conditions to the storage engine.",
3152
3277
   (char**) &global_system_variables.engine_condition_pushdown,
3153
3278
   (char**) &global_system_variables.engine_condition_pushdown,
3154
3279
   0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
3155
3280
  /* See how it's handled in get_one_option() */
3156
 
  {"exit-info", 'T',
3157
 
   N_("Used for debugging;  Use at your own risk!"),
3158
 
   0, 0, 0, GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
3159
 
  {"flush", OPT_FLUSH,
3160
 
   N_("Flush tables to disk between SQL commands."),
3161
 
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3281
  {"exit-info", 'T', "Used for debugging;  Use at your own risk!", 0, 0, 0,
 
3282
   GET_LONG, OPT_ARG, 0, 0, 0, 0, 0, 0},
 
3283
  {"flush", OPT_FLUSH, "Flush tables to disk between SQL commands.", 0, 0, 0,
 
3284
   GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3162
3285
  /* We must always support the next option to make scripts like mysqltest
3163
3286
     easier to do */
3164
3287
  {"gdb", OPT_DEBUGGING,
3165
 
   N_("Set up signals usable for debugging"),
 
3288
   "Set up signals usable for debugging",
3166
3289
   (char**) &opt_debugging, (char**) &opt_debugging,
3167
3290
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3168
 
  {"init-connect", OPT_INIT_CONNECT,
3169
 
   N_("Command(s) that are executed for each new connection"),
 
3291
  {"general-log", OPT_GENERAL_LOG,
 
3292
   "Enable|disable general log", (char**) &opt_log,
 
3293
   (char**) &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
 
3294
  {"init-connect", OPT_INIT_CONNECT, "Command(s) that are executed for each new connection",
3170
3295
   (char**) &opt_init_connect, (char**) &opt_init_connect, 0, GET_STR_ALLOC,
3171
3296
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3172
 
  {"init-file", OPT_INIT_FILE,
3173
 
   N_("Read SQL commands from this file at startup."),
 
3297
  {"init-file", OPT_INIT_FILE, "Read SQL commands from this file at startup.",
3174
3298
   (char**) &opt_init_file, (char**) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
3175
3299
   0, 0, 0, 0, 0, 0},
3176
 
  {"init-slave", OPT_INIT_SLAVE,
3177
 
   N_("Command(s) that are executed when a slave connects to this master"),
 
3300
  {"init-slave", OPT_INIT_SLAVE, "Command(s) that are executed when a slave connects to this master",
3178
3301
   (char**) &opt_init_slave, (char**) &opt_init_slave, 0, GET_STR_ALLOC,
3179
3302
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3180
3303
  {"language", 'L',
3181
 
   N_("(IGNORED)"),
 
3304
   "Client error messages in given language. May be given as a full path.",
3182
3305
   (char**) &language_ptr, (char**) &language_ptr, 0, GET_STR, REQUIRED_ARG,
3183
3306
   0, 0, 0, 0, 0, 0},
3184
3307
  {"lc-time-names", OPT_LC_TIME_NAMES,
3185
 
   N_("Set the language used for the month names and the days of the week."),
 
3308
   "Set the language used for the month names and the days of the week.",
3186
3309
   (char**) &lc_time_names_name,
3187
3310
   (char**) &lc_time_names_name,
3188
3311
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
3189
3312
  {"local-infile", OPT_LOCAL_INFILE,
3190
 
   N_("Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0)."),
 
3313
   "Enable/disable LOAD DATA LOCAL INFILE (takes values 1|0).",
3191
3314
   (char**) &opt_local_infile,
3192
3315
   (char**) &opt_local_infile, 0, GET_BOOL, OPT_ARG,
3193
3316
   1, 0, 0, 0, 0, 0},
3194
 
  {"log", 'l',
3195
 
   N_("Log connections and queries to file."),
3196
 
   (char**) &opt_logname,
 
3317
  {"log", 'l', "Log connections and queries to file.", (char**) &opt_logname,
3197
3318
   (char**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3198
3319
  {"log-bin", OPT_BIN_LOG,
3199
 
   N_("Log update queries in binary format. Optional argument is the "
3200
 
      "location for the binary log files.(Strongly "
3201
 
      "recommended to avoid replication problems if server's hostname "
3202
 
      "changes)"),
 
3320
   "Log update queries in binary format. Optional (but strongly recommended "
 
3321
   "to avoid replication problems if server's hostname changes) argument "
 
3322
   "should be the chosen location for the binary log files.",
3203
3323
   (char**) &opt_bin_logname, (char**) &opt_bin_logname, 0, GET_STR_ALLOC,
3204
3324
   OPT_ARG, 0, 0, 0, 0, 0, 0},
3205
3325
  {"log-bin-index", OPT_BIN_LOG_INDEX,
3206
 
   N_("File that holds the names for last binary log files."),
 
3326
   "File that holds the names for last binary log files.",
3207
3327
   (char**) &opt_binlog_index_name, (char**) &opt_binlog_index_name, 0, GET_STR,
3208
3328
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3209
 
  {"log-error", OPT_ERROR_LOG_FILE,
3210
 
   N_("Error log file."),
 
3329
  /*
 
3330
    This option starts with "log-bin" to emphasize that it is specific of
 
3331
    binary logging.
 
3332
  */
 
3333
  {"log-bin-trust-function-creators", OPT_LOG_BIN_TRUST_FUNCTION_CREATORS,
 
3334
   "If equal to 0 (the default), then when --log-bin is used, creation of "
 
3335
   "a stored function (or trigger) is allowed only to users having the SUPER privilege "
 
3336
   "and only if this stored function (trigger) may not break binary logging."
 
3337
   "Note that if ALL connections to this server ALWAYS use row-based binary "
 
3338
   "logging, the security issues do not exist and the binary logging cannot "
 
3339
   "break, so you can safely set this to 1."
 
3340
   ,(char**) &trust_function_creators, (char**) &trust_function_creators, 0,
 
3341
   GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3342
  {"log-error", OPT_ERROR_LOG_FILE, "Error log file.",
3211
3343
   (char**) &log_error_file_ptr, (char**) &log_error_file_ptr, 0, GET_STR,
3212
3344
   OPT_ARG, 0, 0, 0, 0, 0, 0},
3213
 
  {"log-isam", OPT_ISAM_LOG,
3214
 
   N_("Log all MyISAM changes to file."),
 
3345
  {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
3215
3346
   (char**) &myisam_log_filename, (char**) &myisam_log_filename, 0, GET_STR,
3216
3347
   OPT_ARG, 0, 0, 0, 0, 0, 0},
 
3348
  {"log-long-format", '0',
 
3349
   "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", 
 
3350
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3351
#ifdef WITH_CSV_STORAGE_ENGINE
 
3352
  {"log-output", OPT_LOG_OUTPUT,
 
3353
   "Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, "
 
3354
   "FILE or NONE.",
 
3355
   (char**) &log_output_str, (char**) &log_output_str, 0,
 
3356
   GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 
3357
#endif
 
3358
  {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
 
3359
   "Log queries that are executed without benefit of any index to the slow log if it is open.",
 
3360
   (char**) &opt_log_queries_not_using_indexes, (char**) &opt_log_queries_not_using_indexes,
 
3361
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3362
  {"log-short-format", OPT_SHORT_LOG_FORMAT,
 
3363
   "Don't log extra information to update and slow-query logs.",
 
3364
   (char**) &opt_short_log_format, (char**) &opt_short_log_format,
 
3365
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3217
3366
  {"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
3218
 
   N_("Tells the slave to log the updates from the slave thread to the binary "
3219
 
      "log. You will need to turn it on if you plan to "
3220
 
      "daisy-chain the slaves."),
3221
 
   (char**) &opt_log_slave_updates, (char**) &opt_log_slave_updates,
3222
 
   0, GET_BOOL,
 
3367
   "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.",
 
3368
   (char**) &opt_log_slave_updates, (char**) &opt_log_slave_updates, 0, GET_BOOL,
3223
3369
   NO_ARG, 0, 0, 0, 0, 0, 0},
 
3370
  {"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS,
 
3371
   "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open.",
 
3372
   (char**) &opt_log_slow_admin_statements,
 
3373
   (char**) &opt_log_slow_admin_statements,
 
3374
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3375
 {"log-slow-slave-statements", OPT_LOG_SLOW_SLAVE_STATEMENTS,
 
3376
  "Log slow statements executed by slave thread to the slow log if it is open.",
 
3377
  (char**) &opt_log_slow_slave_statements,
 
3378
  (char**) &opt_log_slow_slave_statements,
 
3379
  0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3380
  {"log-slow-queries", OPT_SLOW_QUERY_LOG,
 
3381
    "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.",
 
3382
   (char**) &opt_slow_logname, (char**) &opt_slow_logname, 0, GET_STR, OPT_ARG,
 
3383
   0, 0, 0, 0, 0, 0},
3224
3384
  {"log-tc", OPT_LOG_TC,
3225
 
   N_("Path to transaction coordinator log (used for transactions that affect "
3226
 
      "more than one storage engine, when binary log is disabled)"),
 
3385
   "Path to transaction coordinator log (used for transactions that affect "
 
3386
   "more than one storage engine, when binary log is disabled)",
3227
3387
   (char**) &opt_tc_log_file, (char**) &opt_tc_log_file, 0, GET_STR,
3228
3388
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3229
3389
#ifdef HAVE_MMAP
3230
 
  {"log-tc-size", OPT_LOG_TC_SIZE,
3231
 
   N_("Size of transaction coordinator log."),
 
3390
  {"log-tc-size", OPT_LOG_TC_SIZE, "Size of transaction coordinator log.",
3232
3391
   (char**) &opt_tc_log_size, (char**) &opt_tc_log_size, 0, GET_ULONG,
3233
3392
   REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0,
3234
3393
   TC_LOG_PAGE_SIZE, 0},
3235
3394
#endif
3236
 
  {"log-warnings", 'W',
3237
 
   N_("Log some not critical warnings to the log file."),
 
3395
  {"log-warnings", 'W', "Log some not critical warnings to the log file.",
3238
3396
   (char**) &global_system_variables.log_warnings,
3239
3397
   (char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
3240
3398
   0, 0, 0},
3241
3399
  {"low-priority-updates", OPT_LOW_PRIORITY_UPDATES,
3242
 
   N_("INSERT/DELETE/UPDATE has lower priority than selects."),
 
3400
   "INSERT/DELETE/UPDATE has lower priority than selects.",
3243
3401
   (char**) &global_system_variables.low_priority_updates,
3244
3402
   (char**) &max_system_variables.low_priority_updates,
3245
3403
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3246
3404
  {"master-info-file", OPT_MASTER_INFO_FILE,
3247
 
   N_("The location and name of the file that remembers the master and "
3248
 
      "where the I/O replication thread is in the master's binlogs."),
 
3405
   "The location and name of the file that remembers the master and where the I/O replication \
 
3406
thread is in the master's binlogs.",
3249
3407
   (char**) &master_info_file, (char**) &master_info_file, 0, GET_STR,
3250
3408
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3251
3409
  {"master-retry-count", OPT_MASTER_RETRY_COUNT,
3252
 
   N_("The number of tries the slave will make to connect to the master "
3253
 
      "before giving up."),
 
3410
   "The number of tries the slave will make to connect to the master before giving up.",
3254
3411
   (char**) &master_retry_count, (char**) &master_retry_count, 0, GET_ULONG,
3255
3412
   REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
3256
3413
  {"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS,
3257
 
   N_("Option used by mysql-test for debugging and testing of replication."),
 
3414
   "Option used by mysql-test for debugging and testing of replication.",
3258
3415
   (char**) &max_binlog_dump_events, (char**) &max_binlog_dump_events, 0,
3259
3416
   GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3260
 
  {"memlock", OPT_MEMLOCK,
3261
 
   N_("Lock mysqld in memory."),
3262
 
   (char**) &locked_in_memory,
 
3417
  {"memlock", OPT_MEMLOCK, "Lock mysqld in memory.", (char**) &locked_in_memory,
3263
3418
   (char**) &locked_in_memory, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3264
3419
  {"myisam-recover", OPT_MYISAM_RECOVER,
3265
 
   N_("Syntax: myisam-recover[=option[,option...]], where option can be "
3266
 
      "DEFAULT, BACKUP, FORCE or QUICK."),
 
3420
   "Syntax: myisam-recover[=option[,option...]], where option can be DEFAULT, BACKUP, FORCE or QUICK.",
3267
3421
   (char**) &myisam_recover_options_str, (char**) &myisam_recover_options_str, 0,
3268
3422
   GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
3269
 
  {"new", 'n',
3270
 
   N_("Use very new possible 'unsafe' functions."),
 
3423
  {"new", 'n', "Use very new possible 'unsafe' functions.",
3271
3424
   (char**) &global_system_variables.new_mode,
3272
3425
   (char**) &max_system_variables.new_mode,
3273
3426
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3274
3427
  {"old-alter-table", OPT_OLD_ALTER_TABLE,
3275
 
   N_("Use old, non-optimized alter table."),
 
3428
   "Use old, non-optimized alter table.",
3276
3429
   (char**) &global_system_variables.old_alter_table,
3277
3430
   (char**) &max_system_variables.old_alter_table, 0, GET_BOOL, NO_ARG,
3278
3431
   0, 0, 0, 0, 0, 0},
3279
 
  {"pid-file", OPT_PID_FILE,
3280
 
   N_("Pid file used by safe_mysqld."),
 
3432
  {"old-style-user-limits", OPT_OLD_STYLE_USER_LIMITS,
 
3433
   "Enable old-style user limits (before 5.0.3 user resources were counted per each user+host vs. per account)",
 
3434
   (char**) &opt_old_style_user_limits, (char**) &opt_old_style_user_limits,
 
3435
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
 
3436
  {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.",
3281
3437
   (char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR,
3282
3438
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3283
 
  {"port", 'P',
3284
 
   N_("Port number to use for connection or 0 for default to, in "
3285
 
      "order of preference, my.cnf, $DRIZZLE_TCP_PORT, "
3286
 
      "built-in default (" STRINGIFY_ARG(DRIZZLE_PORT) ")."),
 
3439
  {"port", 'P', "Port number to use for connection or 0 for default to, in "
 
3440
   "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 
3441
#if MYSQL_PORT_DEFAULT == 0
 
3442
   "/etc/services, "
 
3443
#endif
 
3444
   "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
3287
3445
   (char**) &mysqld_port,
3288
3446
   (char**) &mysqld_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3289
3447
  {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
3290
 
   N_("Maximum time in seconds to wait for the port to become free. "
3291
 
      "(Default: no wait)"),
3292
 
   (char**) &mysqld_port_timeout,
 
3448
   "Maximum time in seconds to wait for the port to become free. "
 
3449
   "(Default: no wait)", (char**) &mysqld_port_timeout,
3293
3450
   (char**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3294
3451
  {"relay-log", OPT_RELAY_LOG,
3295
 
   N_("The location and name to use for relay logs."),
 
3452
   "The location and name to use for relay logs.",
3296
3453
   (char**) &opt_relay_logname, (char**) &opt_relay_logname, 0,
3297
3454
   GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3298
3455
  {"relay-log-index", OPT_RELAY_LOG_INDEX,
3299
 
   N_("The location and name to use for the file that keeps a list of the "
3300
 
      "last relay logs."),
 
3456
   "The location and name to use for the file that keeps a list of the last \
 
3457
relay logs.",
3301
3458
   (char**) &opt_relaylog_index_name, (char**) &opt_relaylog_index_name, 0,
3302
3459
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3303
3460
  {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
3304
 
   N_("The location and name of the file that remembers where the SQL "
3305
 
      "replication thread is in the relay logs."),
 
3461
   "The location and name of the file that remembers where the SQL replication \
 
3462
thread is in the relay logs.",
3306
3463
   (char**) &relay_log_info_file, (char**) &relay_log_info_file, 0, GET_STR,
3307
3464
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3308
3465
  {"replicate-do-db", OPT_REPLICATE_DO_DB,
3309
 
   N_("Tells the slave thread to restrict replication to the specified "
3310
 
      "database. To specify more than one database, use the directive "
3311
 
      "multiple times, once for each database. Note that this will only work "
3312
 
      "if you do not use cross-database queries such as UPDATE "
3313
 
      "some_db.some_table SET foo='bar' while having selected a different or "
3314
 
      "no database. If you need cross database updates to work, use "
3315
 
      "replicate-wild-do-table=db_name.%."),
 
3466
   "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.%.",
3316
3467
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3317
3468
  {"replicate-do-table", OPT_REPLICATE_DO_TABLE,
3318
 
   N_("Tells the slave thread to restrict replication to the specified table. "
3319
 
      "To specify more than one table, use the directive multiple times, once "
3320
 
      "for each table. This will work for cross-database updates, in contrast "
3321
 
      "to replicate-do-db."),
 
3469
   "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.",
3322
3470
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3323
3471
  {"replicate-ignore-db", OPT_REPLICATE_IGNORE_DB,
3324
 
   N_("Tells the slave thread to not replicate to the specified database. To "
3325
 
      "specify more than one database to ignore, use the directive multiple "
3326
 
      "times, once for each database. This option will not work if you use "
3327
 
      "cross database updates. If you need cross database updates to work, "
3328
 
      "use replicate-wild-ignore-table=db_name.%. "),
 
3472
   "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.%. ",
3329
3473
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3330
3474
  {"replicate-ignore-table", OPT_REPLICATE_IGNORE_TABLE,
3331
 
   N_("Tells the slave thread to not replicate to the specified table. To "
3332
 
      "specify more than one table to ignore, use the directive multiple "
3333
 
      "times, once for each table. This will work for cross-datbase updates, "
3334
 
      "in contrast to replicate-ignore-db."),
 
3475
   "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.",
3335
3476
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3336
3477
  {"replicate-rewrite-db", OPT_REPLICATE_REWRITE_DB,
3337
 
   N_("Updates to a database with a different name than the original. "
3338
 
      "Example: replicate-rewrite-db=master_db_name->slave_db_name."),
 
3478
   "Updates to a database with a different name than the original. Example: replicate-rewrite-db=master_db_name->slave_db_name.",
3339
3479
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3340
3480
  {"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
3341
 
   N_("In replication, if set to 1, do not skip events having our server id. "
3342
 
      "Default value is 0 (to break infinite loops in circular replication). "
3343
 
      "Can't be set to 1 if --log-slave-updates is used."),
 
3481
   "In replication, if set to 1, do not skip events having our server id. \
 
3482
Default value is 0 (to break infinite loops in circular replication). \
 
3483
Can't be set to 1 if --log-slave-updates is used.",
3344
3484
   (char**) &replicate_same_server_id,
3345
3485
   (char**) &replicate_same_server_id,
3346
3486
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3347
3487
  {"replicate-wild-do-table", OPT_REPLICATE_WILD_DO_TABLE,
3348
 
   N_("Tells the slave thread to restrict replication to the tables that "
3349
 
      "match the specified wildcard pattern. To specify more than one table, "
3350
 
      "use the directive multiple times, once for each table. This will work "
3351
 
      "for cross-database updates. Example: replicate-wild-do-table=foo%.bar% "
3352
 
      "will replicate only updates to tables in all databases that start with "
3353
 
      "foo and whose table names start with bar."),
 
3488
   "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.",
3354
3489
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3355
3490
  {"replicate-wild-ignore-table", OPT_REPLICATE_WILD_IGNORE_TABLE,
3356
 
   N_("Tells the slave thread to not replicate to the tables that match the "
3357
 
      "given wildcard pattern. To specify more than one table to ignore, use "
3358
 
      "the directive multiple times, once for each table. This will work for "
3359
 
      "cross-database updates. Example: replicate-wild-ignore-table=foo%.bar% "
3360
 
      "will not do updates to tables in databases that start with foo and "
3361
 
      "whose table names start with bar."),
 
3491
   "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.",
3362
3492
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3363
3493
  // In replication, we may need to tell the other servers how to connect
3364
3494
  {"report-host", OPT_REPORT_HOST,
3365
 
   N_("Hostname or IP of the slave to be reported to to the master during "
3366
 
      "slave registration. Will appear in the output of SHOW SLAVE HOSTS. "
3367
 
      "Leave unset if you do not want the slave to register itself with the "
3368
 
      "master. Note that it is not sufficient for the master to simply read "
3369
 
      "the IP of the slave off the socket once the slave connects. Due to NAT "
3370
 
      "and other routing issues, that IP may not be valid for connecting to "
3371
 
      "the slave from the master or other hosts."),
 
3495
   "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.",
3372
3496
   (char**) &report_host, (char**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
3373
3497
   0, 0, 0, 0},
3374
3498
  {"report-password", OPT_REPORT_PASSWORD, "Undocumented.",
3375
3499
   (char**) &report_password, (char**) &report_password, 0, GET_STR,
3376
3500
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3377
3501
  {"report-port", OPT_REPORT_PORT,
3378
 
   N_("Port for connecting to slave reported to the master during slave "
3379
 
      "registration. Set it only if the slave is listening on a non-default "
3380
 
      "port or if you have a special tunnel from the master or other clients "
3381
 
      "to the slave. If not sure, leave this option unset."),
 
3502
   "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.",
3382
3503
   (char**) &report_port, (char**) &report_port, 0, GET_UINT, REQUIRED_ARG,
3383
 
   DRIZZLE_PORT, 0, 0, 0, 0, 0},
3384
 
  {"safe-mode", OPT_SAFE,
3385
 
   N_("Skip some optimize stages (for testing)."),
 
3504
   MYSQL_PORT, 0, 0, 0, 0, 0},
 
3505
  {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).",
3386
3506
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3387
3507
  {"secure-file-priv", OPT_SECURE_FILE_PRIV,
3388
 
   N_("Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
3389
 
      "within specified directory"),
 
3508
   "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory",
3390
3509
   (char**) &opt_secure_file_priv, (char**) &opt_secure_file_priv, 0,
3391
3510
   GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3392
3511
  {"server-id", OPT_SERVER_ID,
3393
 
   N_("Uniquely identifies the server instance in the community of "
3394
 
      "replication partners."),
 
3512
   "Uniquely identifies the server instance in the community of replication partners.",
3395
3513
   (char**) &server_id, (char**) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
3396
3514
   0, 0, 0},
3397
 
  {"skip-new", OPT_SKIP_NEW,
3398
 
   N_("Don't use new, possible wrong routines."),
 
3515
  {"set-variable", 'O',
 
3516
   "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.",
 
3517
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3518
  {"skip-new", OPT_SKIP_NEW, "Don't use new, possible wrong routines.",
3399
3519
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3400
3520
  {"skip-slave-start", OPT_SKIP_SLAVE_START,
3401
 
   N_("If set, slave is not autostarted."),
3402
 
   (char**) &opt_skip_slave_start,
 
3521
   "If set, slave is not autostarted.", (char**) &opt_skip_slave_start,
3403
3522
   (char**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3404
3523
  {"skip-stack-trace", OPT_SKIP_STACK_TRACE,
3405
 
   N_("Don't print a stack trace on failure."),
3406
 
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
 
3524
   "Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
3407
3525
   0, 0, 0, 0},
 
3526
  {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option.  Use --skip-symbolic-links instead.",
 
3527
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3408
3528
  {"skip-thread-priority", OPT_SKIP_PRIOR,
3409
 
   N_("Don't give threads different priorities."),
3410
 
   0, 0, 0, GET_NO_ARG, NO_ARG,
 
3529
   "Don't give threads different priorities.", 0, 0, 0, GET_NO_ARG, NO_ARG,
3411
3530
   DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
3412
3531
  {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
3413
 
   N_("The location where the slave should put its temporary files when "
3414
 
      "replicating a LOAD DATA INFILE command."),
 
3532
   "The location where the slave should put its temporary files when \
 
3533
replicating a LOAD DATA INFILE command.",
3415
3534
   (char**) &slave_load_tmpdir, (char**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
3416
3535
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3417
3536
  {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
3418
 
   N_("Tells the slave thread to continue replication when a query event "
3419
 
      "returns an error from the provided list."),
 
3537
   "Tells the slave thread to continue replication when a query event returns an error from the provided list.",
3420
3538
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3421
3539
  {"slave-exec-mode", OPT_SLAVE_EXEC_MODE,
3422
 
   N_("Modes for how replication events should be executed.  Legal values are "
3423
 
      "STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will "
3424
 
      "not stop for operations that are idempotent. In STRICT mode, "
3425
 
      "replication will stop on any unexpected difference between the master "
3426
 
      "and the slave."),
3427
 
   (char**) &slave_exec_mode_str, (char**) &slave_exec_mode_str,
3428
 
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3540
   "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.",
 
3541
   (char**) &slave_exec_mode_str, (char**) &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
 
3542
  {"slow-query-log", OPT_SLOW_LOG,
 
3543
   "Enable|disable slow query log", (char**) &opt_slow_log,
 
3544
   (char**) &opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
3429
3545
  {"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
3430
 
   N_("(INGORED)"),
 
3546
   "The update log is deprecated since version 5.0, is replaced by the binary \
 
3547
log and this option does nothing anymore.",
3431
3548
   0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0},
3432
 
  {"symbolic-links", 's',
3433
 
   N_("Enable symbolic link support."),
 
3549
  {"symbolic-links", 's', "Enable symbolic link support.",
3434
3550
   (char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
3435
3551
   /*
3436
3552
     The system call realpath() produces warnings under valgrind and
3439
3555
   */
3440
3556
   IF_PURIFY(0,1), 0, 0, 0, 0, 0},
3441
3557
  {"sysdate-is-now", OPT_SYSDATE_IS_NOW,
3442
 
   N_("Non-default option to alias SYSDATE() to NOW() to make it "
3443
 
      "safe-replicable."),
 
3558
   "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.",
3444
3559
   (char**) &global_system_variables.sysdate_is_now,
3445
3560
   0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3446
3561
  {"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER,
3447
 
   N_("Decision to use in heuristic recover process. Possible values are "
3448
 
      "COMMIT or ROLLBACK."),
 
3562
   "Decision to use in heuristic recover process. Possible values are COMMIT or ROLLBACK.",
3449
3563
   (char**) &opt_tc_heuristic_recover, (char**) &opt_tc_heuristic_recover,
3450
3564
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3451
3565
  {"temp-pool", OPT_TEMP_POOL,
3452
 
   N_("Using this option will cause most temporary files created to use a "
3453
 
      "small set of names, rather than a unique name for each new file."),
 
3566
   "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.",
3454
3567
   (char**) &use_temp_pool, (char**) &use_temp_pool, 0, GET_BOOL, NO_ARG, 1,
3455
3568
   0, 0, 0, 0, 0},
3456
3569
  {"timed_mutexes", OPT_TIMED_MUTEXES,
3457
 
   N_("Specify whether to time mutexes (only InnoDB mutexes are currently "
3458
 
      "supported)"),
3459
 
   (char**) &timed_mutexes, (char**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0,
 
3570
   "Specify whether to time mutexes (only InnoDB mutexes are currently supported)",
 
3571
   (char**) &timed_mutexes, (char**) &timed_mutexes, 0, GET_BOOL, NO_ARG, 0, 
3460
3572
    0, 0, 0, 0, 0},
3461
3573
  {"tmpdir", 't',
3462
 
   N_("Path for temporary files. Several paths may be specified, separated "
3463
 
      "by a colon (:)"
3464
 
      ", in this case they are used in a round-robin fashion."),
 
3574
   "Path for temporary files. Several paths may be specified, separated by a "
 
3575
   "colon (:)"
 
3576
   ", in this case they are used in a round-robin fashion.",
3465
3577
   (char**) &opt_mysql_tmpdir,
3466
3578
   (char**) &opt_mysql_tmpdir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3467
3579
  {"transaction-isolation", OPT_TX_ISOLATION,
3468
 
   N_("Default transaction isolation level."),
3469
 
   0, 0, 0, GET_STR, REQUIRED_ARG, 0,
 
3580
   "Default transaction isolation level.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0,
3470
3581
   0, 0, 0, 0, 0},
3471
 
  {"user", 'u',
3472
 
   N_("Run mysqld daemon as user."),
3473
 
   0, 0, 0, GET_STR, REQUIRED_ARG,
 
3582
  {"use-symbolic-links", 's', "Enable symbolic link support. Deprecated option; use --symbolic-links instead.",
 
3583
   (char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
 
3584
   IF_PURIFY(0,1), 0, 0, 0, 0, 0},
 
3585
  {"user", 'u', "Run mysqld daemon as user.", 0, 0, 0, GET_STR, REQUIRED_ARG,
3474
3586
   0, 0, 0, 0, 0, 0},
3475
 
  {"version", 'V',
3476
 
   N_("Output version information and exit."),
3477
 
   0, 0, 0, GET_NO_ARG,
 
3587
  {"verbose", 'v', "Used with --help option for detailed help",
 
3588
   (char**) &opt_verbose, (char**) &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
 
3589
   0, 0},
 
3590
  {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
3478
3591
   NO_ARG, 0, 0, 0, 0, 0, 0},
3479
 
  {"back_log", OPT_BACK_LOG,
3480
 
   N_("The number of outstanding connection requests MySQL can have. This "
3481
 
      "comes into play when the main MySQL thread gets very many connection "
3482
 
      "requests in a very short time."),
 
3592
  {"warnings", 'W', "Deprecated; use --log-warnings instead.",
 
3593
   (char**) &global_system_variables.log_warnings,
 
3594
   (char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG,
 
3595
   1, 0, ULONG_MAX, 0, 0, 0},
 
3596
  { "back_log", OPT_BACK_LOG,
 
3597
    "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.",
3483
3598
    (char**) &back_log, (char**) &back_log, 0, GET_ULONG,
3484
3599
    REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
3485
 
  { "binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
3486
 
    N_("The size of the cache to hold the SQL statements for the binary log "
3487
 
       "during a transaction. If you often use big, multi-statement "
3488
 
       "transactions you can increase this to get more performance."),
3489
 
    (char**) &binlog_cache_size, (char**) &binlog_cache_size, 0, GET_ULONG,
3490
 
    REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3491
 
  { "bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
3492
 
    N_("Size of tree cache used in bulk insert optimisation. Note that this is "
3493
 
       "a limit per thread!"),
3494
 
    (char**) &global_system_variables.bulk_insert_buff_size,
3495
 
    (char**) &max_system_variables.bulk_insert_buff_size,
3496
 
    0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
3497
 
  { "connect_timeout", OPT_CONNECT_TIMEOUT,
3498
 
    N_("The number of seconds the mysqld server is waiting for a connect "
3499
 
       "packet before responding with 'Bad handshake'."),
 
3600
  {"binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
 
3601
   "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.",
 
3602
   (char**) &binlog_cache_size, (char**) &binlog_cache_size, 0, GET_ULONG,
 
3603
   REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
 
3604
  {"bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
 
3605
   "Size of tree cache used in bulk insert optimisation. Note that this is a limit per thread!",
 
3606
   (char**) &global_system_variables.bulk_insert_buff_size,
 
3607
   (char**) &max_system_variables.bulk_insert_buff_size,
 
3608
   0, GET_ULONG, REQUIRED_ARG, 8192*1024, 0, ULONG_MAX, 0, 1, 0},
 
3609
  {"connect_timeout", OPT_CONNECT_TIMEOUT,
 
3610
   "The number of seconds the mysqld server is waiting for a connect packet before responding with 'Bad handshake'.",
3500
3611
    (char**) &connect_timeout, (char**) &connect_timeout,
3501
 
    0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
 
3612
   0, GET_ULONG, REQUIRED_ARG, CONNECT_TIMEOUT, 2, LONG_TIMEOUT, 0, 1, 0 },
3502
3613
  { "date_format", OPT_DATE_FORMAT,
3503
 
    N_("The DATE format (For future)."),
3504
 
    (char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATE],
3505
 
    (char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATE],
 
3614
    "The DATE format (For future).",
 
3615
    (char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
 
3616
    (char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATE],
3506
3617
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3507
3618
  { "datetime_format", OPT_DATETIME_FORMAT,
3508
 
    N_("The DATETIME/TIMESTAMP format (for future)."),
3509
 
    (char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATETIME],
3510
 
    (char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_DATETIME],
 
3619
    "The DATETIME/TIMESTAMP format (for future).",
 
3620
    (char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
 
3621
    (char**) &opt_date_time_formats[MYSQL_TIMESTAMP_DATETIME],
3511
3622
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3512
3623
  { "default_week_format", OPT_DEFAULT_WEEK_FORMAT,
3513
 
    N_("The default week format used by WEEK() functions."),
 
3624
    "The default week format used by WEEK() functions.",
3514
3625
    (char**) &global_system_variables.default_week_format,
3515
3626
    (char**) &max_system_variables.default_week_format,
3516
3627
    0, GET_ULONG, REQUIRED_ARG, 0, 0, 7L, 0, 1, 0},
3517
 
  { "div_precision_increment", OPT_DIV_PRECINCREMENT,
3518
 
   N_("Precision of the result of '/' operator will be increased on that "
3519
 
      "value."),
 
3628
  {"div_precision_increment", OPT_DIV_PRECINCREMENT,
 
3629
   "Precision of the result of '/' operator will be increased on that value.",
3520
3630
   (char**) &global_system_variables.div_precincrement,
3521
3631
   (char**) &max_system_variables.div_precincrement, 0, GET_ULONG,
3522
3632
   REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
3523
 
  { "expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
3524
 
    N_("If non-zero, binary logs will be purged after expire_logs_days "
3525
 
       "days; possible purges happen at startup and at binary log rotation."),
3526
 
    (char**) &expire_logs_days,
3527
 
    (char**) &expire_logs_days, 0, GET_ULONG,
3528
 
    REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
 
3633
  {"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
 
3634
   "If non-zero, binary logs will be purged after expire_logs_days "
 
3635
   "days; possible purges happen at startup and at binary log rotation.",
 
3636
   (char**) &expire_logs_days,
 
3637
   (char**) &expire_logs_days, 0, GET_ULONG,
 
3638
   REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
 
3639
  { "flush_time", OPT_FLUSH_TIME,
 
3640
    "A dedicated thread is created to flush all tables at the given interval.",
 
3641
    (char**) &flush_time, (char**) &flush_time, 0, GET_ULONG, REQUIRED_ARG,
 
3642
    FLUSH_TIME, 0, LONG_TIMEOUT, 0, 1, 0},
3529
3643
  { "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN,
3530
 
    N_("The maximum length of the result of function  group_concat."),
 
3644
    "The maximum length of the result of function  group_concat.",
3531
3645
    (char**) &global_system_variables.group_concat_max_len,
3532
3646
    (char**) &max_system_variables.group_concat_max_len, 0, GET_ULONG,
3533
3647
    REQUIRED_ARG, 1024, 4, ULONG_MAX, 0, 1, 0},
3534
 
  { "interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
3535
 
    N_("The number of seconds the server waits for activity on an interactive "
3536
 
       "connection before closing it."),
 
3648
  {"interactive_timeout", OPT_INTERACTIVE_TIMEOUT,
 
3649
   "The number of seconds the server waits for activity on an interactive connection before closing it.",
3537
3650
   (char**) &global_system_variables.net_interactive_timeout,
3538
3651
   (char**) &max_system_variables.net_interactive_timeout, 0,
3539
3652
   GET_ULONG, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3540
 
  { "join_buffer_size", OPT_JOIN_BUFF_SIZE,
3541
 
    N_("The size of the buffer that is used for full joins."),
 
3653
  {"join_buffer_size", OPT_JOIN_BUFF_SIZE,
 
3654
   "The size of the buffer that is used for full joins.",
3542
3655
   (char**) &global_system_variables.join_buff_size,
3543
3656
   (char**) &max_system_variables.join_buff_size, 0, GET_ULONG,
3544
3657
   REQUIRED_ARG, 128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, ULONG_MAX,
3545
3658
   MALLOC_OVERHEAD, IO_SIZE, 0},
3546
3659
  {"keep_files_on_create", OPT_KEEP_FILES_ON_CREATE,
3547
 
   N_("Don't overwrite stale .MYD and .MYI even if no directory is specified."),
 
3660
   "Don't overwrite stale .MYD and .MYI even if no directory is specified.",
3548
3661
   (char**) &global_system_variables.keep_files_on_create,
3549
3662
   (char**) &max_system_variables.keep_files_on_create,
3550
3663
   0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
3551
3664
  {"key_buffer_size", OPT_KEY_BUFFER_SIZE,
3552
 
   N_("The size of the buffer used for index blocks for MyISAM tables. "
3553
 
      "Increase this to get better index handling (for all reads and multiple "
3554
 
      "writes) to as much as you can afford;"),
 
3665
   "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.",
3555
3666
   (char**) &dflt_key_cache_var.param_buff_size,
3556
3667
   (char**) 0,
3557
3668
   0, (GET_ULL | GET_ASK_ADDR),
3558
3669
   REQUIRED_ARG, KEY_CACHE_SIZE, MALLOC_OVERHEAD, SIZE_T_MAX, MALLOC_OVERHEAD,
3559
3670
   IO_SIZE, 0},
3560
3671
  {"key_cache_age_threshold", OPT_KEY_CACHE_AGE_THRESHOLD,
3561
 
   N_("This characterizes the number of hits a hot block has to be untouched "
3562
 
      "until it is considered aged enough to be downgraded to a warm block. "
3563
 
      "This specifies the percentage ratio of that number of hits to the "
3564
 
      "total number of blocks in key cache"),
 
3672
   "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",
3565
3673
   (char**) &dflt_key_cache_var.param_age_threshold,
3566
3674
   (char**) 0,
3567
 
   0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
 
3675
   0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, 
3568
3676
   300, 100, ULONG_MAX, 0, 100, 0},
3569
3677
  {"key_cache_block_size", OPT_KEY_CACHE_BLOCK_SIZE,
3570
 
   N_("The default size of key cache blocks"),
 
3678
   "The default size of key cache blocks",
3571
3679
   (char**) &dflt_key_cache_var.param_block_size,
3572
3680
   (char**) 0,
3573
3681
   0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG,
3574
3682
   KEY_CACHE_BLOCK_SIZE, 512, 1024 * 16, 0, 512, 0},
3575
3683
  {"key_cache_division_limit", OPT_KEY_CACHE_DIVISION_LIMIT,
3576
 
   N_("The minimum percentage of warm blocks in key cache"),
 
3684
   "The minimum percentage of warm blocks in key cache",
3577
3685
   (char**) &dflt_key_cache_var.param_division_limit,
3578
3686
   (char**) 0,
3579
3687
   0, (GET_ULONG | GET_ASK_ADDR) , REQUIRED_ARG, 100,
3580
3688
   1, 100, 0, 1, 0},
3581
3689
  {"long_query_time", OPT_LONG_QUERY_TIME,
3582
 
   N_("Log all queries that have taken more than long_query_time seconds to "
3583
 
      "execute to file. The argument will be treated as a decimal value with "
3584
 
      "microsecond precission."),
 
3690
   "Log all queries that have taken more than long_query_time seconds to execute to file. "
 
3691
   "The argument will be treated as a decimal value with microsecond precission.",
3585
3692
   (char**) &long_query_time, (char**) &long_query_time, 0, GET_DOUBLE,
3586
3693
   REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
 
3694
  {"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
 
3695
   "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",
 
3696
   (char**) &lower_case_table_names,
 
3697
   (char**) &lower_case_table_names, 0, GET_UINT, OPT_ARG,
 
3698
#ifdef FN_NO_CASE_SENCE
 
3699
    1
 
3700
#else
 
3701
    0
 
3702
#endif
 
3703
   , 0, 2, 0, 1, 0},
3587
3704
  {"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
3588
 
   N_("Max packetlength to send/receive from to server."),
 
3705
   "Max packetlength to send/receive from to server.",
3589
3706
   (char**) &global_system_variables.max_allowed_packet,
3590
3707
   (char**) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
3591
3708
   REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
3592
3709
  {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
3593
 
   N_("Can be used to restrict the total size used to cache a "
3594
 
      "multi-transaction query."),
 
3710
   "Can be used to restrict the total size used to cache a multi-transaction query.",
3595
3711
   (char**) &max_binlog_cache_size, (char**) &max_binlog_cache_size, 0,
3596
3712
   GET_ULONG, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3597
3713
  {"max_binlog_size", OPT_MAX_BINLOG_SIZE,
3598
 
   N_("Binary log will be rotated automatically when the size exceeds this "
3599
 
      "value. Will also apply to relay logs if max_relay_log_size is 0. "
3600
 
      "The minimum value for this variable is 4096."),
 
3714
   "Binary log will be rotated automatically when the size exceeds this \
 
3715
value. Will also apply to relay logs if max_relay_log_size is 0. \
 
3716
The minimum value for this variable is 4096.",
3601
3717
   (char**) &max_binlog_size, (char**) &max_binlog_size, 0, GET_ULONG,
3602
3718
   REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0},
3603
3719
  {"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
3604
 
   N_("If there is more than this number of interrupted connections from a "
3605
 
      "host this host will be blocked from further connections."),
 
3720
   "If there is more than this number of interrupted connections from a host this host will be blocked from further connections.",
3606
3721
   (char**) &max_connect_errors, (char**) &max_connect_errors, 0, GET_ULONG,
3607
 
   REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0},
 
3722
    REQUIRED_ARG, MAX_CONNECT_ERRORS, 1, ULONG_MAX, 0, 1, 0},
3608
3723
  // Default max_connections of 151 is larger than Apache's default max
3609
3724
  // children, to avoid "too many connections" error in a common setup
3610
3725
  {"max_connections", OPT_MAX_CONNECTIONS,
3611
 
   N_("The number of simultaneous clients allowed."),
3612
 
   (char**) &max_connections,
 
3726
   "The number of simultaneous clients allowed.", (char**) &max_connections,
3613
3727
   (char**) &max_connections, 0, GET_ULONG, REQUIRED_ARG, 151, 1, 100000, 0, 1,
3614
3728
   0},
3615
3729
  {"max_error_count", OPT_MAX_ERROR_COUNT,
3616
 
   N_("Max number of errors/warnings to store for a statement."),
 
3730
   "Max number of errors/warnings to store for a statement.",
3617
3731
   (char**) &global_system_variables.max_error_count,
3618
3732
   (char**) &max_system_variables.max_error_count,
3619
3733
   0, GET_ULONG, REQUIRED_ARG, DEFAULT_ERROR_COUNT, 0, 65535, 0, 1, 0},
3620
3734
  {"max_heap_table_size", OPT_MAX_HEP_TABLE_SIZE,
3621
 
   N_("Don't allow creation of heap tables bigger than this."),
 
3735
   "Don't allow creation of heap tables bigger than this.",
3622
3736
   (char**) &global_system_variables.max_heap_table_size,
3623
3737
   (char**) &max_system_variables.max_heap_table_size, 0, GET_ULL,
3624
3738
   REQUIRED_ARG, 16*1024*1024L, 16384, MAX_MEM_TABLE_SIZE,
3625
3739
   MALLOC_OVERHEAD, 1024, 0},
3626
3740
  {"max_join_size", OPT_MAX_JOIN_SIZE,
3627
 
   N_("Joins that are probably going to read more than max_join_size records "
3628
 
      "return an error."),
 
3741
   "Joins that are probably going to read more than max_join_size records return an error.",
3629
3742
   (char**) &global_system_variables.max_join_size,
3630
3743
   (char**) &max_system_variables.max_join_size, 0, GET_HA_ROWS, REQUIRED_ARG,
3631
 
   INT32_MAX, 1, INT32_MAX, 0, 1, 0},
3632
 
  {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
3633
 
   N_("Max number of bytes in sorted records."),
3634
 
   (char**) &global_system_variables.max_length_for_sort_data,
3635
 
   (char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
3636
 
   REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
 
3744
   ~0L, 1, ~0L, 0, 1, 0},
 
3745
   {"max_length_for_sort_data", OPT_MAX_LENGTH_FOR_SORT_DATA,
 
3746
    "Max number of bytes in sorted records.",
 
3747
    (char**) &global_system_variables.max_length_for_sort_data,
 
3748
    (char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULONG,
 
3749
    REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3637
3750
  {"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
3638
 
   N_("If non-zero: relay log will be rotated automatically when the size "
3639
 
      "exceeds this value; if zero (the default): when the size exceeds "
3640
 
      "max_binlog_size. 0 excepted, the minimum value for this variable "
3641
 
      "is 4096."),
 
3751
   "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.",
3642
3752
   (char**) &max_relay_log_size, (char**) &max_relay_log_size, 0, GET_ULONG,
3643
3753
   REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0},
3644
3754
  { "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
3645
 
    N_("Limit assumed max number of seeks when looking up rows based on a key"),
 
3755
    "Limit assumed max number of seeks when looking up rows based on a key",
3646
3756
    (char**) &global_system_variables.max_seeks_for_key,
3647
3757
    (char**) &max_system_variables.max_seeks_for_key, 0, GET_ULONG,
3648
3758
    REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0 },
3649
3759
  {"max_sort_length", OPT_MAX_SORT_LENGTH,
3650
 
   N_("The number of bytes to use when sorting BLOB or TEXT values "
3651
 
      "(only the first max_sort_length bytes of each value are used; the "
3652
 
      "rest are ignored)."),
 
3760
   "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).",
3653
3761
   (char**) &global_system_variables.max_sort_length,
3654
3762
   (char**) &max_system_variables.max_sort_length, 0, GET_ULONG,
3655
3763
   REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3656
3764
  {"max_tmp_tables", OPT_MAX_TMP_TABLES,
3657
 
   N_("Maximum number of temporary tables a client can keep open at a time."),
 
3765
   "Maximum number of temporary tables a client can keep open at a time.",
3658
3766
   (char**) &global_system_variables.max_tmp_tables,
3659
3767
   (char**) &max_system_variables.max_tmp_tables, 0, GET_ULONG,
3660
3768
   REQUIRED_ARG, 32, 1, ULONG_MAX, 0, 1, 0},
3661
3769
  {"max_write_lock_count", OPT_MAX_WRITE_LOCK_COUNT,
3662
 
   N_("After this many write locks, allow some read locks to run in between."),
 
3770
   "After this many write locks, allow some read locks to run in between.",
3663
3771
   (char**) &max_write_lock_count, (char**) &max_write_lock_count, 0, GET_ULONG,
3664
3772
   REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0},
3665
3773
  {"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT,
3666
 
   N_("Don't log queries which examine less than min_examined_row_limit "
3667
 
      "rows to file."),
 
3774
   "Don't log queries which examine less than min_examined_row_limit rows to file.",
3668
3775
   (char**) &global_system_variables.min_examined_row_limit,
3669
3776
   (char**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG,
3670
 
   REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0},
 
3777
  REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0},
3671
3778
  {"myisam_block_size", OPT_MYISAM_BLOCK_SIZE,
3672
 
   N_("Block size to be used for MyISAM index pages."),
 
3779
   "Block size to be used for MyISAM index pages.",
3673
3780
   (char**) &opt_myisam_block_size,
3674
3781
   (char**) &opt_myisam_block_size, 0, GET_ULONG, REQUIRED_ARG,
3675
3782
   MI_KEY_BLOCK_LENGTH, MI_MIN_KEY_BLOCK_LENGTH, MI_MAX_KEY_BLOCK_LENGTH,
3676
3783
   0, MI_MIN_KEY_BLOCK_LENGTH, 0},
3677
3784
  {"myisam_data_pointer_size", OPT_MYISAM_DATA_POINTER_SIZE,
3678
 
   N_("Default pointer size to be used for MyISAM tables."),
 
3785
   "Default pointer size to be used for MyISAM tables.",
3679
3786
   (char**) &myisam_data_pointer_size,
3680
3787
   (char**) &myisam_data_pointer_size, 0, GET_ULONG, REQUIRED_ARG,
3681
3788
   6, 2, 7, 0, 1, 0},
 
3789
  {"myisam_max_extra_sort_file_size", OPT_MYISAM_MAX_EXTRA_SORT_FILE_SIZE,
 
3790
   "Deprecated option",
 
3791
   (char**) &global_system_variables.myisam_max_extra_sort_file_size,
 
3792
   (char**) &max_system_variables.myisam_max_extra_sort_file_size,
 
3793
   0, GET_ULL, REQUIRED_ARG, (uint64_t) MI_MAX_TEMP_LENGTH,
 
3794
   0, (uint64_t) MAX_FILE_SIZE, 0, 1, 0},
3682
3795
  {"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
3683
 
   N_("Don't use the fast sort index method to created index if the "
3684
 
      "temporary file would get bigger than this."),
 
3796
   "Don't use the fast sort index method to created index if the temporary file would get bigger than this.",
3685
3797
   (char**) &global_system_variables.myisam_max_sort_file_size,
3686
3798
   (char**) &max_system_variables.myisam_max_sort_file_size, 0,
3687
3799
   GET_ULL, REQUIRED_ARG, (int64_t) LONG_MAX, 0, (uint64_t) MAX_FILE_SIZE,
3688
3800
   0, 1024*1024, 0},
3689
3801
  {"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
3690
 
   N_("Number of threads to use when repairing MyISAM tables. The value of "
3691
 
      "1 disables parallel repair."),
 
3802
   "Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.",
3692
3803
   (char**) &global_system_variables.myisam_repair_threads,
3693
3804
   (char**) &max_system_variables.myisam_repair_threads, 0,
3694
3805
   GET_ULONG, REQUIRED_ARG, 1, 1, ULONG_MAX, 0, 1, 0},
3695
3806
  {"myisam_sort_buffer_size", OPT_MYISAM_SORT_BUFFER_SIZE,
3696
 
   N_("The buffer that is allocated when sorting the index when doing a "
3697
 
      "REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."),
 
3807
   "The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE.",
3698
3808
   (char**) &global_system_variables.myisam_sort_buff_size,
3699
3809
   (char**) &max_system_variables.myisam_sort_buff_size, 0,
3700
 
   GET_ULONG, REQUIRED_ARG, 8192*1024, 4, INT32_MAX, 0, 1, 0},
 
3810
   GET_ULONG, REQUIRED_ARG, 8192*1024, 4, ~0L, 0, 1, 0},
3701
3811
  {"myisam_stats_method", OPT_MYISAM_STATS_METHOD,
3702
 
   N_("Specifies how MyISAM index statistics collection code should threat "
3703
 
      "NULLs. Possible values of name are 'nulls_unequal' "
3704
 
      "(default behavior), "
3705
 
      "'nulls_equal' (emulate MySQL 4.0 behavior), and 'nulls_ignored'."),
 
3812
   "Specifies how MyISAM index statistics collection code should threat NULLs. "
 
3813
   "Possible values of name are \"nulls_unequal\" (default behavior for 4.1/5.0), "
 
3814
   "\"nulls_equal\" (emulate 4.0 behavior), and \"nulls_ignored\".",
3706
3815
   (char**) &myisam_stats_method_str, (char**) &myisam_stats_method_str, 0,
3707
3816
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3708
3817
  {"net_buffer_length", OPT_NET_BUFFER_LENGTH,
3709
 
   N_("Buffer length for TCP/IP and socket communication."),
 
3818
   "Buffer length for TCP/IP and socket communication.",
3710
3819
   (char**) &global_system_variables.net_buffer_length,
3711
3820
   (char**) &max_system_variables.net_buffer_length, 0, GET_ULONG,
3712
3821
   REQUIRED_ARG, 16384, 1024, 1024*1024L, 0, 1024, 0},
3713
3822
  {"net_read_timeout", OPT_NET_READ_TIMEOUT,
3714
 
   N_("Number of seconds to wait for more data from a connection before "
3715
 
      "aborting the read."),
 
3823
   "Number of seconds to wait for more data from a connection before aborting the read.",
3716
3824
   (char**) &global_system_variables.net_read_timeout,
3717
3825
   (char**) &max_system_variables.net_read_timeout, 0, GET_ULONG,
3718
3826
   REQUIRED_ARG, NET_READ_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3719
3827
  {"net_retry_count", OPT_NET_RETRY_COUNT,
3720
 
   N_("If a read on a communication port is interrupted, retry this many "
3721
 
      "times before giving up."),
 
3828
   "If a read on a communication port is interrupted, retry this many times before giving up.",
3722
3829
   (char**) &global_system_variables.net_retry_count,
3723
3830
   (char**) &max_system_variables.net_retry_count,0,
3724
3831
   GET_ULONG, REQUIRED_ARG, MYSQLD_NET_RETRY_COUNT, 1, ULONG_MAX, 0, 1, 0},
3725
3832
  {"net_write_timeout", OPT_NET_WRITE_TIMEOUT,
3726
 
   N_("Number of seconds to wait for a block to be written to a connection "
3727
 
      "before aborting the write."),
 
3833
   "Number of seconds to wait for a block to be written to a connection  before aborting the write.",
3728
3834
   (char**) &global_system_variables.net_write_timeout,
3729
3835
   (char**) &max_system_variables.net_write_timeout, 0, GET_ULONG,
3730
3836
   REQUIRED_ARG, NET_WRITE_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3731
 
  { "old", OPT_OLD_MODE,
3732
 
    N_("Use compatible behavior."),
 
3837
  { "old", OPT_OLD_MODE, "Use compatible behavior.", 
3733
3838
    (char**) &global_system_variables.old_mode,
3734
 
    (char**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG,
 
3839
    (char**) &max_system_variables.old_mode, 0, GET_BOOL, NO_ARG, 
3735
3840
    0, 0, 0, 0, 0, 0},
3736
3841
  {"open_files_limit", OPT_OPEN_FILES_LIMIT,
3737
 
   N_("If this is not 0, then mysqld will use this value to reserve file "
3738
 
      "descriptors to use with setrlimit(). If this value is 0 then mysqld "
3739
 
      "will reserve max_connections*5 or max_connections + table_cache*2 "
3740
 
      "(whichever is larger) number of files."),
 
3842
   "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.",
3741
3843
   (char**) &open_files_limit, (char**) &open_files_limit, 0, GET_ULONG,
3742
3844
   REQUIRED_ARG, 0, 0, OS_FILE_LIMIT, 0, 1, 0},
3743
3845
  {"optimizer_prune_level", OPT_OPTIMIZER_PRUNE_LEVEL,
3744
 
   N_("Controls the heuristic(s) applied during query optimization to prune "
3745
 
      "less-promising partial plans from the optimizer search space. Meaning: "
3746
 
      "0 - do not apply any heuristic, thus perform exhaustive search; "
3747
 
      "1 - prune plans based on number of retrieved rows."),
 
3846
   "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.",
3748
3847
   (char**) &global_system_variables.optimizer_prune_level,
3749
3848
   (char**) &max_system_variables.optimizer_prune_level,
3750
3849
   0, GET_ULONG, OPT_ARG, 1, 0, 1, 0, 1, 0},
3751
3850
  {"optimizer_search_depth", OPT_OPTIMIZER_SEARCH_DEPTH,
3752
 
   N_("Maximum depth of search performed by the query optimizer. Values "
3753
 
      "larger than the number of relations in a query result in better query "
3754
 
      "plans, but take longer to compile a query. Smaller values than the "
3755
 
      "number of tables in a relation result in faster optimization, but may "
3756
 
      "produce very bad query plans. If set to 0, the system will "
3757
 
      "automatically pick a reasonable value; if set to MAX_TABLES+2, the "
3758
 
      "optimizer will switch to the original find_best (used for "
3759
 
      "testing/comparison)."),
 
3851
   "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).",
3760
3852
   (char**) &global_system_variables.optimizer_search_depth,
3761
3853
   (char**) &max_system_variables.optimizer_search_depth,
3762
3854
   0, GET_ULONG, OPT_ARG, MAX_TABLES+1, 0, MAX_TABLES+2, 0, 1, 0},
3763
3855
  {"plugin_dir", OPT_PLUGIN_DIR,
3764
 
   N_("Directory for plugins."),
 
3856
   "Directory for plugins.",
3765
3857
   (char**) &opt_plugin_dir_ptr, (char**) &opt_plugin_dir_ptr, 0,
3766
3858
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3767
3859
  {"plugin_load", OPT_PLUGIN_LOAD,
3768
 
   N_("Optional comma separated list of plugins to load, where each plugin is "
3769
 
      "identified by the name of the shared library. "
3770
 
      "[for example: --plugin_load=libmd5udf.so]"),
 
3860
   "Optional colon separated list of plugins to load, where each plugin is "
 
3861
   "identified by name and path to library seperated by an equals.",
3771
3862
   (char**) &opt_plugin_load, (char**) &opt_plugin_load, 0,
3772
3863
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3773
3864
  {"preload_buffer_size", OPT_PRELOAD_BUFFER_SIZE,
3774
 
   N_("The size of the buffer that is allocated when preloading indexes"),
 
3865
   "The size of the buffer that is allocated when preloading indexes",
3775
3866
   (char**) &global_system_variables.preload_buff_size,
3776
3867
   (char**) &max_system_variables.preload_buff_size, 0, GET_ULONG,
3777
3868
   REQUIRED_ARG, 32*1024L, 1024, 1024*1024*1024L, 0, 1, 0},
3778
3869
  {"query_alloc_block_size", OPT_QUERY_ALLOC_BLOCK_SIZE,
3779
 
   N_("Allocation block size for query parsing and execution"),
 
3870
   "Allocation block size for query parsing and execution",
3780
3871
   (char**) &global_system_variables.query_alloc_block_size,
3781
3872
   (char**) &max_system_variables.query_alloc_block_size, 0, GET_ULONG,
3782
3873
   REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3783
3874
  {"query_prealloc_size", OPT_QUERY_PREALLOC_SIZE,
3784
 
   N_("Persistent buffer for query parsing and execution"),
 
3875
   "Persistent buffer for query parsing and execution",
3785
3876
   (char**) &global_system_variables.query_prealloc_size,
3786
3877
   (char**) &max_system_variables.query_prealloc_size, 0, GET_ULONG,
3787
3878
   REQUIRED_ARG, QUERY_ALLOC_PREALLOC_SIZE, QUERY_ALLOC_PREALLOC_SIZE,
3788
3879
   ULONG_MAX, 0, 1024, 0},
3789
3880
  {"range_alloc_block_size", OPT_RANGE_ALLOC_BLOCK_SIZE,
3790
 
   N_("Allocation block size for storing ranges during optimization"),
 
3881
   "Allocation block size for storing ranges during optimization",
3791
3882
   (char**) &global_system_variables.range_alloc_block_size,
3792
3883
   (char**) &max_system_variables.range_alloc_block_size, 0, GET_ULONG,
3793
3884
   REQUIRED_ARG, RANGE_ALLOC_BLOCK_SIZE, RANGE_ALLOC_BLOCK_SIZE, ULONG_MAX,
3794
3885
   0, 1024, 0},
3795
3886
  {"read_buffer_size", OPT_RECORD_BUFFER,
3796
 
   N_("Each thread that does a sequential scan allocates a buffer of this "
3797
 
      "size for each table it scans. If you do many sequential scans, you may "
3798
 
      "want to increase this value."),
 
3887
   "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.",
3799
3888
   (char**) &global_system_variables.read_buff_size,
3800
3889
   (char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3801
 
   128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT32_MAX, MALLOC_OVERHEAD, IO_SIZE,
 
3890
   128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT_MAX32, MALLOC_OVERHEAD, IO_SIZE,
3802
3891
   0},
3803
3892
  {"read_only", OPT_READONLY,
3804
 
   N_("Make all non-temporary tables read-only, with the exception for "
3805
 
      "replication (slave) threads and users with the SUPER privilege"),
 
3893
   "Make all non-temporary tables read-only, with the exception for replication (slave) threads and users with the SUPER privilege",
3806
3894
   (char**) &opt_readonly,
3807
3895
   (char**) &opt_readonly,
3808
3896
   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3809
3897
  {"read_rnd_buffer_size", OPT_RECORD_RND_BUFFER,
3810
 
   N_("When reading rows in sorted order after a sort, the rows are read "
3811
 
      "through this buffer to avoid a disk seeks. If not set, then it's set "
3812
 
      "to the value of record_buffer."),
 
3898
   "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.",
3813
3899
   (char**) &global_system_variables.read_rnd_buff_size,
3814
3900
   (char**) &max_system_variables.read_rnd_buff_size, 0,
3815
3901
   GET_ULONG, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
3816
 
   INT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
 
3902
   INT_MAX32, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
3817
3903
  {"record_buffer", OPT_RECORD_BUFFER,
3818
3904
   "Alias for read_buffer_size",
3819
3905
   (char**) &global_system_variables.read_buff_size,
3820
3906
   (char**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG,
3821
 
   128*1024L, IO_SIZE*2+MALLOC_OVERHEAD,
3822
 
   INT32_MAX, MALLOC_OVERHEAD, IO_SIZE, 0},
 
3907
   128*1024L, IO_SIZE*2+MALLOC_OVERHEAD, INT_MAX32, MALLOC_OVERHEAD, IO_SIZE, 0},
3823
3908
  {"relay_log_purge", OPT_RELAY_LOG_PURGE,
3824
 
   N_("0 = do not purge relay logs. "
3825
 
      "1 = purge them as soon as they are no more needed."),
 
3909
   "0 = do not purge relay logs. 1 = purge them as soon as they are no more needed.",
3826
3910
   (char**) &relay_log_purge,
3827
3911
   (char**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
3828
3912
   1, 0, 1, 0, 1, 0},
3829
3913
  {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
3830
 
   N_("Maximum space to use for all relay logs."),
 
3914
   "Maximum space to use for all relay logs.",
3831
3915
   (char**) &relay_log_space_limit,
3832
3916
   (char**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
3833
3917
   (int64_t) ULONG_MAX, 0, 1, 0},
3834
3918
  {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
3835
 
   N_("Use compression on master/slave protocol."),
 
3919
   "Use compression on master/slave protocol.",
3836
3920
   (char**) &opt_slave_compressed_protocol,
3837
3921
   (char**) &opt_slave_compressed_protocol,
3838
3922
   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3839
3923
  {"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
3840
 
   N_("Number of seconds to wait for more data from a master/slave connection "
3841
 
      "before aborting the read."),
 
3924
   "Number of seconds to wait for more data from a master/slave connection before aborting the read.",
3842
3925
   (char**) &slave_net_timeout, (char**) &slave_net_timeout, 0,
3843
3926
   GET_ULONG, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3844
3927
  {"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES,
3845
 
   N_("Number of times the slave SQL thread will retry a transaction in case "
3846
 
      "it failed with a deadlock or elapsed lock wait timeout, "
3847
 
      "before giving up and stopping."),
 
3928
   "Number of times the slave SQL thread will retry a transaction in case "
 
3929
   "it failed with a deadlock or elapsed lock wait timeout, "
 
3930
   "before giving up and stopping.",
3848
3931
   (char**) &slave_trans_retries, (char**) &slave_trans_retries, 0,
3849
3932
   GET_ULONG, REQUIRED_ARG, 10L, 0L, (int64_t) ULONG_MAX, 0, 1, 0},
3850
3933
  {"slave-allow-batching", OPT_SLAVE_ALLOW_BATCHING,
3851
 
   N_("Allow slave to batch requests."),
 
3934
   "Allow slave to batch requests.",
3852
3935
   (char**) &slave_allow_batching, (char**) &slave_allow_batching,
3853
3936
   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3854
3937
  {"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
3855
 
   N_("If creating the thread takes longer than this value (in seconds), the "
3856
 
      "Slow_launch_threads counter will be incremented."),
 
3938
   "If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented.",
3857
3939
   (char**) &slow_launch_time, (char**) &slow_launch_time, 0, GET_ULONG,
3858
3940
   REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
3859
3941
  {"sort_buffer_size", OPT_SORT_BUFFER,
3860
 
   N_("Each thread that needs to do a sort allocates a buffer of this size."),
 
3942
   "Each thread that needs to do a sort allocates a buffer of this size.",
3861
3943
   (char**) &global_system_variables.sortbuff_size,
3862
3944
   (char**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
3863
3945
   MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, ULONG_MAX,
3864
3946
   MALLOC_OVERHEAD, 1, 0},
3865
3947
  {"sync-binlog", OPT_SYNC_BINLOG,
3866
 
   N_("Synchronously flush binary log to disk after every #th event. "
3867
 
      "Use 0 (default) to disable synchronous flushing."),
 
3948
   "Synchronously flush binary log to disk after every #th event. "
 
3949
   "Use 0 (default) to disable synchronous flushing.",
3868
3950
   (char**) &sync_binlog_period, (char**) &sync_binlog_period, 0, GET_ULONG,
3869
3951
   REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
 
3952
  {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.",
 
3953
   (char**) &opt_sync_frm, (char**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0,
 
3954
   0, 0, 0, 0},
 
3955
  {"table_cache", OPT_TABLE_OPEN_CACHE,
 
3956
   "Deprecated; use --table_open_cache instead.",
 
3957
   (char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG,
 
3958
   REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
3870
3959
  {"table_definition_cache", OPT_TABLE_DEF_CACHE,
3871
 
   N_("The number of cached table definitions."),
 
3960
   "The number of cached table definitions.",
3872
3961
   (char**) &table_def_size, (char**) &table_def_size,
3873
3962
   0, GET_ULONG, REQUIRED_ARG, 128, 1, 512*1024L, 0, 1, 0},
3874
3963
  {"table_open_cache", OPT_TABLE_OPEN_CACHE,
3875
 
   N_("The number of cached open tables."),
 
3964
   "The number of cached open tables.",
3876
3965
   (char**) &table_cache_size, (char**) &table_cache_size, 0, GET_ULONG,
3877
3966
   REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0},
3878
3967
  {"table_lock_wait_timeout", OPT_TABLE_LOCK_WAIT_TIMEOUT,
3879
 
   N_("Timeout in seconds to wait for a table level lock before returning an "
3880
 
      "error. Used only if the connection has active cursors."),
 
3968
   "Timeout in seconds to wait for a table level lock before returning an "
 
3969
   "error. Used only if the connection has active cursors.",
3881
3970
   (char**) &table_lock_wait_timeout, (char**) &table_lock_wait_timeout,
3882
3971
   0, GET_ULONG, REQUIRED_ARG, 50, 1, 1024 * 1024 * 1024, 0, 1, 0},
3883
3972
  {"thread_cache_size", OPT_THREAD_CACHE_SIZE,
3884
 
   N_("How many threads we should keep in a cache for reuse."),
 
3973
   "How many threads we should keep in a cache for reuse.",
3885
3974
   (char**) &thread_cache_size, (char**) &thread_cache_size, 0, GET_ULONG,
3886
3975
   REQUIRED_ARG, 0, 0, 16384, 0, 1, 0},
3887
3976
  {"thread_pool_size", OPT_THREAD_CACHE_SIZE,
3888
 
   N_("How many threads we should create to handle query requests in case of "
3889
 
      "'thread_handling=pool-of-threads'"),
 
3977
   "How many threads we should create to handle query requests in case of 'thread_handling=pool-of-threads'",
3890
3978
   (char**) &thread_pool_size, (char**) &thread_pool_size, 0, GET_ULONG,
3891
3979
   REQUIRED_ARG, 20, 1, 16384, 0, 1, 0},
3892
3980
  {"thread_stack", OPT_THREAD_STACK,
3893
 
   N_("The stack size for each thread."),
3894
 
   (char**) &my_thread_stack_size,
3895
 
   (char**) &my_thread_stack_size, 0, GET_ULONG,
3896
 
   REQUIRED_ARG,DEFAULT_THREAD_STACK,
 
3981
   "The stack size for each thread.", (char**) &my_thread_stack_size,
 
3982
   (char**) &my_thread_stack_size, 0, GET_ULONG, REQUIRED_ARG,DEFAULT_THREAD_STACK,
3897
3983
   1024L*128L, ULONG_MAX, 0, 1024, 0},
3898
3984
  { "time_format", OPT_TIME_FORMAT,
3899
 
    N_("The TIME format (for future)."),
3900
 
    (char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_TIME],
3901
 
    (char**) &opt_date_time_formats[DRIZZLE_TIMESTAMP_TIME],
 
3985
    "The TIME format (for future).",
 
3986
    (char**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
 
3987
    (char**) &opt_date_time_formats[MYSQL_TIMESTAMP_TIME],
3902
3988
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3903
3989
  {"tmp_table_size", OPT_TMP_TABLE_SIZE,
3904
 
   N_("If an internal in-memory temporary table exceeds this size, MySQL will"
3905
 
      " automatically convert it to an on-disk MyISAM table."),
 
3990
   "If an internal in-memory temporary table exceeds this size, MySQL will"
 
3991
   " automatically convert it to an on-disk MyISAM table.",
3906
3992
   (char**) &global_system_variables.tmp_table_size,
3907
3993
   (char**) &max_system_variables.tmp_table_size, 0, GET_ULL,
3908
3994
   REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0},
3909
3995
  {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE,
3910
 
   N_("Allocation block size for transactions to be stored in binary log"),
 
3996
   "Allocation block size for transactions to be stored in binary log",
3911
3997
   (char**) &global_system_variables.trans_alloc_block_size,
3912
3998
   (char**) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG,
3913
3999
   REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3914
4000
  {"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE,
3915
 
   N_("Persistent buffer for transactions to be stored in binary log"),
 
4001
   "Persistent buffer for transactions to be stored in binary log",
3916
4002
   (char**) &global_system_variables.trans_prealloc_size,
3917
4003
   (char**) &max_system_variables.trans_prealloc_size, 0, GET_ULONG,
3918
4004
   REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ULONG_MAX, 0, 1024, 0},
3919
4005
  {"wait_timeout", OPT_WAIT_TIMEOUT,
3920
 
   N_("The number of seconds the server waits for activity on a connection "
3921
 
      "before closing it."),
 
4006
   "The number of seconds the server waits for activity on a connection before closing it.",
3922
4007
   (char**) &global_system_variables.net_wait_timeout,
3923
4008
   (char**) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
3924
 
   REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT,
 
4009
   REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, IF_WIN(INT_MAX32/1000, LONG_TIMEOUT),
3925
4010
   0, 1, 0},
3926
4011
  {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
3927
4012
};
3928
4013
 
3929
 
static int show_net_compression(THD *thd __attribute__((unused)),
 
4014
static int show_net_compression(THD *thd __attribute__((__unused__)),
3930
4015
                                SHOW_VAR *var,
3931
 
                                char *buff __attribute__((unused)))
 
4016
                                char *buff __attribute__((__unused__)))
3932
4017
{
3933
4018
  var->type= SHOW_MY_BOOL;
3934
4019
  var->value= (char *)&thd->net.compress;
3960
4045
static st_show_var_func_container
3961
4046
show_flushstatustime_cont= { &show_flushstatustime };
3962
4047
 
3963
 
static int show_slave_running(THD *thd __attribute__((unused)),
 
4048
static int show_slave_running(THD *thd __attribute__((__unused__)),
3964
4049
                              SHOW_VAR *var, char *buff)
3965
4050
{
3966
4051
  var->type= SHOW_MY_BOOL;
3975
4060
static st_show_var_func_container
3976
4061
show_slave_running_cont= { &show_slave_running };
3977
4062
 
3978
 
static int show_slave_retried_trans(THD *thd __attribute__((unused)),
 
4063
static int show_slave_retried_trans(THD *thd __attribute__((__unused__)),
3979
4064
                                    SHOW_VAR *var, char *buff)
3980
4065
{
3981
4066
  /*
4000
4085
static st_show_var_func_container
4001
4086
show_slave_retried_trans_cont= { &show_slave_retried_trans };
4002
4087
 
4003
 
static int show_slave_received_heartbeats(THD *thd __attribute__((unused)),
 
4088
static int show_slave_received_heartbeats(THD *thd __attribute__((__unused__)),
4004
4089
                                          SHOW_VAR *var, char *buff)
4005
4090
{
4006
4091
  pthread_mutex_lock(&LOCK_active_mi);
4021
4106
static st_show_var_func_container
4022
4107
show_slave_received_heartbeats_cont= { &show_slave_received_heartbeats };
4023
4108
 
4024
 
static int show_heartbeat_period(THD *thd __attribute__((unused)),
 
4109
static int show_heartbeat_period(THD *thd __attribute__((__unused__)),
4025
4110
                                 SHOW_VAR *var, char *buff)
4026
4111
{
4027
4112
  pthread_mutex_lock(&LOCK_active_mi);
4029
4114
  {
4030
4115
    var->type= SHOW_CHAR;
4031
4116
    var->value= buff;
4032
 
    sprintf(buff, "%.3f",active_mi->heartbeat_period);
 
4117
    my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period));
4033
4118
  }
4034
4119
  else
4035
4120
    var->type= SHOW_UNDEF;
4040
4125
static st_show_var_func_container
4041
4126
show_heartbeat_period_cont= { &show_heartbeat_period};
4042
4127
 
4043
 
static int show_open_tables(THD *thd __attribute__((unused)),
 
4128
static int show_open_tables(THD *thd __attribute__((__unused__)),
4044
4129
                            SHOW_VAR *var, char *buff)
4045
4130
{
4046
4131
  var->type= SHOW_LONG;
4049
4134
  return 0;
4050
4135
}
4051
4136
 
4052
 
static int show_table_definitions(THD *thd __attribute__((unused)),
 
4137
static int show_table_definitions(THD *thd __attribute__((__unused__)),
4053
4138
                                  SHOW_VAR *var, char *buff)
4054
4139
{
4055
4140
  var->type= SHOW_LONG;
4142
4227
  {"Threads_running",          (char*) &thread_running,         SHOW_INT},
4143
4228
  {"Uptime",                   (char*) &show_starttime_cont,         SHOW_FUNC},
4144
4229
  {"Uptime_since_flush_status",(char*) &show_flushstatustime_cont,   SHOW_FUNC},
4145
 
  {NULL, NULL, SHOW_LONG}
 
4230
  {NullS, NullS, SHOW_LONG}
4146
4231
};
4147
4232
 
4148
4233
static void print_version(void)
4153
4238
    version from the output of 'mysqld --version', so don't change it!
4154
4239
  */
4155
4240
  printf("%s  Ver %s for %s on %s (%s)\n",my_progname,
4156
 
         server_version,SYSTEM_TYPE,MACHINE_TYPE, DRIZZLE_COMPILATION_COMMENT);
 
4241
         server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
4157
4242
}
4158
4243
 
4159
4244
static void usage(void)
4165
4250
  if (!default_collation_name)
4166
4251
    default_collation_name= (char*) default_charset_info->name;
4167
4252
  print_version();
4168
 
  puts(_("Copyright (C) 2000 MySQL AB, by Monty and others\n"
4169
 
         "This software comes with ABSOLUTELY NO WARRANTY. "
4170
 
         "This is free software,\n"
4171
 
         "and you are welcome to modify and redistribute it under the GPL "
4172
 
         "license\n\n"
4173
 
         "Starts the Drizzle database server\n"));
 
4253
  puts("\
 
4254
Copyright (C) 2000 MySQL AB, by Monty and others\n\
 
4255
This software comes with ABSOLUTELY NO WARRANTY. This is free software,\n\
 
4256
and you are welcome to modify and redistribute it under the GPL license\n\n\
 
4257
Starts the MySQL database server\n");
4174
4258
 
4175
 
  printf(_("Usage: %s [OPTIONS]\n"), my_progname);
 
4259
  printf("Usage: %s [OPTIONS]\n", my_progname);
 
4260
  if (!opt_verbose)
 
4261
    puts("\nFor more help options (several pages), use mysqld --verbose --help");
 
4262
  else
4176
4263
  {
4177
 
#ifdef FOO
4178
 
  print_defaults(DRIZZLE_CONFIG_NAME,load_default_groups);
 
4264
  print_defaults(MYSQL_CONFIG_NAME,load_default_groups);
4179
4265
  puts("");
4180
4266
  set_ports();
4181
 
#endif
4182
4267
 
4183
4268
  /* Print out all the options including plugin supplied options */
4184
4269
  my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option));
4185
4270
 
4186
 
  puts(_("\nTo see what values a running Drizzle server is using, type\n"
4187
 
         "'drizzleadmin variables' instead of 'drizzled --help'."));
 
4271
  puts("\n\
 
4272
To see what values a running MySQL server is using, type\n\
 
4273
'mysqladmin variables' instead of 'mysqld --verbose --help'.");
4188
4274
  }
4189
4275
}
4190
4276
 
4210
4296
  /* Things reset to zero */
4211
4297
  opt_skip_slave_start= opt_reckless_slave = 0;
4212
4298
  mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
 
4299
  opt_log= opt_slow_log= 0;
4213
4300
  log_output_options= find_bit_type(log_output_str, &log_output_typelib);
4214
4301
  opt_bin_log= 0;
4215
 
  opt_skip_show_db=0;
4216
 
  opt_logname= opt_binlog_index_name= 0;
 
4302
  opt_disable_networking= opt_skip_show_db=0;
 
4303
  opt_logname= opt_binlog_index_name= opt_slow_logname= 0;
4217
4304
  opt_tc_log_file= (char *)"tc.log";      // no hostname in tc_log file name !
 
4305
  opt_secure_auth= 0;
4218
4306
  opt_secure_file_priv= 0;
 
4307
  opt_bootstrap= opt_myisam_log= 0;
 
4308
  mqh_used= 0;
4219
4309
  segfaulted= kill_in_progress= 0;
4220
4310
  cleanup_done= 0;
4221
4311
  defaults_argc= 0;
4234
4324
  binlog_cache_use=  binlog_cache_disk_use= 0;
4235
4325
  max_used_connections= slow_launch_threads = 0;
4236
4326
  mysqld_user= mysqld_chroot= opt_init_file= opt_bin_logname = 0;
4237
 
  opt_mysql_tmpdir= my_bind_addr_str= NULL;
4238
 
  memset(&mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
4239
 
  memset(&global_status_var, 0, sizeof(global_status_var));
 
4327
  errmesg= 0;
 
4328
  opt_mysql_tmpdir= my_bind_addr_str= NullS;
 
4329
  bzero((uchar*) &mysql_tmpdir_list, sizeof(mysql_tmpdir_list));
 
4330
  bzero((char *) &global_status_var, sizeof(global_status_var));
4240
4331
  key_map_full.set_all();
4241
4332
 
4242
4333
  /* Character sets */
4253
4344
  slave_exec_mode_options= 0;
4254
4345
  slave_exec_mode_options= (uint)
4255
4346
    find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL);
 
4347
  opt_specialflag= SPECIAL_ENGLISH;
 
4348
  ip_sock= INVALID_SOCKET;
4256
4349
  mysql_home_ptr= mysql_home;
4257
4350
  pidfile_name_ptr= pidfile_name;
4258
4351
  log_error_file_ptr= log_error_file;
4264
4357
  what_to_log= ~ (1L << (uint) COM_TIME);
4265
4358
  refresh_version= 1L;  /* Increments on each reload */
4266
4359
  global_query_id= thread_id= 1L;
4267
 
  my_stpcpy(server_version, DRIZZLE_SERVER_VERSION);
 
4360
  strmov(server_version, MYSQL_SERVER_VERSION);
4268
4361
  myisam_recover_options_str= "OFF";
4269
4362
  myisam_stats_method_str= "nulls_unequal";
4270
4363
  threads.empty();
4292
4385
 
4293
4386
  /* Variables in libraries */
4294
4387
  charsets_dir= 0;
4295
 
  default_character_set_name= (char*) DRIZZLE_DEFAULT_CHARSET_NAME;
 
4388
  default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME;
4296
4389
  default_collation_name= compiled_default_collation_name;
 
4390
  sys_charset_system.set((char*) system_charset_info->csname);
4297
4391
  character_set_filesystem_name= (char*) "binary";
4298
4392
  lc_time_names_name= (char*) "en_US";
4299
4393
  /* Set default values for some option variables */
4300
 
  default_storage_engine_str= (char*) "innodb";
 
4394
  default_storage_engine_str= (char*) "MyISAM";
4301
4395
  global_system_variables.table_plugin= NULL;
4302
4396
  global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
4303
4397
  global_system_variables.select_limit= (uint64_t) HA_POS_ERROR;
4313
4407
  global_system_variables.myisam_stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
4314
4408
 
4315
4409
  /* Variables that depends on compile options */
4316
 
  opt_error_log= 0;
 
4410
  opt_error_log= IF_WIN(1,0);
4317
4411
#ifdef HAVE_BROKEN_REALPATH
4318
4412
  have_symlink=SHOW_OPTION_NO;
4319
4413
#else
4320
4414
  have_symlink=SHOW_OPTION_YES;
4321
4415
#endif
 
4416
#ifdef HAVE_DLOPEN
 
4417
  have_dlopen=SHOW_OPTION_YES;
 
4418
#else
 
4419
  have_dlopen=SHOW_OPTION_NO;
 
4420
#endif
 
4421
#ifdef HAVE_CRYPT
 
4422
  have_crypt=SHOW_OPTION_YES;
 
4423
#else
 
4424
  have_crypt=SHOW_OPTION_NO;
 
4425
#endif
4322
4426
#ifdef HAVE_COMPRESS
4323
4427
  have_compress= SHOW_OPTION_YES;
4324
4428
#else
4327
4431
 
4328
4432
  const char *tmpenv;
4329
4433
  if (!(tmpenv = getenv("MY_BASEDIR_VERSION")))
4330
 
    tmpenv = DEFAULT_DRIZZLE_HOME;
 
4434
    tmpenv = DEFAULT_MYSQL_HOME;
4331
4435
  (void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
4332
4436
}
4333
4437
 
4351
4455
    if (default_collation_name == compiled_default_collation_name)
4352
4456
      default_collation_name= 0;
4353
4457
    break;
 
4458
  case 'l':
 
4459
    opt_log=1;
 
4460
    break;
4354
4461
  case 'h':
4355
4462
    strmake(mysql_real_data_home,argument, sizeof(mysql_real_data_home)-1);
4356
4463
    /* Correct pointer set by my_getopt (for embedded library) */
4361
4468
    if (!mysqld_user || !strcmp(mysqld_user, argument))
4362
4469
      mysqld_user= argument;
4363
4470
    else
4364
 
      sql_print_warning(_("Ignoring user change to '%s' because the user was "
4365
 
                          "set to '%s' earlier on the command line\n"),
4366
 
                        argument, mysqld_user);
 
4471
      sql_print_warning("Ignoring user change to '%s' because the user was set to '%s' earlier on the command line\n", argument, mysqld_user);
4367
4472
    break;
4368
4473
  case 'L':
4369
4474
    strmake(language, argument, sizeof(language)-1);
4390
4495
    test_flags= argument ? (uint) atoi(argument) : 0;
4391
4496
    opt_endinfo=1;
4392
4497
    break;
 
4498
  case (int) OPT_BIG_TABLES:
 
4499
    thd_startup_options|=OPTION_BIG_TABLES;
 
4500
    break;
 
4501
  case (int) OPT_ISAM_LOG:
 
4502
    opt_myisam_log=1;
 
4503
    break;
4393
4504
  case (int) OPT_BIN_LOG:
4394
4505
    opt_bin_log= test(argument != disabled_my_option);
4395
4506
    break;
4397
4508
    opt_error_log= 1;
4398
4509
    break;
4399
4510
  case (int)OPT_REPLICATE_IGNORE_DB:
4400
 
    {
4401
 
      rpl_filter->add_ignore_db(argument);
4402
 
      break;
4403
 
    }
 
4511
  {
 
4512
    rpl_filter->add_ignore_db(argument);
 
4513
    break;
 
4514
  }
4404
4515
  case (int)OPT_REPLICATE_DO_DB:
4405
 
    {
4406
 
      rpl_filter->add_do_db(argument);
4407
 
      break;
4408
 
    }
 
4516
  {
 
4517
    rpl_filter->add_do_db(argument);
 
4518
    break;
 
4519
  }
4409
4520
  case (int)OPT_REPLICATE_REWRITE_DB:
4410
 
    {
4411
 
      char* key = argument,*p, *val;
4412
 
 
4413
 
      if (!(p= strstr(argument, "->")))
4414
 
      {
4415
 
        fprintf(stderr,
4416
 
                _("Bad syntax in replicate-rewrite-db - missing '->'!\n"));
4417
 
        exit(1);
4418
 
      }
4419
 
      val= p--;
4420
 
      while (my_isspace(mysqld_charset, *p) && p > argument)
4421
 
        *p-- = 0;
4422
 
      if (p == argument)
4423
 
      {
4424
 
        fprintf(stderr,
4425
 
                _("Bad syntax in replicate-rewrite-db - empty FROM db!\n"));
4426
 
        exit(1);
4427
 
      }
4428
 
      *val= 0;
4429
 
      val+= 2;
4430
 
      while (*val && my_isspace(mysqld_charset, *val))
4431
 
        *val++;
4432
 
      if (!*val)
4433
 
      {
4434
 
        fprintf(stderr,
4435
 
                _("Bad syntax in replicate-rewrite-db - empty TO db!\n"));
4436
 
        exit(1);
4437
 
      }
4438
 
 
4439
 
      rpl_filter->add_db_rewrite(key, val);
4440
 
      break;
4441
 
    }
 
4521
  {
 
4522
    char* key = argument,*p, *val;
 
4523
 
 
4524
    if (!(p= strstr(argument, "->")))
 
4525
    {
 
4526
      fprintf(stderr,
 
4527
              "Bad syntax in replicate-rewrite-db - missing '->'!\n");
 
4528
      exit(1);
 
4529
    }
 
4530
    val= p--;
 
4531
    while (my_isspace(mysqld_charset, *p) && p > argument)
 
4532
      *p-- = 0;
 
4533
    if (p == argument)
 
4534
    {
 
4535
      fprintf(stderr,
 
4536
              "Bad syntax in replicate-rewrite-db - empty FROM db!\n");
 
4537
      exit(1);
 
4538
    }
 
4539
    *val= 0;
 
4540
    val+= 2;
 
4541
    while (*val && my_isspace(mysqld_charset, *val))
 
4542
      *val++;
 
4543
    if (!*val)
 
4544
    {
 
4545
      fprintf(stderr,
 
4546
              "Bad syntax in replicate-rewrite-db - empty TO db!\n");
 
4547
      exit(1);
 
4548
    }
 
4549
 
 
4550
    rpl_filter->add_db_rewrite(key, val);
 
4551
    break;
 
4552
  }
4442
4553
 
4443
4554
  case (int)OPT_BINLOG_IGNORE_DB:
4444
 
    {
4445
 
      binlog_filter->add_ignore_db(argument);
4446
 
      break;
4447
 
    }
 
4555
  {
 
4556
    binlog_filter->add_ignore_db(argument);
 
4557
    break;
 
4558
  }
4448
4559
  case OPT_BINLOG_FORMAT:
4449
 
    {
4450
 
      int id;
4451
 
      id= find_type_or_exit(argument, &binlog_format_typelib, opt->name);
4452
 
      global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
4453
 
      break;
4454
 
    }
 
4560
  {
 
4561
    int id;
 
4562
    id= find_type_or_exit(argument, &binlog_format_typelib, opt->name);
 
4563
    global_system_variables.binlog_format= opt_binlog_format_id= id - 1;
 
4564
    break;
 
4565
  }
4455
4566
  case (int)OPT_BINLOG_DO_DB:
4456
 
    {
4457
 
      binlog_filter->add_do_db(argument);
4458
 
      break;
4459
 
    }
 
4567
  {
 
4568
    binlog_filter->add_do_db(argument);
 
4569
    break;
 
4570
  }
4460
4571
  case (int)OPT_REPLICATE_DO_TABLE:
 
4572
  {
 
4573
    if (rpl_filter->add_do_table(argument))
4461
4574
    {
4462
 
      if (rpl_filter->add_do_table(argument))
4463
 
      {
4464
 
        fprintf(stderr, _("Could not add do table rule '%s'!\n"), argument);
4465
 
        exit(1);
4466
 
      }
4467
 
      break;
 
4575
      fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
 
4576
      exit(1);
4468
4577
    }
 
4578
    break;
 
4579
  }
4469
4580
  case (int)OPT_REPLICATE_WILD_DO_TABLE:
 
4581
  {
 
4582
    if (rpl_filter->add_wild_do_table(argument))
4470
4583
    {
4471
 
      if (rpl_filter->add_wild_do_table(argument))
4472
 
      {
4473
 
        fprintf(stderr, _("Could not add do table rule '%s'!\n"), argument);
4474
 
        exit(1);
4475
 
      }
4476
 
      break;
 
4584
      fprintf(stderr, "Could not add do table rule '%s'!\n", argument);
 
4585
      exit(1);
4477
4586
    }
 
4587
    break;
 
4588
  }
4478
4589
  case (int)OPT_REPLICATE_WILD_IGNORE_TABLE:
 
4590
  {
 
4591
    if (rpl_filter->add_wild_ignore_table(argument))
4479
4592
    {
4480
 
      if (rpl_filter->add_wild_ignore_table(argument))
4481
 
      {
4482
 
        fprintf(stderr, _("Could not add ignore table rule '%s'!\n"), argument);
4483
 
        exit(1);
4484
 
      }
4485
 
      break;
 
4593
      fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
 
4594
      exit(1);
4486
4595
    }
 
4596
    break;
 
4597
  }
4487
4598
  case (int)OPT_REPLICATE_IGNORE_TABLE:
4488
 
    {
4489
 
      if (rpl_filter->add_ignore_table(argument))
4490
 
      {
4491
 
        fprintf(stderr, _("Could not add ignore table rule '%s'!\n"), argument);
4492
 
        exit(1);
4493
 
      }
4494
 
      break;
4495
 
    }
 
4599
  {
 
4600
    if (rpl_filter->add_ignore_table(argument))
 
4601
    {
 
4602
      fprintf(stderr, "Could not add ignore table rule '%s'!\n", argument);
 
4603
      exit(1);
 
4604
    }
 
4605
    break;
 
4606
  }
 
4607
  case (int) OPT_SLOW_QUERY_LOG:
 
4608
    opt_slow_log= 1;
 
4609
    break;
 
4610
#ifdef WITH_CSV_STORAGE_ENGINE
 
4611
  case  OPT_LOG_OUTPUT:
 
4612
  {
 
4613
    if (!argument || !argument[0])
 
4614
    {
 
4615
      log_output_options= LOG_FILE;
 
4616
      log_output_str= log_output_typelib.type_names[1];
 
4617
    }
 
4618
    else
 
4619
    {
 
4620
      log_output_str= argument;
 
4621
      log_output_options=
 
4622
        find_bit_type_or_exit(argument, &log_output_typelib, opt->name);
 
4623
  }
 
4624
    break;
 
4625
  }
 
4626
#endif
 
4627
  case (int) OPT_SKIP_NEW:
 
4628
    opt_specialflag|= SPECIAL_NO_NEW_FUNC;
 
4629
    delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
 
4630
    myisam_concurrent_insert=0;
 
4631
    myisam_recover_options= HA_RECOVER_NONE;
 
4632
    my_use_symdir=0;
 
4633
    ha_open_options&= ~(HA_OPEN_ABORT_IF_CRASHED | HA_OPEN_DELAY_KEY_WRITE);
 
4634
    break;
 
4635
  case (int) OPT_SAFE:
 
4636
    opt_specialflag|= SPECIAL_SAFE_MODE;
 
4637
    delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
 
4638
    myisam_recover_options= HA_RECOVER_DEFAULT;
 
4639
    ha_open_options&= ~(HA_OPEN_DELAY_KEY_WRITE);
 
4640
    break;
 
4641
  case (int) OPT_SKIP_PRIOR:
 
4642
    opt_specialflag|= SPECIAL_NO_PRIOR;
 
4643
    break;
 
4644
  case (int) OPT_SKIP_LOCK:
 
4645
    opt_external_locking=0;
 
4646
    break;
 
4647
  case (int) OPT_SKIP_SHOW_DB:
 
4648
    opt_skip_show_db=1;
 
4649
    opt_specialflag|=SPECIAL_SKIP_SHOW_DB;
 
4650
    break;
4496
4651
  case (int) OPT_WANT_CORE:
4497
4652
    test_flags |= TEST_CORE_ON_SIGNAL;
4498
4653
    break;
4504
4659
    break;
4505
4660
  case (int) OPT_BIND_ADDRESS:
4506
4661
    {
4507
 
      struct addrinfo *res_lst, hints;
 
4662
      struct addrinfo *res_lst, hints;    
4508
4663
 
4509
 
      memset(&hints, 0, sizeof(struct addrinfo));
 
4664
      bzero(&hints, sizeof(struct addrinfo));
4510
4665
      hints.ai_socktype= SOCK_STREAM;
4511
4666
      hints.ai_protocol= IPPROTO_TCP;
4512
4667
 
4513
 
      if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0)
 
4668
      if (getaddrinfo(argument, NULL, &hints, &res_lst) != 0) 
4514
4669
      {
4515
 
        sql_print_error(_("Can't start server: cannot resolve hostname!"));
 
4670
        sql_print_error("Can't start server: cannot resolve hostname!");
4516
4671
        exit(1);
4517
4672
      }
4518
4673
 
4519
4674
      if (res_lst->ai_next)
4520
4675
      {
4521
 
        sql_print_error(_("Can't start server: bind-address refers to "
4522
 
                          "multiple interfaces!"));
 
4676
        sql_print_error("Can't start server: bind-address refers to multiple interfaces!");
4523
4677
        exit(1);
4524
4678
      }
4525
4679
      freeaddrinfo(res_lst);
4532
4686
    if (opt_console)
4533
4687
      opt_error_log= 0;                 // Force logs to stdout
4534
4688
    break;
 
4689
  case (int) OPT_FLUSH:
 
4690
    myisam_flush=1;
 
4691
    flush_time=0;                       // No auto flush
 
4692
    break;
4535
4693
  case OPT_LOW_PRIORITY_UPDATES:
4536
4694
    thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY;
4537
4695
    global_system_variables.low_priority_updates=1;
4538
4696
    break;
 
4697
  case OPT_BOOTSTRAP:
 
4698
    opt_noacl=opt_bootstrap=1;
 
4699
    break;
4539
4700
  case OPT_SERVER_ID:
4540
4701
    server_id_supplied = 1;
4541
4702
    break;
4560
4721
    charsets_dir = mysql_charsets_dir;
4561
4722
    break;
4562
4723
  case OPT_TX_ISOLATION:
4563
 
    {
4564
 
      int type;
4565
 
      type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name);
4566
 
      global_system_variables.tx_isolation= (type-1);
4567
 
      break;
4568
 
    }
 
4724
  {
 
4725
    int type;
 
4726
    type= find_type_or_exit(argument, &tx_isolation_typelib, opt->name);
 
4727
    global_system_variables.tx_isolation= (type-1);
 
4728
    break;
 
4729
  }
4569
4730
  case OPT_MYISAM_RECOVER:
4570
 
    {
4571
 
      if (!argument)
4572
 
      {
4573
 
        myisam_recover_options=    HA_RECOVER_DEFAULT;
4574
 
        myisam_recover_options_str= myisam_recover_typelib.type_names[0];
4575
 
      }
4576
 
      else if (!argument[0])
4577
 
      {
4578
 
        myisam_recover_options= HA_RECOVER_NONE;
4579
 
        myisam_recover_options_str= "OFF";
4580
 
      }
4581
 
      else
4582
 
      {
4583
 
        myisam_recover_options_str=argument;
4584
 
        myisam_recover_options=
4585
 
          find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name);
4586
 
      }
4587
 
      ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
4588
 
      break;
4589
 
    }
 
4731
  {
 
4732
    if (!argument)
 
4733
    {
 
4734
      myisam_recover_options=    HA_RECOVER_DEFAULT;
 
4735
      myisam_recover_options_str= myisam_recover_typelib.type_names[0];
 
4736
    }
 
4737
    else if (!argument[0])
 
4738
    {
 
4739
      myisam_recover_options= HA_RECOVER_NONE;
 
4740
      myisam_recover_options_str= "OFF";
 
4741
    }
 
4742
    else
 
4743
    {
 
4744
      myisam_recover_options_str=argument;
 
4745
      myisam_recover_options=
 
4746
        find_bit_type_or_exit(argument, &myisam_recover_typelib, opt->name);
 
4747
    }
 
4748
    ha_open_options|=HA_OPEN_ABORT_IF_CRASHED;
 
4749
    break;
 
4750
  }
4590
4751
  case OPT_TC_HEURISTIC_RECOVER:
4591
4752
    tc_heuristic_recover= find_type_or_exit(argument,
4592
4753
                                            &tc_heuristic_recover_typelib,
4593
4754
                                            opt->name);
4594
4755
    break;
4595
4756
  case OPT_MYISAM_STATS_METHOD:
4596
 
    {
4597
 
      uint32_t method_conv;
4598
 
      int method;
 
4757
  {
 
4758
    ulong method_conv;
 
4759
    int method;
4599
4760
 
4600
 
      myisam_stats_method_str= argument;
4601
 
      method= find_type_or_exit(argument, &myisam_stats_method_typelib,
4602
 
                                opt->name);
4603
 
      switch (method-1) {
4604
 
      case 2:
4605
 
        method_conv= MI_STATS_METHOD_IGNORE_NULLS;
4606
 
        break;
4607
 
      case 1:
4608
 
        method_conv= MI_STATS_METHOD_NULLS_EQUAL;
4609
 
        break;
4610
 
      case 0:
4611
 
      default:
4612
 
        method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL;
4613
 
        break;
4614
 
      }
4615
 
      global_system_variables.myisam_stats_method= method_conv;
 
4761
    myisam_stats_method_str= argument;
 
4762
    method= find_type_or_exit(argument, &myisam_stats_method_typelib,
 
4763
                              opt->name);
 
4764
    switch (method-1) {
 
4765
    case 2:
 
4766
      method_conv= MI_STATS_METHOD_IGNORE_NULLS;
 
4767
      break;
 
4768
    case 1:
 
4769
      method_conv= MI_STATS_METHOD_NULLS_EQUAL;
 
4770
      break;
 
4771
    case 0:
 
4772
    default:
 
4773
      method_conv= MI_STATS_METHOD_NULLS_NOT_EQUAL;
4616
4774
      break;
4617
4775
    }
 
4776
    global_system_variables.myisam_stats_method= method_conv;
 
4777
    break;
 
4778
  }
 
4779
  case OPT_LOWER_CASE_TABLE_NAMES:
 
4780
    lower_case_table_names= argument ? atoi(argument) : 1;
 
4781
    lower_case_table_names_used= 1;
 
4782
    break;
4618
4783
  }
4619
4784
  return 0;
4620
4785
}
4622
4787
 
4623
4788
/** Handle arguments for multiple key caches. */
4624
4789
 
4625
 
extern "C" char **mysql_getopt_value(const char *keyname, uint32_t key_length,
 
4790
extern "C" char **mysql_getopt_value(const char *keyname, uint key_length,
4626
4791
                                      const struct my_option *option);
4627
4792
 
4628
4793
char**
4629
 
mysql_getopt_value(const char *keyname, uint32_t key_length,
 
4794
mysql_getopt_value(const char *keyname, uint key_length,
4630
4795
                   const struct my_option *option)
4631
4796
{
4632
4797
  switch (option->id) {
4662
4827
  va_start(args, format);
4663
4828
 
4664
4829
  /* Don't print warnings for --loose options during bootstrap */
4665
 
  if (level == ERROR_LEVEL || global_system_variables.log_warnings)
 
4830
  if (level == ERROR_LEVEL || !opt_bootstrap ||
 
4831
      global_system_variables.log_warnings)
4666
4832
  {
4667
4833
    vprint_msg_to_log(level, format, args);
4668
4834
  }
4682
4848
  my_getopt_error_reporter= option_error_reporter;
4683
4849
 
4684
4850
  /* Skip unknown options so that they may be processed later by plugins */
4685
 
  my_getopt_skip_unknown= true;
 
4851
  my_getopt_skip_unknown= TRUE;
4686
4852
 
4687
4853
  if ((ho_error= handle_options(argc, &argv, my_long_options,
4688
4854
                                mysqld_get_one_option)))
4690
4856
  (*argc)++; /* add back one for the progname handle_options removes */
4691
4857
             /* no need to do this for argv as we are discarding it. */
4692
4858
 
 
4859
  if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes ||
 
4860
       opt_log_slow_slave_statements) &&
 
4861
      !opt_slow_log)
 
4862
    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");
 
4863
 
4693
4864
#if defined(HAVE_BROKEN_REALPATH)
4694
4865
  my_use_symdir=0;
4695
4866
  my_disable_symlinks=1;
4720
4891
    Set some global variables from the global_system_variables
4721
4892
    In most cases the global variables will not be used
4722
4893
  */
 
4894
  my_disable_locking= myisam_single_user= test((opt_external_locking == 0));
4723
4895
  my_default_record_cache_size=global_system_variables.read_buff_size;
4724
4896
  myisam_max_temp_length=
4725
4897
    (my_off_t) global_system_variables.myisam_max_sort_file_size;
4731
4903
  global_system_variables.long_query_time= max_system_variables.long_query_time=
4732
4904
    (int64_t) (long_query_time * 1000000.0);
4733
4905
 
4734
 
  if (init_global_datetime_format(DRIZZLE_TIMESTAMP_DATE,
 
4906
  if (opt_short_log_format)
 
4907
    opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
 
4908
 
 
4909
  if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE,
4735
4910
                                  &global_system_variables.date_format) ||
4736
 
      init_global_datetime_format(DRIZZLE_TIMESTAMP_TIME,
 
4911
      init_global_datetime_format(MYSQL_TIMESTAMP_TIME,
4737
4912
                                  &global_system_variables.time_format) ||
4738
 
      init_global_datetime_format(DRIZZLE_TIMESTAMP_DATETIME,
 
4913
      init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME,
4739
4914
                                  &global_system_variables.datetime_format))
4740
4915
    exit(1);
4741
4916
 
4747
4922
  Create version name for running mysqld version
4748
4923
  We automaticly add suffixes -debug, -embedded and -log to the version
4749
4924
  name to make the version more descriptive.
4750
 
  (DRIZZLE_SERVER_SUFFIX is set by the compilation environment)
 
4925
  (MYSQL_SERVER_SUFFIX is set by the compilation environment)
4751
4926
*/
4752
4927
 
4753
 
#ifdef DRIZZLE_SERVER_SUFFIX
4754
 
#define DRIZZLE_SERVER_SUFFIX_STR STRINGIFY_ARG(DRIZZLE_SERVER_SUFFIX)
4755
 
#else
4756
 
#define DRIZZLE_SERVER_SUFFIX_STR DRIZZLE_SERVER_SUFFIX_DEF
4757
 
#endif
4758
 
 
4759
4928
static void set_server_version(void)
4760
4929
{
4761
 
  char *end= strxmov(server_version, DRIZZLE_SERVER_VERSION,
4762
 
                     DRIZZLE_SERVER_SUFFIX_STR, NULL);
4763
 
  if (opt_bin_log)
4764
 
    my_stpcpy(end, "-log");                        // This may slow down system
 
4930
  char *end= strxmov(server_version, MYSQL_SERVER_VERSION,
 
4931
                     MYSQL_SERVER_SUFFIX_STR, NullS);
 
4932
  if (opt_log || opt_slow_log || opt_bin_log)
 
4933
    strmov(end, "-log");                        // This may slow down system
4765
4934
}
4766
4935
 
4767
4936
 
4768
4937
static char *get_relative_path(const char *path)
4769
4938
{
4770
4939
  if (test_if_hard_path(path) &&
4771
 
      is_prefix(path,DEFAULT_DRIZZLE_HOME) &&
4772
 
      strcmp(DEFAULT_DRIZZLE_HOME,FN_ROOTDIR))
 
4940
      is_prefix(path,DEFAULT_MYSQL_HOME) &&
 
4941
      strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR))
4773
4942
  {
4774
 
    path+=(uint) strlen(DEFAULT_DRIZZLE_HOME);
 
4943
    path+=(uint) strlen(DEFAULT_MYSQL_HOME);
4775
4944
    while (*path == FN_LIBCHAR)
4776
4945
      path++;
4777
4946
  }
4794
4963
  if (!test_if_hard_path(dir))
4795
4964
  {
4796
4965
    strxnmov(tmp_path,sizeof(tmp_path)-1, mysql_real_data_home,
4797
 
             dir, NULL);
 
4966
             dir, NullS);
4798
4967
    dir=tmp_path;
4799
4968
  }
4800
4969
  return !fn_format(to, name, dir, extension,
4805
4974
static void fix_paths(void)
4806
4975
{
4807
4976
  char buff[FN_REFLEN],*pos;
4808
 
  convert_dirname(mysql_home,mysql_home,NULL);
 
4977
  convert_dirname(mysql_home,mysql_home,NullS);
4809
4978
  /* Resolve symlinks to allow 'mysql_home' to be a relative symlink */
4810
4979
  my_realpath(mysql_home,mysql_home,MYF(0));
4811
4980
  /* Ensure that mysql_home ends in FN_LIBCHAR */
4812
 
  pos= strchr(mysql_home, '\0');
 
4981
  pos=strend(mysql_home);
4813
4982
  if (pos[-1] != FN_LIBCHAR)
4814
4983
  {
4815
4984
    pos[0]= FN_LIBCHAR;
4816
4985
    pos[1]= 0;
4817
4986
  }
4818
 
  convert_dirname(mysql_real_data_home,mysql_real_data_home,NULL);
 
4987
  convert_dirname(mysql_real_data_home,mysql_real_data_home,NullS);
4819
4988
  (void) fn_format(buff, mysql_real_data_home, "", "",
4820
4989
                   (MY_RETURN_REAL_PATH|MY_RESOLVE_SYMLINKS));
4821
4990
  (void) unpack_dirname(mysql_unpacked_real_data_home, buff);
4822
 
  convert_dirname(language,language,NULL);
 
4991
  convert_dirname(language,language,NullS);
4823
4992
  (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
4824
4993
  (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
4825
4994
  (void) my_load_path(pidfile_name,pidfile_name,mysql_real_data_home);
4831
5000
  if (test_if_hard_path(sharedir))
4832
5001
    strmake(buff,sharedir,sizeof(buff)-1);              /* purecov: tested */
4833
5002
  else
4834
 
    strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NULL);
4835
 
  convert_dirname(buff,buff,NULL);
 
5003
    strxnmov(buff,sizeof(buff)-1,mysql_home,sharedir,NullS);
 
5004
  convert_dirname(buff,buff,NullS);
4836
5005
  (void) my_load_path(language,language,buff);
4837
5006
 
4838
5007
  /* If --character-sets-dir isn't given, use shared library dir */
4839
5008
  if (charsets_dir != mysql_charsets_dir)
4840
5009
  {
4841
5010
    strxnmov(mysql_charsets_dir, sizeof(mysql_charsets_dir)-1, buff,
4842
 
             CHARSET_DIR, NULL);
 
5011
             CHARSET_DIR, NullS);
4843
5012
  }
4844
5013
  (void) my_load_path(mysql_charsets_dir, mysql_charsets_dir, buff);
4845
 
  convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NULL);
 
5014
  convert_dirname(mysql_charsets_dir, mysql_charsets_dir, NullS);
4846
5015
  charsets_dir=mysql_charsets_dir;
4847
5016
 
4848
5017
  if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir))
4858
5027
   */
4859
5028
  if (opt_secure_file_priv)
4860
5029
  {
4861
 
    convert_dirname(buff, opt_secure_file_priv, NULL);
4862
 
    free(opt_secure_file_priv);
 
5030
    convert_dirname(buff, opt_secure_file_priv, NullS);
 
5031
    my_free(opt_secure_file_priv, MYF(0));
4863
5032
    opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
4864
5033
  }
4865
5034
}
4866
5035
 
4867
5036
 
4868
 
static uint32_t find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
 
5037
static ulong find_bit_type_or_exit(const char *x, TYPELIB *bit_lib,
4869
5038
                                   const char *option)
4870
5039
{
4871
 
  uint32_t res;
 
5040
  ulong res;
4872
5041
 
4873
5042
  const char **ptr;
4874
 
 
4875
 
  if ((res= find_bit_type(x, bit_lib)) == ~(uint32_t) 0)
 
5043
  
 
5044
  if ((res= find_bit_type(x, bit_lib)) == ~(ulong) 0)
4876
5045
  {
4877
5046
    ptr= bit_lib->type_names;
4878
5047
    if (!*x)
4879
 
      fprintf(stderr, _("No option given to %s\n"), option);
 
5048
      fprintf(stderr, "No option given to %s\n", option);
4880
5049
    else
4881
 
      fprintf(stderr, _("Wrong option to %s. Option(s) given: %s\n"),
4882
 
              option, x);
4883
 
    fprintf(stderr, _("Alternatives are: '%s'"), *ptr);
 
5050
      fprintf(stderr, "Wrong option to %s. Option(s) given: %s\n", option, x);
 
5051
    fprintf(stderr, "Alternatives are: '%s'", *ptr);
4884
5052
    while (*++ptr)
4885
5053
      fprintf(stderr, ",'%s'", *ptr);
4886
5054
    fprintf(stderr, "\n");
4894
5062
  @return
4895
5063
    a bitfield from a string of substrings separated by ','
4896
5064
    or
4897
 
    ~(uint32_t) 0 on error.
 
5065
    ~(ulong) 0 on error.
4898
5066
*/
4899
5067
 
4900
 
static uint32_t find_bit_type(const char *x, TYPELIB *bit_lib)
 
5068
static ulong find_bit_type(const char *x, TYPELIB *bit_lib)
4901
5069
{
4902
5070
  bool found_end;
4903
5071
  int  found_count;
4904
5072
  const char *end,*i,*j;
4905
5073
  const char **array, *pos;
4906
 
  uint32_t found,found_int,bit;
 
5074
  ulong found,found_int,bit;
4907
5075
 
4908
5076
  found=0;
4909
5077
  found_end= 0;
4912
5080
  found_end= *pos == 0;
4913
5081
  while (!found_end)
4914
5082
  {
4915
 
    if ((end=strrchr(pos,',')) != NULL)         /* Let end point at fieldend */
 
5083
    if (!*(end=strcend(pos,',')))               /* Let end point at fieldend */
4916
5084
    {
4917
5085
      while (end > pos && end[-1] == ' ')
4918
5086
        end--;                                  /* Skip end-space */
4919
5087
      found_end=1;
4920
5088
    }
4921
 
    else
4922
 
    {
4923
 
        end=pos+strlen(pos);
4924
 
        found_end=1;
4925
 
    }
4926
5089
    found_int=0; found_count=0;
4927
5090
    for (array=bit_lib->type_names, bit=1 ; (i= *array++) ; bit<<=1)
4928
5091
    {
4946
5109
skip: ;
4947
5110
    }
4948
5111
    if (found_count != 1)
4949
 
      return(~(uint32_t) 0);                            // No unique value
 
5112
      return(~(ulong) 0);                               // No unique value
4950
5113
    found|=found_int;
4951
5114
    pos=end+1;
4952
5115
  }
4956
5119
 
4957
5120
 
4958
5121
/**
 
5122
  Check if file system used for databases is case insensitive.
 
5123
 
 
5124
  @param dir_name                       Directory to test
 
5125
 
 
5126
  @retval
 
5127
    -1  Don't know (Test failed)
 
5128
  @retval
 
5129
    0   File system is case sensitive
 
5130
  @retval
 
5131
    1   File system is case insensitive
 
5132
*/
 
5133
 
 
5134
static int test_if_case_insensitive(const char *dir_name)
 
5135
{
 
5136
  int result= 0;
 
5137
  File file;
 
5138
  char buff[FN_REFLEN], buff2[FN_REFLEN];
 
5139
  struct stat stat_info;
 
5140
 
 
5141
  fn_format(buff, glob_hostname, dir_name, ".lower-test",
 
5142
            MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR);
 
5143
  fn_format(buff2, glob_hostname, dir_name, ".LOWER-TEST",
 
5144
            MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR);
 
5145
  (void) my_delete(buff2, MYF(0));
 
5146
  if ((file= my_create(buff, 0666, O_RDWR, MYF(0))) < 0)
 
5147
  {
 
5148
    sql_print_warning("Can't create test file %s", buff);
 
5149
    return(-1);
 
5150
  }
 
5151
  my_close(file, MYF(0));
 
5152
  if (!stat(buff2, &stat_info))
 
5153
    result= 1;                                  // Can access file
 
5154
  (void) my_delete(buff, MYF(MY_WME));
 
5155
  return(result);
 
5156
}
 
5157
 
 
5158
 
 
5159
/**
4959
5160
  Create file to store pid number.
4960
5161
*/
4961
5162
static void create_pid_file()
4967
5168
    char buff[21], *end;
4968
5169
    end= int10_to_str((long) getpid(), buff, 10);
4969
5170
    *end++= '\n';
4970
 
    if (!my_write(file, (unsigned char*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP)))
 
5171
    if (!my_write(file, (uchar*) buff, (uint) (end-buff), MYF(MY_WME | MY_NABP)))
4971
5172
    {
4972
5173
      (void) my_close(file, MYF(0));
4973
5174
      return;
4987
5188
  add_to_status(&global_status_var, &thd->status_var);
4988
5189
 
4989
5190
  /* Reset thread's status variables */
4990
 
  memset(&thd->status_var, 0, sizeof(thd->status_var));
 
5191
  bzero((uchar*) &thd->status_var, sizeof(thd->status_var));
4991
5192
 
4992
5193
  /* Reset some global variables */
4993
5194
  reset_status_vars();