1830
1848
char *default_path;
1831
1849
uint format_id;
1832
1850
InnobaseEngine *actuall_engine_ptr;
1851
const module::option_map &vm= context.getOptions();
1853
if (vm.count("io-capacity"))
1855
if (srv_io_capacity < 100)
1857
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for io-capacity\n"));
1862
if (vm.count("data-home-dir"))
1864
innobase_data_home_dir= strdup(vm["data-home-dir"].as<string>().c_str());
1869
innobase_data_home_dir= NULL;
1872
if (vm.count("fast-shutdown"))
1874
if (innobase_fast_shutdown > 2)
1876
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for fast-shutdown\n"));
1881
if (vm.count("file-format-check"))
1883
innobase_file_format_check= const_cast<char *>(vm["file-format-check"].as<string>().c_str());
1886
if (vm.count("flush-log-at-trx-commit"))
1888
if (srv_flush_log_at_trx_commit > 2)
1890
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for flush-log-at-trx-commit\n"));
1895
if (vm.count("flush-method"))
1897
innobase_unix_file_flush_method= const_cast<char *>(vm["flush-method"].as<string>().c_str());
1901
innobase_unix_file_flush_method= NULL;
1904
#ifdef UNIV_LOG_ARCHIVE
1905
if (vm.count("log-arch-dir"))
1907
innobase_log_arch_dir= const_cast<char *>(vm["log-arch-dir"].as<string>().c_str());
1912
innobase_log_arch_dir= NULL;
1914
#endif /* UNIV_LOG_ARCHIVE */
1916
if (vm.count("max-dirty-pages-pct"))
1918
if (srv_max_buf_pool_modified_pct > 99)
1920
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for max-dirty-pages-pct\n"));
1925
if (vm.count("stats-sample-pages"))
1927
if (srv_stats_sample_pages < 8)
1929
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for stats-sample-pages\n"));
1934
if (vm.count("additional-mem-pool-size"))
1936
align_value(innobase_additional_mem_pool_size);
1938
if (innobase_additional_mem_pool_size < 512*1024L)
1940
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for additional-mem-pool-size\n"));
1946
if (vm.count("autoextend-increment"))
1948
if (srv_auto_extend_increment < 1 || srv_auto_extend_increment > 1000)
1950
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for autoextend-increment\n"));
1955
if (vm.count("buffer-pool-size"))
1957
align_value(innobase_buffer_pool_size, 1024*1024);
1958
if (innobase_buffer_pool_size < 5*1024*1024)
1960
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer-pool-size\n"));
1966
if (vm.count("commit-concurrency"))
1968
if (srv_replication_delay > 1000)
1970
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for commit-concurrency\n"));
1975
if (vm.count("concurrency-tickets"))
1977
if (srv_n_free_tickets_to_enter < 1)
1979
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for concurrency-tickets\n"));
1984
if (vm.count("file-io-threads"))
1986
if (innobase_file_io_threads < 4 || innobase_file_io_threads > 64)
1988
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for file-io-threads\n"));
1993
if (vm.count("read-io-threads"))
1995
if (innobase_read_io_threads < 1 || innobase_read_io_threads > 64)
1997
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-io-threads\n"));
2002
if (vm.count("write-io-threads"))
2004
if (innobase_write_io_threads < 1 || innobase_write_io_threads > 64)
2006
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write-io-threads\n"));
2011
if (vm.count("force-recovery"))
2013
if (innobase_force_recovery > 6)
2015
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for force-recovery\n"));
2020
if (vm.count("log-buffer-size"))
2022
align_value(innobase_log_buffer_size);
2023
if (innobase_log_buffer_size < 256*1024L)
2025
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
2030
if (vm.count("log-file-size"))
2032
align_value(innobase_log_file_size, 1024*1024);
2033
if (innobase_log_file_size < 1*1024*1024L)
2035
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
2040
if (vm.count("log-files-in-group"))
2042
if (innobase_log_files_in_group < 2 || innobase_log_files_in_group > 100)
2044
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-files-in-group\n"));
2049
if (vm.count("mirrored-log-groups"))
2051
if (innobase_mirrored_log_groups < 1 || innobase_mirrored_log_groups > 10)
2053
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for mirrored-log-groups\n"));
2058
if (vm.count("open-files"))
2060
if (innobase_open_files < 10)
2062
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for open-files\n"));
2067
if (vm.count("thread-concurrency"))
2069
if (srv_thread_concurrency > 1000)
2071
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for thread-concurrency\n"));
2076
if (vm.count("data-file-path"))
2078
innobase_data_file_path= const_cast<char *>(vm["data-file-path"].as<string>().c_str());
2082
innobase_data_file_path= NULL;
2085
if (vm.count("version"))
2087
innodb_version_str= const_cast<char *>(vm["version"].as<string>().c_str());
2090
if (vm.count("read-ahead-threshold"))
2092
if (srv_read_ahead_threshold > 64)
2094
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-ahead-threshold\n"));
2099
if (vm.count("support-xa"))
2101
(SessionVAR(NULL,support_xa))= vm["support-xa"].as<bool>();
2104
if (vm.count("table-locks"))
2106
(SessionVAR(NULL,table_locks))= vm["table-locks"].as<bool>();
2109
if (vm.count("strict-mode"))
2111
(SessionVAR(NULL,strict_mode))= vm["strict-mode"].as<bool>();
2114
if (vm.count("lock-wait-timeout"))
2116
if (vm["lock-wait-timeout"].as<unsigned long>() < 1 || vm["lock-wait-timeout"].as<unsigned long>() > 1024*1024*1024)
2118
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for lock-wait-timeout\n"));
2122
(SessionVAR(NULL,lock_wait_timeout))= vm["lock-wait-timeout"].as<unsigned long>();
1834
2125
innodb_engine_ptr= actuall_engine_ptr= new InnobaseEngine(innobase_engine_name);
8582
8876
"trigger a readahead.",
8583
8877
NULL, NULL, 56, 0, 64, 0);
8879
static void init_options(drizzled::module::option_context &context)
8881
context("checksums",
8882
po::value<bool>(&innobase_use_checksums)->default_value(true)->zero_tokens(),
8883
"Enable InnoDB checksums validation.");
8884
context("data-home-dir",
8885
po::value<string>(),
8886
"The common part for InnoDB table spaces.");
8887
context("doublewrite",
8888
po::value<bool>(&innobase_use_doublewrite)->default_value(true)->zero_tokens(),
8889
"Enable InnoDB doublewrite buffer.");
8890
context("io-capacity",
8891
po::value<unsigned long>(&srv_io_capacity)->default_value(200),
8892
"Number of IOPs the server can do. Tunes the background IO rate");
8893
context("fast-shutdown",
8894
po::value<unsigned long>(&innobase_fast_shutdown)->default_value(1),
8895
"Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).");
8896
context("file-per-table",
8897
po::value<bool>(&srv_file_per_table)->default_value(false)->zero_tokens(),
8898
"Stores each InnoDB table to an .ibd file in the database dir.");
8899
context("file-format",
8900
po::value<string>()->default_value("Antelope"),
8901
"File format to use for new tables in .ibd files.");
8902
context("file-format-check",
8903
po::value<string>()->default_value("on"),
8904
"The highest file format in the tablespace.");
8905
context("flush-log-at-trx-commit",
8906
po::value<unsigned long>(&srv_flush_log_at_trx_commit)->default_value(1),
8907
"Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).");
8908
context("flush-method",
8909
po::value<string>(),
8910
"With which method to flush data.");
8911
#ifdef UNIV_LOG_ARCHIVE
8912
context("log-arch-dir",
8913
po::value<string>(),
8914
"Where full logs should be archived.");
8915
context("log-archive",
8916
po::value<bool>(&innobase_log_archive)->default_value(false)->zero_tokens(),
8917
"Set to 1 if you want to have logs archived.");
8918
#endif /* UNIV_LOG_ARCHIVE */
8919
context("log-group-home-dir",
8920
po::value<string>(),
8921
"Path to InnoDB log files.");
8922
context("max-dirty-pages-pct",
8923
po::value<unsigned long>(&srv_max_buf_pool_modified_pct)->default_value(75),
8924
"Percentage of dirty pages allowed in bufferpool.");
8925
context("adaptive-flushing",
8926
po::value<bool>(&srv_adaptive_flushing)->default_value(true)->zero_tokens(),
8927
"Attempt flushing dirty pages to avoid IO bursts at checkpoints.");
8928
context("max-purge-lag",
8929
po::value<unsigned long>(&srv_max_purge_lag)->default_value(0),
8930
"Desired maximum length of the purge queue (0 = no limit)");
8931
context("status-file",
8932
po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
8933
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file");
8934
context("stats-on-metadata",
8935
po::value<bool>(&innobase_stats_on_metadata)->default_value(true)->zero_tokens(),
8936
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)");
8937
context("stats-sample-pages",
8938
po::value<uint64_t>(&srv_stats_sample_pages)->default_value(8),
8939
"The number of index pages to sample when calculating statistics (default 8)");
8940
context("adaptive-hash-index",
8941
po::value<bool>(&btr_search_enabled)->default_value(true)->zero_tokens(),
8942
"Enable InnoDB adaptive hash index (enabled by default)");
8943
context("replication-delay",
8944
po::value<unsigned long>(&srv_replication_delay)->default_value(0),
8945
"Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
8946
context("additional-mem-pool-size",
8947
po::value<long>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
8948
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
8949
context("autoextend-increment",
8950
po::value<uint32_t>(&srv_auto_extend_increment)->default_value(8L),
8951
"Data file autoextend increment in megabytes");
8952
context("buffer-pool-size",
8953
po::value<int64_t>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
8954
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
8955
context("commit-concurrency",
8956
po::value<unsigned long>(&innobase_commit_concurrency)->default_value(0),
8957
"Helps in performance tuning in heavily concurrent environments.");
8958
context("concurrency-tickets",
8959
po::value<unsigned long>(&srv_n_free_tickets_to_enter)->default_value(500L),
8960
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket");
8961
context("file-io-threads",
8962
po::value<long>(&innobase_file_io_threads)->default_value(4),
8963
"Number of file I/O threads in InnoDB.");
8964
context("read-io-threads",
8965
po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
8966
"Number of background read I/O threads in InnoDB.");
8967
context("write-io-threads",
8968
po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
8969
"Number of background write I/O threads in InnoDB.");
8970
context("force-recovery",
8971
po::value<long>(&innobase_force_recovery)->default_value(0),
8972
"Helps to save your data in case the disk image of the database becomes corrupt.");
8973
context("log-buffer-size",
8974
po::value<long>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
8975
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
8976
context("log-file-size",
8977
po::value<int64_t>(&innobase_log_file_size)->default_value(20*1024*1024L),
8978
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
8979
context("log-files-in-group",
8980
po::value<long>(&innobase_log_files_in_group)->default_value(2),
8981
"Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
8982
context("mirrored-log-groups",
8983
po::value<long>(&innobase_mirrored_log_groups)->default_value(1),
8984
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.");
8985
context("open-files",
8986
po::value<long>(&innobase_open_files)->default_value(300L),
8987
"How many files at the maximum InnoDB keeps open at the same time.");
8988
context("sync-spin-loops",
8989
po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
8990
"Count of spin-loop rounds in InnoDB mutexes (30 by default)");
8991
context("spin-wait-delay",
8992
po::value<unsigned long>(&srv_spin_wait_delay)->default_value(6L),
8993
"Maximum delay between polling for a spin lock (6 by default)");
8994
context("thread-concurrency",
8995
po::value<unsigned long>(&srv_thread_concurrency)->default_value(0),
8996
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.");
8997
context("thread-sleep-delay",
8998
po::value<unsigned long>(&srv_thread_sleep_delay)->default_value(10000L),
8999
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep");
9000
context("data-file-path",
9001
po::value<string>(),
9002
"Path to individual files and their sizes.");
9004
po::value<string>()->default_value(INNODB_VERSION_STR),
9006
context("use-sys-malloc",
9007
po::value<bool>(&srv_use_sys_malloc)->default_value(true)->zero_tokens(),
9008
"Use OS memory allocator instead of InnoDB's internal memory allocator");
9009
context("change-buffering",
9010
po::value<string>(),
9011
"Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9012
context("read-ahead-threshold",
9013
po::value<unsigned long>(&srv_read_ahead_threshold)->default_value(56),
9014
"Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9015
context("support-xa",
9016
po::value<bool>()->default_value(true)->zero_tokens(),
9017
"Enable InnoDB support for the XA two-phase commit");
9018
context("table-locks",
9019
po::value<bool>()->default_value(true)->zero_tokens(),
9020
"Enable InnoDB locking in LOCK TABLES");
9021
context("strict-mode",
9022
po::value<bool>()->default_value(false)->zero_tokens(),
9023
"Use strict mode when evaluating create options.");
9024
context("lock-wait-timeout",
9025
po::value<unsigned long>()->default_value(50),
9026
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.");
8585
9029
static drizzle_sys_var* innobase_system_variables[]= {
8586
9030
DRIZZLE_SYSVAR(additional_mem_pool_size),
8587
9031
DRIZZLE_SYSVAR(autoextend_increment),