~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Brian Aker
  • Date: 2009-01-23 02:15:04 UTC
  • mfrom: (798.2.32 drizzle)
  • Revision ID: brian@tangent.org-20090123021504-2j99e6hxab1ew601
Merge for replication removal.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
 
 
21
#include <drizzled/configmake.h>
21
22
#include <drizzled/server_includes.h>
22
23
 
23
24
#include <netdb.h>
26
27
#include <signal.h>
27
28
 
28
29
#include <mysys/my_bit.h>
29
 
#include <drizzled/slave.h>
30
 
#include <drizzled/replication/mi.h>
31
 
#include <drizzled/replication/replication.h>
32
30
#include <libdrizzle/libdrizzle.h>
33
31
#include <mysys/hash.h>
34
32
#include <drizzled/stacktrace.h>
46
44
#include <drizzled/function/time/get_format.h>
47
45
#include <drizzled/errmsg.h>
48
46
#include <drizzled/unireg.h>
49
 
#include <drizzled/configmake.h>
50
47
 
51
48
 
52
49
#if TIME_WITH_SYS_TIME
247
244
static uint32_t killed_threads, thread_created;
248
245
static uint32_t max_used_connections;
249
246
static char *drizzled_user, *drizzled_chroot;
250
 
static char *opt_init_slave, *language_ptr, *opt_init_connect;
 
247
static char *language_ptr, *opt_init_connect;
251
248
static char *default_character_set_name;
252
249
static char *character_set_filesystem_name;
253
250
static char *lc_time_names_name;
288
285
handlerton *myisam_hton;
289
286
 
290
287
bool use_temp_pool;
291
 
bool relay_log_purge;
292
288
char* opt_secure_file_priv= 0;
293
289
/*
294
290
  True if there is at least one per-hour limit for some user, so we should
297
293
*/
298
294
bool opt_noacl;
299
295
 
300
 
uint64_t opt_binlog_rows_event_max_size;
301
296
#ifdef HAVE_INITGROUPS
302
297
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
303
298
#endif
317
312
uint64_t slow_launch_time;
318
313
uint64_t slave_open_temp_tables;
319
314
uint64_t open_files_limit;
320
 
uint64_t max_binlog_size;
321
 
uint64_t max_relay_log_size;
322
 
uint64_t slave_net_timeout;
323
 
uint64_t slave_trans_retries;
324
 
bool slave_allow_batching;
325
 
ulong slave_exec_mode_options;
326
 
const char *slave_exec_mode_str= "STRICT";
327
315
uint64_t thread_pool_size= 0;
328
 
uint64_t binlog_cache_size= 0;
329
 
uint64_t max_binlog_cache_size= 0;
330
316
uint32_t refresh_version;  /* Increments on each reload */
331
317
uint64_t aborted_threads;
332
318
uint64_t aborted_connects;
333
 
uint64_t binlog_cache_use= 0;
334
 
uint64_t binlog_cache_disk_use= 0;
335
319
uint64_t max_connections;
336
320
uint64_t max_connect_errors;
337
321
ulong thread_id=1L;
338
322
pid_t current_pid;
339
323
uint64_t slow_launch_threads= 0;
340
 
uint64_t sync_binlog_period;
341
324
uint64_t expire_logs_days= 0;
342
325
 
343
326
const double log_10[] = {
449
432
uint32_t report_port= DRIZZLE_PORT;
450
433
uint32_t master_retry_count= 0;
451
434
char *master_info_file;
452
 
char *relay_log_info_file;
453
435
char *report_host;
454
 
char *opt_relay_logname = 0, *opt_relaylog_index_name=0;
455
436
char *opt_logname;
456
437
 
457
438
/* Static variables */
461
442
static bool opt_do_pstack;
462
443
#endif /* HAVE_STACK_TRACE_ON_SEGV */
463
444
static int cleanup_done;
464
 
static char *opt_binlog_index_name;
465
 
static char *opt_tc_heuristic_recover;
466
445
static char *drizzle_home_ptr, *pidfile_name_ptr;
467
446
static int defaults_argc;
468
447
static char **defaults_argv;
602
581
  }
603
582
  (void) pthread_mutex_unlock(&LOCK_thread_count); // For unlink from list
604
583
 
605
 
  end_slave();
606
 
 
607
584
  if (thread_count)
608
585
    sleep(2);                                   // Give threads time to die
609
586
 
799
776
  if (cleanup_done++)
800
777
    return; /* purecov: inspected */
801
778
 
802
 
  drizzle_bin_log.cleanup();
803
 
 
804
 
  if (use_slave_mask)
805
 
    bitmap_free(&slave_error_mask);
806
779
  my_database_names_free();
807
780
  table_cache_free();
808
781
  table_def_free();
813
786
  udf_free();
814
787
  plugin_shutdown();
815
788
  ha_end();
816
 
  if (tc_log)
817
 
    tc_log->close();
818
789
  xid_cache_free();
819
790
  delete_elements(&key_caches, (void (*)(const char*, unsigned char*)) free_key_cache);
820
791
  multi_keycache_free();
827
798
  if (defaults_argv)
828
799
    free_defaults(defaults_argv);
829
800
  free(sys_init_connect.value);
830
 
  free(sys_init_slave.value);
831
801
  free(drizzle_tmpdir);
832
 
  free(slave_load_tmpdir);
833
802
  if (opt_bin_logname)
834
803
    free(opt_bin_logname);
835
 
  if (opt_relay_logname)
836
 
    free(opt_relay_logname);
837
804
  if (opt_secure_file_priv)
838
805
    free(opt_secure_file_priv);
839
806
  bitmap_free(&temp_pool);
1768
1735
  {"alter_table",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},
1769
1736
  {"analyze",              (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ANALYZE]), SHOW_LONG_STATUS},
1770
1737
  {"begin",                (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BEGIN]), SHOW_LONG_STATUS},
1771
 
  {"binlog",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_BINLOG_BASE64_EVENT]), SHOW_LONG_STATUS},
1772
1738
  {"change_db",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_DB]), SHOW_LONG_STATUS},
1773
 
  {"change_master",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHANGE_MASTER]), SHOW_LONG_STATUS},
1774
1739
  {"check",                (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECK]), SHOW_LONG_STATUS},
1775
1740
  {"checksum",             (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_CHECKSUM]), SHOW_LONG_STATUS},
1776
1741
  {"commit",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_COMMIT]), SHOW_LONG_STATUS},
1790
1755
  {"load",                 (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOAD]), SHOW_LONG_STATUS},
1791
1756
  {"lock_tables",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_LOCK_TABLES]), SHOW_LONG_STATUS},
1792
1757
  {"optimize",             (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_OPTIMIZE]), SHOW_LONG_STATUS},
1793
 
  {"purge",                (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE]), SHOW_LONG_STATUS},
1794
 
  {"purge_before_date",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_PURGE_BEFORE]), SHOW_LONG_STATUS},
1795
1758
  {"release_savepoint",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RELEASE_SAVEPOINT]), SHOW_LONG_STATUS},
1796
1759
  {"rename_table",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RENAME_TABLE]), SHOW_LONG_STATUS},
1797
1760
  {"repair",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPAIR]), SHOW_LONG_STATUS},
1798
1761
  {"replace",              (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE]), SHOW_LONG_STATUS},
1799
1762
  {"replace_select",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_REPLACE_SELECT]), SHOW_LONG_STATUS},
1800
 
  {"reset",                (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_RESET]), SHOW_LONG_STATUS},
1801
1763
  {"rollback",             (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK]), SHOW_LONG_STATUS},
1802
1764
  {"rollback_to_savepoint",(char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ROLLBACK_TO_SAVEPOINT]), SHOW_LONG_STATUS},
1803
1765
  {"savepoint",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SAVEPOINT]), SHOW_LONG_STATUS},
1804
1766
  {"select",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SELECT]), SHOW_LONG_STATUS},
1805
1767
  {"set_option",           (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SET_OPTION]), SHOW_LONG_STATUS},
1806
 
  {"show_binlogs",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_BINLOGS]), SHOW_LONG_STATUS},
1807
1768
  {"show_create_db",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE_DB]), SHOW_LONG_STATUS},
1808
1769
  {"show_create_table",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_CREATE]), SHOW_LONG_STATUS},
1809
1770
  {"show_databases",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_DATABASES]), SHOW_LONG_STATUS},
1811
1772
  {"show_errors",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_ERRORS]), SHOW_LONG_STATUS},
1812
1773
  {"show_fields",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_FIELDS]), SHOW_LONG_STATUS},
1813
1774
  {"show_keys",            (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_KEYS]), SHOW_LONG_STATUS},
1814
 
  {"show_master_status",   (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_MASTER_STAT]), SHOW_LONG_STATUS},
1815
1775
  {"show_open_tables",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_OPEN_TABLES]), SHOW_LONG_STATUS},
1816
1776
  {"show_plugins",         (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PLUGINS]), SHOW_LONG_STATUS},
1817
1777
  {"show_processlist",     (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS},
1818
 
  {"show_slave_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS},
1819
1778
  {"show_status",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS},
1820
1779
  {"show_table_status",    (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLE_STATUS]), SHOW_LONG_STATUS},
1821
1780
  {"show_tables",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_TABLES]), SHOW_LONG_STATUS},
1822
1781
  {"show_variables",       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_VARIABLES]), SHOW_LONG_STATUS},
1823
1782
  {"show_warnings",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
1824
 
  {"slave_start",          (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
1825
 
  {"slave_stop",           (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
1826
1783
  {"truncate",             (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]), SHOW_LONG_STATUS},
1827
1784
  {"unlock_tables",        (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
1828
1785
  {"update",               (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]), SHOW_LONG_STATUS},
1866
1823
  */
1867
1824
  global_system_variables.time_zone= my_tz_SYSTEM;
1868
1825
 
1869
 
  /*
1870
 
    Init mutexes for the global DRIZZLE_BIN_LOG objects.
1871
 
    As safe_mutex depends on what MY_INIT() does, we can't init the mutexes of
1872
 
    global DRIZZLE_BIN_LOGs in their constructors, because then they would be
1873
 
    inited before MY_INIT(). So we do it here.
1874
 
  */
1875
 
  drizzle_bin_log.init_pthread_objects();
1876
 
 
1877
1826
  if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
1878
1827
  {
1879
1828
    strncpy(glob_hostname, STRING_WITH_LEN("localhost"));
1961
1910
  item_init();
1962
1911
  if (set_var_init())
1963
1912
    return 1;
1964
 
  if (init_replication_sys_vars())
1965
 
    return 1;
1966
1913
  /*
1967
1914
    Process a comma-separated character set list and choose
1968
1915
    the first available character set. This is mostly for
2037
1984
  if (sys_init_connect.value == NULL)
2038
1985
    return 1;
2039
1986
 
2040
 
  sys_init_slave.value_length= 0;
2041
 
  if ((sys_init_slave.value= opt_init_slave))
2042
 
    sys_init_slave.value_length= strlen(opt_init_slave);
2043
 
  else
2044
 
    sys_init_slave.value=strdup("");
2045
 
  if (sys_init_slave.value == NULL)
2046
 
    return 1;
2047
 
 
2048
1987
  if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
2049
1988
    return 1;
2050
1989
  if (my_database_names_init())
2121
2060
    unireg_abort(1);
2122
2061
  }
2123
2062
 
2124
 
  if (opt_log_slave_updates && replicate_same_server_id)
2125
 
  {
2126
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("using --replicate-same-server-id in conjunction with "
2127
 
                      "--log-slave-updates is impossible, it would lead to "
2128
 
                      "infinite loops in this server."));
2129
 
    unireg_abort(1);
2130
 
  }
2131
 
 
2132
 
  if (opt_bin_log)
2133
 
  {
2134
 
    char buf[FN_REFLEN];
2135
 
    const char *ln;
2136
 
    ln= drizzle_bin_log.generate_name(opt_bin_logname, "-bin", 1, buf);
2137
 
    if (!opt_bin_logname && !opt_binlog_index_name)
2138
 
    {
2139
 
      /*
2140
 
        User didn't give us info to name the binlog index file.
2141
 
        Picking `hostname`-bin.index like did in 4.x, causes replication to
2142
 
        fail if the hostname is changed later. So, we would like to instead
2143
 
        require a name. But as we don't want to break many existing setups, we
2144
 
        only give warning, not error.
2145
 
      */
2146
 
          errmsg_printf(ERRMSG_LVL_WARN, _("No argument was provided to --log-bin, and "
2147
 
                          "--log-bin-index was not used; so replication "
2148
 
                          "may break when this Drizzle server acts as a "
2149
 
                          "master and has his hostname changed!! Please "
2150
 
                          "use '--log-bin=%s' to avoid this problem."), ln);
2151
 
    }
2152
 
    if (ln == buf)
2153
 
    {
2154
 
      free(opt_bin_logname);
2155
 
      opt_bin_logname=strdup(buf);
2156
 
      if (opt_bin_logname == NULL)
2157
 
      {
2158
 
              errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory in init_server_components."));
2159
 
        return(1);
2160
 
      }
2161
 
    }
2162
 
    if (drizzle_bin_log.open_index_file(opt_binlog_index_name, ln))
2163
 
    {
2164
 
      unireg_abort(1);
2165
 
    }
2166
 
  }
2167
 
 
2168
2063
  /* call ha_init_key_cache() on all key caches to init them */
2169
2064
  process_key_caches(&ha_init_key_cache);
2170
2065
 
2259
2154
    }
2260
2155
  }
2261
2156
 
2262
 
  tc_log= (total_ha_2pc > 1 ? (opt_bin_log  ?
2263
 
                               (TC_LOG *) &drizzle_bin_log :
2264
 
                               (TC_LOG *) &tc_log_mmap) :
2265
 
           (TC_LOG *) &tc_log_dummy);
2266
 
 
2267
 
  if (tc_log->open(opt_bin_log ? opt_bin_logname : opt_tc_log_file))
2268
 
  {
2269
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Can't initialize tc_log"));
2270
 
    unireg_abort(1);
2271
 
  }
2272
 
 
2273
2157
  if (ha_recover(0))
2274
2158
  {
2275
2159
    unireg_abort(1);
2276
2160
  }
2277
2161
 
2278
 
  if (opt_bin_log && drizzle_bin_log.open(opt_bin_logname, LOG_BIN, 0,
2279
 
                                          WRITE_CACHE, 0, max_binlog_size, 0))
2280
 
    unireg_abort(1);
2281
 
 
2282
 
  if (opt_bin_log && expire_logs_days)
2283
 
  {
2284
 
    time_t purge_time= server_start_time - expire_logs_days*24*60*60;
2285
 
    if (purge_time >= 0)
2286
 
      drizzle_bin_log.purge_logs_before_date(purge_time);
2287
 
  }
2288
 
 
2289
2162
#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT)
2290
2163
  if (locked_in_memory && !getuid())
2291
2164
  {
2392
2265
      set_user(drizzled_user, user_info);
2393
2266
  }
2394
2267
 
2395
 
  if (opt_bin_log && !server_id)
 
2268
  if (server_id == 0)
2396
2269
  {
2397
2270
    server_id= 1;
2398
 
#ifdef EXTRA_DEBUG
2399
 
      errmsg_printf(ERRMSG_LVL_WARN, _("You have enabled the binary log, but you haven't set "
2400
 
                        "server-id to a non-zero value: we force server id to "
2401
 
                        "1; updates will be logged to the binary log, but "
2402
 
                        "connections from slaves will not be accepted."));
2403
 
#endif
2404
2271
  }
2405
2272
 
2406
2273
  if (init_server_components())
2435
2302
    places) assume that active_mi != 0, so let's fail if it's 0 (out of
2436
2303
    memory); a message has already been printed.
2437
2304
  */
2438
 
  if (init_slave() && !active_mi)
2439
 
  {
2440
 
    unireg_abort(1);
2441
 
  }
2442
2305
 
2443
2306
  errmsg_printf(ERRMSG_LVL_INFO, _(ER(ER_STARTUP)),my_progname,server_version,
2444
2307
                        "", drizzled_port, COMPILATION_COMMENT);
2677
2540
  OPT_DELAY_KEY_WRITE,         OPT_CHARSETS_DIR,
2678
2541
  OPT_MASTER_INFO_FILE,
2679
2542
  OPT_MASTER_RETRY_COUNT,      OPT_LOG_TC, OPT_LOG_TC_SIZE,
2680
 
  OPT_SQL_BIN_UPDATE_SAME,
2681
 
  OPT_LOG_SLAVE_UPDATES,
2682
 
  OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
2683
2543
  OPT_WANT_CORE,
2684
2544
  OPT_MEMLOCK,                 OPT_MYISAM_RECOVER,
2685
2545
  OPT_SERVER_ID,
2690
2550
  OPT_ENGINE_CONDITION_PUSHDOWN,
2691
2551
  OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
2692
2552
  OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
2693
 
  OPT_MAX_BINLOG_DUMP_EVENTS, OPT_SPORADIC_BINLOG_DUMP_FAIL,
2694
2553
  OPT_SAFE_USER_CREATE,
2695
2554
  OPT_DO_PSTACK, OPT_REPORT_HOST,
2696
2555
  OPT_REPORT_USER, OPT_REPORT_PASSWORD, OPT_REPORT_PORT,
2701
2560
  OPT_SLAVE_SKIP_ERRORS, OPT_SLAVE_ALLOW_BATCHING, OPT_DES_KEY_FILE, OPT_LOCAL_INFILE,
2702
2561
  OPT_SSL_SSL, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA,
2703
2562
  OPT_SSL_CAPATH, OPT_SSL_CIPHER,
2704
 
  OPT_BACK_LOG, OPT_BINLOG_CACHE_SIZE,
 
2563
  OPT_BACK_LOG,
2705
2564
  OPT_CONNECT_TIMEOUT,
2706
2565
  OPT_FLUSH_TIME,
2707
2566
  OPT_INTERACTIVE_TIMEOUT, OPT_JOIN_BUFF_SIZE,
2709
2568
  OPT_KEY_CACHE_DIVISION_LIMIT, OPT_KEY_CACHE_AGE_THRESHOLD,
2710
2569
  OPT_LONG_QUERY_TIME,
2711
2570
  OPT_LOWER_CASE_TABLE_NAMES, OPT_MAX_ALLOWED_PACKET,
2712
 
  OPT_MAX_BINLOG_CACHE_SIZE, OPT_MAX_BINLOG_SIZE,
2713
2571
  OPT_MAX_CONNECTIONS, OPT_MAX_CONNECT_ERRORS,
2714
2572
  OPT_MAX_HEP_TABLE_SIZE,
2715
2573
  OPT_MAX_JOIN_SIZE,
2739
2597
  OPT_RANGE_ALLOC_BLOCK_SIZE,
2740
2598
  OPT_QUERY_ALLOC_BLOCK_SIZE, OPT_QUERY_PREALLOC_SIZE,
2741
2599
  OPT_TRANS_ALLOC_BLOCK_SIZE, OPT_TRANS_PREALLOC_SIZE,
2742
 
  OPT_SYNC_FRM, OPT_SYNC_BINLOG,
 
2600
  OPT_SYNC_FRM,
2743
2601
  OPT_SYNC_REPLICATION,
2744
2602
  OPT_SYNC_REPLICATION_SLAVE_ID,
2745
2603
  OPT_SYNC_REPLICATION_TIMEOUT,
2791
2649
  {"help", '?', N_("Display this help and exit."),
2792
2650
   (char**) &opt_help, (char**) &opt_help, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
2793
2651
   0, 0},
2794
 
  {"abort-slave-event-count", OPT_ABORT_SLAVE_EVENT_COUNT,
2795
 
   N_("Option used by mysql-test for debugging and testing of replication."),
2796
 
   (char**) &abort_slave_event_count,  (char**) &abort_slave_event_count,
2797
 
   0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2798
2652
  {"auto-increment-increment", OPT_AUTO_INCREMENT,
2799
2653
   N_("Auto-increment columns are incremented by this"),
2800
2654
   (char**) &global_system_variables.auto_increment_increment,
2814
2668
  {"bind-address", OPT_BIND_ADDRESS, N_("IP address to bind to."),
2815
2669
   (char**) &my_bind_addr_str, (char**) &my_bind_addr_str, 0, GET_STR,
2816
2670
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2817
 
  {"binlog-row-event-max-size", OPT_BINLOG_ROWS_EVENT_MAX_SIZE,
2818
 
   N_("The maximum size of a row-based binary log event in bytes. Rows will "
2819
 
      "be grouped into events smaller than this size if possible. "
2820
 
      "The value has to be a multiple of 256."),
2821
 
   (char**) &opt_binlog_rows_event_max_size,
2822
 
   (char**) &opt_binlog_rows_event_max_size, 0,
2823
 
   GET_ULL, REQUIRED_ARG,
2824
 
   /* def_value */ 1024, /* min_value */  256, /* max_value */ ULONG_MAX,
2825
 
   /* sub_size */     0, /* block_size */ 256,
2826
 
   /* app_type */ 0
2827
 
  },
2828
2671
  {"character-set-filesystem", OPT_CHARACTER_SET_FILESYSTEM,
2829
2672
   N_("Set the filesystem character set."),
2830
2673
   (char**) &character_set_filesystem_name,
2869
2712
  {"delay-key-write", OPT_DELAY_KEY_WRITE,
2870
2713
   N_("Type of DELAY_KEY_WRITE."),
2871
2714
   0,0,0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
2872
 
  {"disconnect-slave-event-count", OPT_DISCONNECT_SLAVE_EVENT_COUNT,
2873
 
   N_("Option used by mysql-test for debugging and testing of replication."),
2874
 
   (char**) &disconnect_slave_event_count,
2875
 
   (char**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
2876
 
   0, 0, 0},
2877
2715
#ifdef HAVE_STACK_TRACE_ON_SEGV
2878
2716
  {"enable-pstack", OPT_DO_PSTACK,
2879
2717
   N_("Print a symbolic stack trace on failure."),
2907
2745
   N_("Read SQL commands from this file at startup."),
2908
2746
   (char**) &opt_init_file, (char**) &opt_init_file, 0, GET_STR, REQUIRED_ARG,
2909
2747
   0, 0, 0, 0, 0, 0},
2910
 
  {"init-slave", OPT_INIT_SLAVE,
2911
 
   N_("Command(s) that are executed when a slave connects to this master"),
2912
 
   (char**) &opt_init_slave, (char**) &opt_init_slave, 0, GET_STR_ALLOC,
2913
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2914
2748
  {"language", 'L',
2915
2749
   N_("(IGNORED)"),
2916
2750
   (char**) &language_ptr, (char**) &language_ptr, 0, GET_STR, REQUIRED_ARG,
2929
2763
   N_("Log connections and queries to file."),
2930
2764
   (char**) &opt_logname,
2931
2765
   (char**) &opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
2932
 
  {"log-bin", OPT_BIN_LOG,
2933
 
   N_("Log update queries in binary format. Optional argument is the "
2934
 
      "location for the binary log files.(Strongly "
2935
 
      "recommended to avoid replication problems if server's hostname "
2936
 
      "changes)"),
2937
 
   (char**) &opt_bin_logname, (char**) &opt_bin_logname, 0, GET_STR_ALLOC,
2938
 
   OPT_ARG, 0, 0, 0, 0, 0, 0},
2939
 
  {"log-bin-index", OPT_BIN_LOG_INDEX,
2940
 
   N_("File that holds the names for last binary log files."),
2941
 
   (char**) &opt_binlog_index_name, (char**) &opt_binlog_index_name, 0, GET_STR,
2942
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2943
2766
  {"log-isam", OPT_ISAM_LOG,
2944
2767
   N_("Log all MyISAM changes to file."),
2945
2768
   (char**) &myisam_log_filename, (char**) &myisam_log_filename, 0, GET_STR,
2946
2769
   OPT_ARG, 0, 0, 0, 0, 0, 0},
2947
 
  {"log-slave-updates", OPT_LOG_SLAVE_UPDATES,
2948
 
   N_("Tells the slave to log the updates from the slave thread to the binary "
2949
 
      "log. You will need to turn it on if you plan to "
2950
 
      "daisy-chain the slaves."),
2951
 
   (char**) &opt_log_slave_updates, (char**) &opt_log_slave_updates,
2952
 
   0, GET_BOOL,
2953
 
   NO_ARG, 0, 0, 0, 0, 0, 0},
2954
 
  {"log-tc", OPT_LOG_TC,
2955
 
   N_("Path to transaction coordinator log (used for transactions that affect "
2956
 
      "more than one storage engine, when binary log is disabled)"),
2957
 
   (char**) &opt_tc_log_file, (char**) &opt_tc_log_file, 0, GET_STR,
2958
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2959
 
#ifdef HAVE_MMAP
2960
 
  {"log-tc-size", OPT_LOG_TC_SIZE,
2961
 
   N_("Size of transaction coordinator log."),
2962
 
   (char**) &opt_tc_log_size, (char**) &opt_tc_log_size, 0, GET_ULL,
2963
 
   REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0,
2964
 
   TC_LOG_PAGE_SIZE, 0},
2965
 
#endif
2966
2770
  {"log-warnings", 'W',
2967
2771
   N_("Log some not critical warnings to the log file."),
2968
2772
   (char**) &global_system_variables.log_warnings,
2969
2773
   (char**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
2970
2774
   0, 0, 0},
2971
 
  {"master-info-file", OPT_MASTER_INFO_FILE,
2972
 
   N_("The location and name of the file that remembers the master and "
2973
 
      "where the I/O replication thread is in the master's binlogs."),
2974
 
   (char**) &master_info_file, (char**) &master_info_file, 0, GET_STR,
2975
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2976
 
  {"master-retry-count", OPT_MASTER_RETRY_COUNT,
2977
 
   N_("The number of tries the slave will make to connect to the master "
2978
 
      "before giving up."),
2979
 
   (char**) &master_retry_count, (char**) &master_retry_count, 0, GET_ULONG,
2980
 
   REQUIRED_ARG, 3600*24, 0, 0, 0, 0, 0},
2981
 
  {"max-binlog-dump-events", OPT_MAX_BINLOG_DUMP_EVENTS,
2982
 
   N_("Option used by mysql-test for debugging and testing of replication."),
2983
 
   (char**) &max_binlog_dump_events, (char**) &max_binlog_dump_events, 0,
2984
 
   GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
2985
2775
  {"memlock", OPT_MEMLOCK,
2986
2776
   N_("Lock drizzled in memory."),
2987
2777
   (char**) &locked_in_memory,
3016
2806
      "(Default: no wait)"),
3017
2807
   (char**) &drizzled_port_timeout,
3018
2808
   (char**) &drizzled_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3019
 
  {"relay-log", OPT_RELAY_LOG,
3020
 
   N_("The location and name to use for relay logs."),
3021
 
   (char**) &opt_relay_logname, (char**) &opt_relay_logname, 0,
3022
 
   GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3023
 
  {"relay-log-index", OPT_RELAY_LOG_INDEX,
3024
 
   N_("The location and name to use for the file that keeps a list of the "
3025
 
      "last relay logs."),
3026
 
   (char**) &opt_relaylog_index_name, (char**) &opt_relaylog_index_name, 0,
3027
 
   GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3028
 
  {"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
3029
 
   N_("The location and name of the file that remembers where the SQL "
3030
 
      "replication thread is in the relay logs."),
3031
 
   (char**) &relay_log_info_file, (char**) &relay_log_info_file, 0, GET_STR,
3032
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3033
 
  {"replicate-same-server-id", OPT_REPLICATE_SAME_SERVER_ID,
3034
 
   N_("In replication, if set to 1, do not skip events having our server id. "
3035
 
      "Default value is 0 (to break infinite loops in circular replication). "
3036
 
      "Can't be set to 1 if --log-slave-updates is used."),
3037
 
   (char**) &replicate_same_server_id,
3038
 
   (char**) &replicate_same_server_id,
3039
 
   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3040
 
  // In replication, we may need to tell the other servers how to connect
3041
 
  {"report-host", OPT_REPORT_HOST,
3042
 
   N_("Hostname or IP of the slave to be reported to to the master during "
3043
 
      "slave registration. Will appear in the output of SHOW SLAVE HOSTS. "
3044
 
      "Leave unset if you do not want the slave to register itself with the "
3045
 
      "master. Note that it is not sufficient for the master to simply read "
3046
 
      "the IP of the slave off the socket once the slave connects. Due to NAT "
3047
 
      "and other routing issues, that IP may not be valid for connecting to "
3048
 
      "the slave from the master or other hosts."),
3049
 
   (char**) &report_host, (char**) &report_host, 0, GET_STR, REQUIRED_ARG, 0, 0,
3050
 
   0, 0, 0, 0},
3051
2809
  {"safe-mode", OPT_SAFE,
3052
2810
   N_("Skip some optimize stages (for testing)."),
3053
2811
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3064
2822
  {"skip-new", OPT_SKIP_NEW,
3065
2823
   N_("Don't use new, possible wrong routines."),
3066
2824
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
3067
 
  {"skip-slave-start", OPT_SKIP_SLAVE_START,
3068
 
   N_("If set, slave is not started automatically."),
3069
 
   (char**) &opt_skip_slave_start,
3070
 
   (char**) &opt_skip_slave_start, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
3071
2825
  {"skip-stack-trace", OPT_SKIP_STACK_TRACE,
3072
2826
   N_("Don't print a stack trace on failure."),
3073
2827
   0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
3076
2830
   N_("Don't give threads different priorities."),
3077
2831
   0, 0, 0, GET_NO_ARG, NO_ARG,
3078
2832
   DEFAULT_SKIP_THREAD_PRIORITY, 0, 0, 0, 0, 0},
3079
 
  {"slave-load-tmpdir", OPT_SLAVE_LOAD_TMPDIR,
3080
 
   N_("The location where the slave should put its temporary files when "
3081
 
      "replicating a LOAD DATA INFILE command."),
3082
 
   (char**) &slave_load_tmpdir, (char**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
3083
 
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3084
 
  {"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
3085
 
   N_("Tells the slave thread to continue replication when a query event "
3086
 
      "returns an error from the provided list."),
3087
 
   0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3088
 
  {"slave-exec-mode", OPT_SLAVE_EXEC_MODE,
3089
 
   N_("Modes for how replication events should be executed.  Legal values are "
3090
 
      "STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will "
3091
 
      "not stop for operations that are idempotent. In STRICT mode, "
3092
 
      "replication will stop on any unexpected difference between the master "
3093
 
      "and the slave."),
3094
 
   (char**) &slave_exec_mode_str, (char**) &slave_exec_mode_str,
3095
 
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3096
 
  {"sql-bin-update-same", OPT_SQL_BIN_UPDATE_SAME,
3097
 
   N_("(INGORED)"),
3098
 
   0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0},
3099
2833
  {"symbolic-links", 's',
3100
2834
   N_("Enable symbolic link support."),
3101
2835
   (char**) &my_use_symdir, (char**) &my_use_symdir, 0, GET_BOOL, NO_ARG,
3110
2844
      "safe-replicable."),
3111
2845
   (char**) &global_system_variables.sysdate_is_now,
3112
2846
   0, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3113
 
  {"tc-heuristic-recover", OPT_TC_HEURISTIC_RECOVER,
3114
 
   N_("Decision to use in heuristic recover process. Possible values are "
3115
 
      "COMMIT or ROLLBACK."),
3116
 
   (char**) &opt_tc_heuristic_recover, (char**) &opt_tc_heuristic_recover,
3117
 
   0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
3118
2847
  {"temp-pool", OPT_TEMP_POOL,
3119
2848
   N_("Using this option will cause most temporary files created to use a "
3120
2849
      "small set of names, rather than a unique name for each new file."),
3147
2876
      "requests in a very short time."),
3148
2877
    (char**) &back_log, (char**) &back_log, 0, GET_UINT,
3149
2878
    REQUIRED_ARG, 50, 1, 65535, 0, 1, 0 },
3150
 
  { "binlog_cache_size", OPT_BINLOG_CACHE_SIZE,
3151
 
    N_("The size of the cache to hold the SQL statements for the binary log "
3152
 
       "during a transaction. If you often use big, multi-statement "
3153
 
       "transactions you can increase this to get more performance."),
3154
 
    (char**) &binlog_cache_size, (char**) &binlog_cache_size, 0, GET_ULL,
3155
 
    REQUIRED_ARG, 32*1024L, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3156
2879
  { "bulk_insert_buffer_size", OPT_BULK_INSERT_BUFFER_SIZE,
3157
2880
    N_("Size of tree cache used in bulk insert optimization. Note that this is "
3158
2881
       "a limit per thread!"),
3185
2908
   (char**) &global_system_variables.div_precincrement,
3186
2909
   (char**) &max_system_variables.div_precincrement, 0, GET_UINT,
3187
2910
   REQUIRED_ARG, 4, 0, DECIMAL_MAX_SCALE, 0, 0, 0},
3188
 
  { "expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
3189
 
    N_("If non-zero, binary logs will be purged after expire_logs_days "
3190
 
       "days; possible purges happen at startup and at binary log rotation."),
3191
 
    (char**) &expire_logs_days,
3192
 
    (char**) &expire_logs_days, 0, GET_ULL,
3193
 
    REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
3194
2911
  { "group_concat_max_len", OPT_GROUP_CONCAT_MAX_LEN,
3195
2912
    N_("The maximum length of the result of function  group_concat."),
3196
2913
    (char**) &global_system_variables.group_concat_max_len,
3248
2965
   (char**) &global_system_variables.max_allowed_packet,
3249
2966
   (char**) &max_system_variables.max_allowed_packet, 0, GET_ULONG,
3250
2967
   REQUIRED_ARG, 1024*1024L, 1024, 1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
3251
 
  {"max_binlog_cache_size", OPT_MAX_BINLOG_CACHE_SIZE,
3252
 
   N_("Can be used to restrict the total size used to cache a "
3253
 
      "multi-transaction query."),
3254
 
   (char**) &max_binlog_cache_size, (char**) &max_binlog_cache_size, 0,
3255
 
   GET_ULL, REQUIRED_ARG, ULONG_MAX, IO_SIZE, ULONG_MAX, 0, IO_SIZE, 0},
3256
 
  {"max_binlog_size", OPT_MAX_BINLOG_SIZE,
3257
 
   N_("Binary log will be rotated automatically when the size exceeds this "
3258
 
      "value. Will also apply to relay logs if max_relay_log_size is 0. "
3259
 
      "The minimum value for this variable is 4096."),
3260
 
   (char**) &max_binlog_size, (char**) &max_binlog_size, 0, GET_ULONG,
3261
 
   REQUIRED_ARG, 1024*1024L*1024L, IO_SIZE, 1024*1024L*1024L, 0, IO_SIZE, 0},
3262
2968
  {"max_connect_errors", OPT_MAX_CONNECT_ERRORS,
3263
2969
   N_("If there is more than this number of interrupted connections from a "
3264
2970
      "host this host will be blocked from further connections."),
3293
2999
   (char**) &global_system_variables.max_length_for_sort_data,
3294
3000
   (char**) &max_system_variables.max_length_for_sort_data, 0, GET_ULL,
3295
3001
   REQUIRED_ARG, 1024, 4, 8192*1024L, 0, 1, 0},
3296
 
  {"max_relay_log_size", OPT_MAX_RELAY_LOG_SIZE,
3297
 
   N_("If non-zero: relay log will be rotated automatically when the size "
3298
 
      "exceeds this value; if zero (the default): when the size exceeds "
3299
 
      "max_binlog_size. 0 excepted, the minimum value for this variable "
3300
 
      "is 4096."),
3301
 
   (char**) &max_relay_log_size, (char**) &max_relay_log_size, 0, GET_ULONG,
3302
 
   REQUIRED_ARG, 0L, 0L, 1024*1024L*1024L, 0, IO_SIZE, 0},
3303
3002
  { "max_seeks_for_key", OPT_MAX_SEEKS_FOR_KEY,
3304
3003
    N_("Limit assumed max number of seeks when looking up rows based on a key"),
3305
3004
    (char**) &global_system_variables.max_seeks_for_key,
3437
3136
   (char**) &max_system_variables.read_rnd_buff_size, 0,
3438
3137
   GET_UINT, REQUIRED_ARG, 256*1024L, 64 /*IO_SIZE*2+MALLOC_OVERHEAD*/ ,
3439
3138
   UINT32_MAX, MALLOC_OVERHEAD, 1 /* Small lower limit to be able to test MRR */, 0},
3440
 
  {"relay_log_purge", OPT_RELAY_LOG_PURGE,
3441
 
   N_("0 = do not purge relay logs. "
3442
 
      "1 = purge them as soon as they are no more needed."),
3443
 
   (char**) &relay_log_purge,
3444
 
   (char**) &relay_log_purge, 0, GET_BOOL, NO_ARG,
3445
 
   1, 0, 1, 0, 1, 0},
3446
 
  {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT,
3447
 
   N_("Maximum space to use for all relay logs."),
3448
 
   (char**) &relay_log_space_limit,
3449
 
   (char**) &relay_log_space_limit, 0, GET_ULL, REQUIRED_ARG, 0L, 0L,
3450
 
   (int64_t) ULONG_MAX, 0, 1, 0},
3451
 
  {"slave_compressed_protocol", OPT_SLAVE_COMPRESSED_PROTOCOL,
3452
 
   N_("Use compression on master/slave protocol."),
3453
 
   (char**) &opt_slave_compressed_protocol,
3454
 
   (char**) &opt_slave_compressed_protocol,
3455
 
   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3456
 
  {"slave_net_timeout", OPT_SLAVE_NET_TIMEOUT,
3457
 
   N_("Number of seconds to wait for more data from a master/slave connection "
3458
 
      "before aborting the read."),
3459
 
   (char**) &slave_net_timeout, (char**) &slave_net_timeout, 0,
3460
 
   GET_UINT, REQUIRED_ARG, SLAVE_NET_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
3461
 
  {"slave_transaction_retries", OPT_SLAVE_TRANS_RETRIES,
3462
 
   N_("Number of times the slave SQL thread will retry a transaction in case "
3463
 
      "it failed with a deadlock or elapsed lock wait timeout, "
3464
 
      "before giving up and stopping."),
3465
 
   (char**) &slave_trans_retries, (char**) &slave_trans_retries, 0,
3466
 
   GET_ULL, REQUIRED_ARG, 10L, 0L, (int64_t) ULONG_MAX, 0, 1, 0},
3467
 
  {"slave-allow-batching", OPT_SLAVE_ALLOW_BATCHING,
3468
 
   N_("Allow slave to batch requests."),
3469
 
   (char**) &slave_allow_batching, (char**) &slave_allow_batching,
3470
 
   0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
3471
 
  {"slow_launch_time", OPT_SLOW_LAUNCH_TIME,
3472
 
   N_("If creating the thread takes longer than this value (in seconds), the "
3473
 
      "Slow_launch_threads counter will be incremented."),
3474
 
   (char**) &slow_launch_time, (char**) &slow_launch_time, 0, GET_ULL,
3475
 
   REQUIRED_ARG, 2L, 0L, LONG_TIMEOUT, 0, 1, 0},
3476
3139
  {"sort_buffer_size", OPT_SORT_BUFFER,
3477
3140
   N_("Each thread that needs to do a sort allocates a buffer of this size."),
3478
3141
   (char**) &global_system_variables.sortbuff_size,
3479
3142
   (char**) &max_system_variables.sortbuff_size, 0, GET_ULONG, REQUIRED_ARG,
3480
3143
   MAX_SORT_MEMORY, MIN_SORT_MEMORY+MALLOC_OVERHEAD*2, SIZE_MAX,
3481
3144
   MALLOC_OVERHEAD, 1, 0},
3482
 
  {"sync-binlog", OPT_SYNC_BINLOG,
3483
 
   N_("Synchronously flush binary log to disk after every #th event. "
3484
 
      "Use 0 (default) to disable synchronous flushing."),
3485
 
   (char**) &sync_binlog_period, (char**) &sync_binlog_period, 0, GET_ULL,
3486
 
   REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0},
3487
3145
  {"table_definition_cache", OPT_TABLE_DEF_CACHE,
3488
3146
   N_("The number of cached table definitions."),
3489
3147
   (char**) &table_def_size, (char**) &table_def_size,
3573
3231
static st_show_var_func_container
3574
3232
show_flushstatustime_cont= { &show_flushstatustime };
3575
3233
 
3576
 
static int show_slave_running(Session *session __attribute__((unused)),
3577
 
                              SHOW_VAR *var, char *buff)
3578
 
{
3579
 
  var->type= SHOW_MY_BOOL;
3580
 
  pthread_mutex_lock(&LOCK_active_mi);
3581
 
  var->value= buff;
3582
 
  *((bool *)buff)= (bool) (active_mi && active_mi->slave_running &&
3583
 
                                 active_mi->rli.slave_running);
3584
 
  pthread_mutex_unlock(&LOCK_active_mi);
3585
 
  return 0;
3586
 
}
3587
 
 
3588
 
static st_show_var_func_container
3589
 
show_slave_running_cont= { &show_slave_running };
3590
 
 
3591
 
static int show_slave_retried_trans(Session *session __attribute__((unused)),
3592
 
                                    SHOW_VAR *var, char *buff)
3593
 
{
3594
 
  /*
3595
 
    TODO: with multimaster, have one such counter per line in
3596
 
    SHOW SLAVE STATUS, and have the sum over all lines here.
3597
 
  */
3598
 
  pthread_mutex_lock(&LOCK_active_mi);
3599
 
  if (active_mi)
3600
 
  {
3601
 
    var->type= SHOW_LONG;
3602
 
    var->value= buff;
3603
 
    pthread_mutex_lock(&active_mi->rli.data_lock);
3604
 
    *((long *)buff)= (long)active_mi->rli.retried_trans;
3605
 
    pthread_mutex_unlock(&active_mi->rli.data_lock);
3606
 
  }
3607
 
  else
3608
 
    var->type= SHOW_UNDEF;
3609
 
  pthread_mutex_unlock(&LOCK_active_mi);
3610
 
  return 0;
3611
 
}
3612
 
 
3613
 
static st_show_var_func_container
3614
 
show_slave_retried_trans_cont= { &show_slave_retried_trans };
3615
 
 
3616
 
static int show_slave_received_heartbeats(Session *session __attribute__((unused)),
3617
 
                                          SHOW_VAR *var, char *buff)
3618
 
{
3619
 
  pthread_mutex_lock(&LOCK_active_mi);
3620
 
  if (active_mi)
3621
 
  {
3622
 
    var->type= SHOW_LONGLONG;
3623
 
    var->value= buff;
3624
 
    pthread_mutex_lock(&active_mi->rli.data_lock);
3625
 
    *((int64_t *)buff)= active_mi->received_heartbeats;
3626
 
    pthread_mutex_unlock(&active_mi->rli.data_lock);
3627
 
  }
3628
 
  else
3629
 
    var->type= SHOW_UNDEF;
3630
 
  pthread_mutex_unlock(&LOCK_active_mi);
3631
 
  return 0;
3632
 
}
3633
 
 
3634
 
static st_show_var_func_container
3635
 
show_slave_received_heartbeats_cont= { &show_slave_received_heartbeats };
3636
 
 
3637
 
static int show_heartbeat_period(Session *session __attribute__((unused)),
3638
 
                                 SHOW_VAR *var, char *buff)
3639
 
{
3640
 
  pthread_mutex_lock(&LOCK_active_mi);
3641
 
  if (active_mi)
3642
 
  {
3643
 
    var->type= SHOW_CHAR;
3644
 
    var->value= buff;
3645
 
    sprintf(buff, "%.3f",active_mi->heartbeat_period);
3646
 
  }
3647
 
  else
3648
 
    var->type= SHOW_UNDEF;
3649
 
  pthread_mutex_unlock(&LOCK_active_mi);
3650
 
  return 0;
3651
 
}
3652
 
 
3653
 
static st_show_var_func_container
3654
 
show_heartbeat_period_cont= { &show_heartbeat_period};
3655
 
 
3656
3234
static int show_open_tables(Session *session __attribute__((unused)),
3657
3235
                            SHOW_VAR *var, char *buff)
3658
3236
{
3683
3261
SHOW_VAR status_vars[]= {
3684
3262
  {"Aborted_clients",          (char*) &aborted_threads,        SHOW_LONGLONG},
3685
3263
  {"Aborted_connects",         (char*) &aborted_connects,       SHOW_LONGLONG},
3686
 
  {"Binlog_cache_disk_use",    (char*) &binlog_cache_disk_use,  SHOW_LONGLONG},
3687
 
  {"Binlog_cache_use",         (char*) &binlog_cache_use,       SHOW_LONGLONG},
3688
3264
  {"Bytes_received",           (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS},
3689
3265
  {"Bytes_sent",               (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
3690
3266
  {"Com",                      (char*) com_status_vars, SHOW_ARRAY},
3730
3306
  {"Select_range",             (char*) offsetof(STATUS_VAR, select_range_count), SHOW_LONG_STATUS},
3731
3307
  {"Select_range_check",       (char*) offsetof(STATUS_VAR, select_range_check_count), SHOW_LONG_STATUS},
3732
3308
  {"Select_scan",              (char*) offsetof(STATUS_VAR, select_scan_count), SHOW_LONG_STATUS},
3733
 
  {"Slave_open_temp_tables",   (char*) &slave_open_temp_tables, SHOW_LONGLONG},
3734
 
  {"Slave_retried_transactions",(char*) &show_slave_retried_trans_cont, SHOW_FUNC},
3735
 
  {"Slave_heartbeat_period",   (char*) &show_heartbeat_period_cont, SHOW_FUNC},
3736
 
  {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats_cont, SHOW_FUNC},
3737
 
  {"Slave_running",            (char*) &show_slave_running_cont,     SHOW_FUNC},
3738
3309
  {"Slow_launch_threads",      (char*) &slow_launch_threads,    SHOW_LONGLONG},
3739
3310
  {"Slow_queries",             (char*) offsetof(STATUS_VAR, long_query_count), SHOW_LONG_STATUS},
3740
3311
  {"Sort_merge_passes",        (char*) offsetof(STATUS_VAR, filesort_merge_passes), SHOW_LONG_STATUS},
3743
3314
  {"Sort_scan",                (char*) offsetof(STATUS_VAR, filesort_scan_count), SHOW_LONG_STATUS},
3744
3315
  {"Table_locks_immediate",    (char*) &locks_immediate,        SHOW_INT},
3745
3316
  {"Table_locks_waited",       (char*) &locks_waited,           SHOW_INT},
3746
 
#ifdef HAVE_MMAP
3747
 
  {"Tc_log_max_pages_used",    (char*) &tc_log_max_pages_used,  SHOW_LONGLONG},
3748
 
  {"Tc_log_page_size",         (char*) &tc_log_page_size,       SHOW_LONGLONG},
3749
 
  {"Tc_log_page_waits",        (char*) &tc_log_page_waits,      SHOW_LONGLONG},
3750
 
#endif
3751
3317
  {"Threads_connected",        (char*) &connection_count,       SHOW_INT},
3752
3318
  {"Threads_created",          (char*) &thread_created,         SHOW_LONG_NOFLUSH},
3753
3319
  {"Threads_running",          (char*) &thread_running,         SHOW_INT},
3823
3389
  drizzle_home[0]= pidfile_name[0]= 0;
3824
3390
  opt_bin_log= 0;
3825
3391
  opt_skip_show_db=0;
3826
 
  opt_logname= opt_binlog_index_name= 0;
 
3392
  opt_logname= 0;
3827
3393
  opt_tc_log_file= (char *)"tc.log";      // no hostname in tc_log file name !
3828
3394
  opt_secure_file_priv= 0;
3829
3395
  segfaulted= kill_in_progress= 0;
3839
3405
  abort_loop= select_thread_in_use= signal_thread_in_use= 0;
3840
3406
  ready_to_exit= shutdown_in_progress= 0;
3841
3407
  aborted_threads= aborted_connects= 0;
3842
 
  binlog_cache_use=  binlog_cache_disk_use= 0;
3843
3408
  max_used_connections= slow_launch_threads = 0;
3844
3409
  drizzled_user= drizzled_chroot= opt_init_file= opt_bin_logname = 0;
3845
3410
  my_bind_addr_str= NULL;
3857
3422
 
3858
3423
  /* Things with default values that are not zero */
3859
3424
  delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
3860
 
  slave_exec_mode_options= 0;
3861
 
  slave_exec_mode_options= (uint)
3862
 
    find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL);
3863
3425
  drizzle_home_ptr= drizzle_home;
3864
3426
  pidfile_name_ptr= pidfile_name;
3865
3427
  language_ptr= language;
3888
3450
  drizzle_data_home_buff[1]=0;
3889
3451
  drizzle_data_home_len= 2;
3890
3452
 
3891
 
  /* Replication parameters */
3892
 
  master_info_file= (char*) "master.info",
3893
 
    relay_log_info_file= (char*) "relay-log.info";
3894
 
  report_host= 0;       /* TO BE DELETED */
3895
 
  opt_relay_logname= opt_relaylog_index_name= 0;
3896
 
 
3897
3453
  /* Variables in libraries */
3898
3454
  charsets_dir= 0;
3899
3455
  default_character_set_name= (char*) DRIZZLE_DEFAULT_CHARSET_NAME;
3966
3522
    strncpy(language, argument, sizeof(language)-1);
3967
3523
    break;
3968
3524
  case OPT_SLAVE_SKIP_ERRORS:
3969
 
    init_slave_skip_errors(argument);
3970
3525
    break;
3971
3526
  case OPT_SLAVE_EXEC_MODE:
3972
 
    slave_exec_mode_options= (uint)
3973
 
      find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "");
3974
3527
    break;
3975
3528
  case 'V':
3976
3529
    print_version();
4198
3751
  }
4199
3752
  /* Set global MyISAM variables from delay_key_write_options */
4200
3753
  fix_delay_key_write((Session*) 0, OPT_GLOBAL);
4201
 
  /* Set global slave_exec_mode from its option */
4202
 
  fix_slave_exec_mode(OPT_GLOBAL);
4203
3754
 
4204
3755
  if (drizzled_chroot)
4205
3756
    set_root(drizzled_chroot);
4331
3882
    }
4332
3883
  }
4333
3884
 
4334
 
  if (!slave_load_tmpdir)
4335
 
  {
4336
 
    if (!(slave_load_tmpdir = (char*) strdup(drizzle_tmpdir)))
4337
 
      exit(1);
4338
 
  }
4339
3885
  /*
4340
3886
    Convert the secure-file-priv option to system format, allowing
4341
3887
    a quick strcmp to check if read or write is in an allowed dir