170
162
static plugin::TableFunction* innodb_trx_tool= NULL;
171
163
static plugin::TableFunction* innodb_locks_tool= NULL;
172
164
static plugin::TableFunction* innodb_lock_waits_tool= NULL;
173
static plugin::TableFunction* innodb_sys_tables_tool= NULL;
174
static plugin::TableFunction* innodb_sys_tablestats_tool= NULL;
176
static plugin::TableFunction* innodb_sys_indexes_tool= NULL;
177
static plugin::TableFunction* innodb_sys_columns_tool= NULL;
178
static plugin::TableFunction* innodb_sys_fields_tool= NULL;
179
static plugin::TableFunction* innodb_sys_foreign_tool= NULL;
180
static plugin::TableFunction* innodb_sys_foreign_cols_tool= NULL;
182
static ReplicationLog *replication_logger= NULL;
183
typedef constrained_check<uint32_t, UINT32_MAX, 10> open_files_constraint;
184
static open_files_constraint innobase_open_files;
185
typedef constrained_check<uint32_t, 10, 1> mirrored_log_groups_constraint;
186
static mirrored_log_groups_constraint innobase_mirrored_log_groups;
187
typedef constrained_check<uint32_t, 100, 2> log_files_in_group_constraint;
188
static log_files_in_group_constraint innobase_log_files_in_group;
189
typedef constrained_check<uint32_t, 6, 0> force_recovery_constraint;
190
force_recovery_constraint innobase_force_recovery;
191
typedef constrained_check<size_t, SIZE_MAX, 256*1024, 1024> log_buffer_constraint;
192
static log_buffer_constraint innobase_log_buffer_size;
193
typedef constrained_check<size_t, SIZE_MAX, 512*1024, 1024> additional_mem_pool_constraint;
194
static additional_mem_pool_constraint innobase_additional_mem_pool_size;
195
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
196
static autoextend_constraint innodb_auto_extend_increment;
197
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
198
static buffer_pool_constraint innobase_buffer_pool_size;
199
typedef constrained_check<uint32_t, MAX_BUFFER_POOLS, 1> buffer_pool_instances_constraint;
200
static buffer_pool_instances_constraint innobase_buffer_pool_instances;
201
typedef constrained_check<uint32_t, UINT32_MAX, 100> io_capacity_constraint;
202
static io_capacity_constraint innodb_io_capacity;
203
typedef constrained_check<uint32_t, 5000, 1> purge_batch_constraint;
204
static purge_batch_constraint innodb_purge_batch_size;
205
typedef constrained_check<uint32_t, 1, 0> purge_threads_constraint;
206
static purge_threads_constraint innodb_n_purge_threads;
207
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
208
static trinary_constraint innodb_flush_log_at_trx_commit;
209
typedef constrained_check<unsigned int, 99, 0> max_dirty_pages_constraint;
210
static max_dirty_pages_constraint innodb_max_dirty_pages_pct;
211
static uint64_constraint innodb_max_purge_lag;
212
static uint64_nonzero_constraint innodb_stats_sample_pages;
213
typedef constrained_check<uint32_t, 64, 1> io_threads_constraint;
214
static io_threads_constraint innobase_read_io_threads;
215
static io_threads_constraint innobase_write_io_threads;
217
typedef constrained_check<uint32_t, 1000, 0> concurrency_constraint;
218
static concurrency_constraint innobase_commit_concurrency;
219
static concurrency_constraint innobase_thread_concurrency;
220
static uint32_nonzero_constraint innodb_concurrency_tickets;
222
typedef constrained_check<int64_t, INT64_MAX, 1024*1024, 1024*1024> log_file_constraint;
223
static log_file_constraint innobase_log_file_size;
225
static uint64_constraint innodb_replication_delay;
166
static long innobase_mirrored_log_groups, innobase_log_files_in_group,
167
innobase_log_buffer_size,
168
innobase_force_recovery, innobase_open_files;
169
static long innobase_additional_mem_pool_size= 8*1024*1024L;
170
static ulong innobase_commit_concurrency = 0;
171
static ulong innobase_read_io_threads;
172
static ulong innobase_write_io_threads;
175
* @TODO: Turn this into size_t as soon as we have a Variable<size_t>
177
static int64_t innobase_buffer_pool_size= 128*1024*1024;
178
static int64_t innobase_log_file_size;
227
180
/** Percentage of the buffer pool to reserve for 'old' blocks.
228
181
Connected to buf_LRU_old_ratio. */
229
typedef constrained_check<uint32_t, 95, 5> old_blocks_constraint;
230
static old_blocks_constraint innobase_old_blocks_pct;
232
static uint32_constraint innodb_sync_spin_loops;
233
static uint32_constraint innodb_spin_wait_delay;
234
static uint32_constraint innodb_thread_sleep_delay;
236
typedef constrained_check<uint32_t, 64, 0> read_ahead_threshold_constraint;
237
static read_ahead_threshold_constraint innodb_read_ahead_threshold;
182
static uint innobase_old_blocks_pct;
239
184
/* The default values for the following char* start-up parameters
240
185
are determined in innobase_init below: */
242
std::string innobase_data_home_dir;
243
std::string innobase_data_file_path;
244
std::string innobase_log_group_home_dir;
245
static string innobase_file_format_name;
246
static string innobase_change_buffering;
248
/* The highest file format being used in the database. The value can be
249
set by user, however, it will be adjusted to the newer file format if
250
a table of such format is created/opened. */
251
static string innobase_file_format_max;
187
static char* innobase_data_home_dir = NULL;
188
static char* innobase_data_file_path = NULL;
189
static char* innobase_log_group_home_dir = NULL;
190
static char* innobase_file_format_name = NULL;
191
static char* innobase_change_buffering = NULL;
193
/* Note: This variable can be set to on/off and any of the supported
194
file formats in the configuration file, but can only be set to any
195
of the supported file formats during runtime. */
196
static char* innobase_file_format_check = NULL;
198
static char* innobase_file_flush_method = NULL;
253
200
/* Below we have boolean-valued start-up parameters, and their default
256
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
257
static trinary_constraint innobase_fast_shutdown;
259
/* "innobase_file_format_check" decides whether we would continue
260
booting the server if the file format stamped on the system
261
table space exceeds the maximum file format supported
262
by the server. Can be set during server startup at command
263
line or configure file, and a read only variable after
266
/* If a new file format is introduced, the file format
267
name needs to be updated accordingly. Please refer to
268
file_format_name_map[] defined in trx0sys.c for the next
271
static my_bool innobase_file_format_check = TRUE;
203
static ulong innobase_fast_shutdown = 1;
204
#ifdef UNIV_LOG_ARCHIVE
205
static my_bool innobase_log_archive = FALSE;
206
static char* innobase_log_arch_dir = NULL;
207
#endif /* UNIV_LOG_ARCHIVE */
272
208
static my_bool innobase_use_doublewrite = TRUE;
273
209
static my_bool innobase_use_checksums = TRUE;
274
210
static my_bool innobase_rollback_on_timeout = FALSE;
275
211
static my_bool innobase_create_status_file = FALSE;
276
static bool innobase_use_replication_log;
277
static bool support_xa;
278
static bool strict_mode;
279
typedef constrained_check<uint32_t, 1024*1024*1024, 1> lock_wait_constraint;
280
static lock_wait_constraint lock_wait_timeout;
282
213
static char* internal_innobase_data_file_path = NULL;
215
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
284
217
/* The following counter is used to convey information to InnoDB
285
218
about server activity: in selects it is not sensible to call
286
219
srv_active_wake_master_thread after each fetch or search, we only do
1841
1783
value= value - (value % align_val);
1844
static void auto_extend_update(Session *, sql_var_t)
1846
srv_auto_extend_increment= innodb_auto_extend_increment.get();
1849
static void io_capacity_update(Session *, sql_var_t)
1851
srv_io_capacity= innodb_io_capacity.get();
1854
static void purge_batch_update(Session *, sql_var_t)
1856
srv_purge_batch_size= innodb_purge_batch_size.get();
1859
static void purge_threads_update(Session *, sql_var_t)
1861
srv_n_purge_threads= innodb_n_purge_threads.get();
1864
static void innodb_adaptive_hash_index_update(Session *, sql_var_t)
1866
if (btr_search_enabled)
1868
btr_search_enable();
1870
btr_search_disable();
1874
static void innodb_old_blocks_pct_update(Session *, sql_var_t)
1876
innobase_old_blocks_pct= buf_LRU_old_ratio_update(innobase_old_blocks_pct.get(), TRUE);
1879
static void innodb_thread_concurrency_update(Session *, sql_var_t)
1881
srv_thread_concurrency= innobase_thread_concurrency.get();
1884
static void innodb_sync_spin_loops_update(Session *, sql_var_t)
1886
srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
1889
static void innodb_spin_wait_delay_update(Session *, sql_var_t)
1891
srv_spin_wait_delay= innodb_spin_wait_delay.get();
1894
static void innodb_thread_sleep_delay_update(Session *, sql_var_t)
1896
srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
1899
static void innodb_read_ahead_threshold_update(Session *, sql_var_t)
1901
srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
1905
static int innodb_commit_concurrency_validate(Session *session, set_var *var)
1907
uint32_t new_value= var->save_result.uint32_t_value;
1909
if ((innobase_commit_concurrency.get() == 0 && new_value != 0) ||
1910
(innobase_commit_concurrency.get() != 0 && new_value == 0))
1912
push_warning_printf(session,
1913
DRIZZLE_ERROR::WARN_LEVEL_WARN,
1915
_("Once InnoDB is running, innodb_commit_concurrency "
1916
"must not change between zero and nonzero."));
1922
/*************************************************************//**
1923
Check if it is a valid file format. This function is registered as
1924
a callback with MySQL.
1925
@return 0 for valid file format */
1928
innodb_file_format_name_validate(
1929
/*=============================*/
1930
Session* , /*!< in: thread handle */
1933
const char *file_format_input = var->value->str_value.ptr();
1934
if (file_format_input == NULL)
1937
if (file_format_input != NULL) {
1940
format_id = innobase_file_format_name_lookup(
1943
if (format_id <= DICT_TF_FORMAT_MAX) {
1944
innobase_file_format_name =
1945
trx_sys_file_format_id_to_name(format_id);
1954
/*************************************************************//**
1955
Check if it is a valid value of innodb_change_buffering. This function is
1956
registered as a callback with MySQL.
1957
@return 0 for valid innodb_change_buffering */
1960
innodb_change_buffering_validate(
1961
/*=============================*/
1962
Session* , /*!< in: thread handle */
1965
const char *change_buffering_input = var->value->str_value.ptr();
1967
if (change_buffering_input == NULL)
1973
use < UT_ARR_SIZE(innobase_change_buffering_values);
1975
if (!innobase_strcasecmp(change_buffering_input,
1976
innobase_change_buffering_values[use]))
1978
ibuf_use= static_cast<ibuf_use_t>(use);
1987
/*************************************************************//**
1988
Check if valid argument to innodb_file_format_max. This function
1989
is registered as a callback with MySQL.
1990
@return 0 for valid file format */
1993
innodb_file_format_max_validate(
1994
/*==============================*/
1995
Session* session, /*!< in: thread handle */
1998
const char *file_format_input = var->value->str_value.ptr();
1999
if (file_format_input == NULL)
2002
if (file_format_input != NULL) {
2003
int format_id = innobase_file_format_validate_and_set(file_format_input);
2005
if (format_id > DICT_TF_FORMAT_MAX) {
2006
/* DEFAULT is "on", which is invalid at runtime. */
2010
if (format_id >= 0) {
2011
innobase_file_format_max=
2012
trx_sys_file_format_id_to_name((uint)format_id);
2014
/* Update the max format id in the system tablespace. */
2015
char name_buff[100];
2016
strcpy(name_buff, innobase_file_format_max.c_str());
2017
if (trx_sys_file_format_max_set(format_id, (const char **)&name_buff))
2019
errmsg_printf(ERRMSG_LVL_WARN,
2020
" [Info] InnoDB: the file format in the system "
2021
"tablespace is now set to %s.\n", name_buff);
2022
innobase_file_format_max= name_buff;
2027
push_warning_printf(session,
2028
DRIZZLE_ERROR::WARN_LEVEL_WARN,
2030
"InnoDB: invalid innodb_file_format_max "
2031
"value; can be any format up to %s "
2032
"or equivalent id of %d",
2033
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
2034
DICT_TF_FORMAT_MAX);
2042
1786
/*********************************************************************//**
2043
1787
Opens an InnoDB database.
2044
1788
@return 0 on success, error code on failure */
2054
1798
InnobaseEngine *actuall_engine_ptr;
2055
1799
const module::option_map &vm= context.getOptions();
2057
srv_auto_extend_increment= innodb_auto_extend_increment.get();
2058
srv_io_capacity= innodb_io_capacity.get();
2059
srv_purge_batch_size= innodb_purge_batch_size.get();
2060
srv_n_purge_threads= innodb_n_purge_threads.get();
2061
srv_flush_log_at_trx_commit= innodb_flush_log_at_trx_commit.get();
2062
srv_max_buf_pool_modified_pct= innodb_max_dirty_pages_pct.get();
2063
srv_max_purge_lag= innodb_max_purge_lag.get();
2064
srv_stats_sample_pages= innodb_stats_sample_pages.get();
2065
srv_n_free_tickets_to_enter= innodb_concurrency_tickets.get();
2066
srv_replication_delay= innodb_replication_delay.get();
2067
srv_thread_concurrency= innobase_thread_concurrency.get();
2068
srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
2069
srv_spin_wait_delay= innodb_spin_wait_delay.get();
2070
srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
2071
srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
2073
1801
/* Inverted Booleans */
2075
1803
innobase_use_checksums= (vm.count("disable-checksums")) ? false : true;
2076
1804
innobase_use_doublewrite= (vm.count("disable-doublewrite")) ? false : true;
2077
1805
srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
2078
1806
srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
2079
support_xa= (vm.count("disable-xa")) ? false : true;
2080
btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? false : true;
2083
/* Hafta do this here because we need to late-bind the default value */
1807
(SessionVAR(NULL,support_xa))= (vm.count("disable-xa")) ? false : true;
1808
(SessionVAR(NULL,table_locks))= (vm.count("disable-table-locks")) ? false : true;
1810
if (vm.count("io-capacity"))
1812
if (srv_io_capacity < 100)
1814
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for io-capacity\n"));
2084
1819
if (vm.count("data-home-dir"))
2086
innobase_data_home_dir= vm["data-home-dir"].as<string>();
2090
innobase_data_home_dir= getDataHome().file_string();
1821
innobase_data_home_dir= strdup(vm["data-home-dir"].as<string>().c_str());
1825
innobase_data_home_dir= strdup(getDataHome().file_string().c_str());
1828
if (vm.count("fast-shutdown"))
1830
if (innobase_fast_shutdown > 2)
1832
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for fast-shutdown\n"));
1837
if (vm.count("file-format-check"))
1839
innobase_file_format_check= const_cast<char *>(vm["file-format-check"].as<string>().c_str());
1842
if (vm.count("flush-log-at-trx-commit"))
1844
if (srv_flush_log_at_trx_commit > 2)
1846
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for flush-log-at-trx-commit\n"));
1851
if (vm.count("flush-method"))
1853
innobase_file_flush_method= const_cast<char *>(vm["flush-method"].as<string>().c_str());
1857
innobase_file_flush_method= NULL;
1860
#ifdef UNIV_LOG_ARCHIVE
1861
if (vm.count("log-arch-dir"))
1863
innobase_log_arch_dir= const_cast<char *>(vm["log-arch-dir"].as<string>().c_str());
1868
innobase_log_arch_dir= NULL;
1870
#endif /* UNIV_LOG_ARCHIVE */
1872
if (vm.count("max-dirty-pages-pct"))
1874
if (srv_max_buf_pool_modified_pct > 99)
1876
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for max-dirty-pages-pct\n"));
1881
if (vm.count("stats-sample-pages"))
1883
if (srv_stats_sample_pages < 8)
1885
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for stats-sample-pages\n"));
1890
if (vm.count("additional-mem-pool-size"))
1892
align_value(innobase_additional_mem_pool_size);
1894
if (innobase_additional_mem_pool_size < 512*1024L)
1896
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for additional-mem-pool-size\n"));
1902
if (vm.count("autoextend-increment"))
1904
if (srv_auto_extend_increment < 1 || srv_auto_extend_increment > 1000)
1906
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for autoextend-increment\n"));
1911
if (vm.count("buffer-pool-size"))
1913
align_value(innobase_buffer_pool_size, 1024*1024);
1914
if (innobase_buffer_pool_size < 5*1024*1024)
1916
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer-pool-size\n"));
1922
if (vm.count("commit-concurrency"))
1924
if (srv_replication_delay > 1000)
1926
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for commit-concurrency\n"));
1931
if (vm.count("concurrency-tickets"))
1933
if (srv_n_free_tickets_to_enter < 1)
1935
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for concurrency-tickets\n"));
1940
if (vm.count("read-io-threads"))
1942
if (innobase_read_io_threads < 1 || innobase_read_io_threads > 64)
1944
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-io-threads\n"));
1949
if (vm.count("write-io-threads"))
1951
if (innobase_write_io_threads < 1 || innobase_write_io_threads > 64)
1953
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write-io-threads\n"));
1958
if (vm.count("force-recovery"))
1960
if (innobase_force_recovery > 6)
1962
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for force-recovery\n"));
1967
if (vm.count("log-buffer-size"))
1969
align_value(innobase_log_buffer_size);
1970
if (innobase_log_buffer_size < 256*1024L)
1972
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
1977
if (vm.count("log-file-size"))
1979
align_value(innobase_log_file_size, 1024*1024);
1980
if (innobase_log_file_size < 1*1024*1024L)
1982
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
1987
if (vm.count("log-files-in-group"))
1989
if (innobase_log_files_in_group < 2 || innobase_log_files_in_group > 100)
1991
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-files-in-group\n"));
1996
if (vm.count("mirrored-log-groups"))
1998
if (innobase_mirrored_log_groups < 1 || innobase_mirrored_log_groups > 10)
2000
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for mirrored-log-groups\n"));
2005
if (vm.count("open-files"))
2007
if (innobase_open_files < 10)
2009
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for open-files\n"));
2014
if (vm.count("thread-concurrency"))
2016
if (srv_thread_concurrency > 1000)
2018
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for thread-concurrency\n"));
2094
2023
if (vm.count("data-file-path"))
2096
innobase_data_file_path= vm["data-file-path"].as<string>();
2025
innobase_data_file_path= const_cast<char *>(vm["data-file-path"].as<string>().c_str());
2029
innobase_data_file_path= NULL;
2032
if (vm.count("version"))
2034
innodb_version_str= const_cast<char *>(vm["version"].as<string>().c_str());
2037
if (vm.count("read-ahead-threshold"))
2039
if (srv_read_ahead_threshold > 64)
2041
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-ahead-threshold\n"));
2046
if (vm.count("strict-mode"))
2048
(SessionVAR(NULL,strict_mode))= vm["strict-mode"].as<bool>();
2051
if (vm.count("lock-wait-timeout"))
2053
if (vm["lock-wait-timeout"].as<unsigned long>() < 1 || vm["lock-wait-timeout"].as<unsigned long>() > 1024*1024*1024)
2055
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for lock-wait-timeout\n"));
2059
(SessionVAR(NULL,lock_wait_timeout))= vm["lock-wait-timeout"].as<unsigned long>();
2100
2062
innodb_engine_ptr= actuall_engine_ptr= new InnobaseEngine(innobase_engine_name);
2358
2347
innodb_lock_waits_tool= new(std::nothrow)InnodbTrxTool("INNODB_LOCK_WAITS");
2359
2348
context.add(innodb_lock_waits_tool);
2361
innodb_sys_tables_tool= new(std::nothrow)InnodbSysTablesTool();
2362
context.add(innodb_sys_tables_tool);
2364
innodb_sys_tablestats_tool= new(std::nothrow)InnodbSysTableStatsTool();
2365
context.add(innodb_sys_tablestats_tool);
2367
innodb_sys_indexes_tool= new(std::nothrow)InnodbSysIndexesTool();
2368
context.add(innodb_sys_indexes_tool);
2370
innodb_sys_columns_tool= new(std::nothrow)InnodbSysColumnsTool();
2371
context.add(innodb_sys_columns_tool);
2373
innodb_sys_fields_tool= new(std::nothrow)InnodbSysFieldsTool();
2374
context.add(innodb_sys_fields_tool);
2376
innodb_sys_foreign_tool= new(std::nothrow)InnodbSysForeignTool();
2377
context.add(innodb_sys_foreign_tool);
2379
innodb_sys_foreign_cols_tool= new(std::nothrow)InnodbSysForeignColsTool();
2380
context.add(innodb_sys_foreign_cols_tool);
2382
2350
context.add(new(std::nothrow)InnodbInternalTables());
2383
context.add(new(std::nothrow)InnodbReplicationTable());
2385
if (innobase_use_replication_log)
2387
replication_logger= new(std::nothrow)ReplicationLog();
2388
context.add(replication_logger);
2389
ReplicationLog::setup(replication_logger);
2392
context.registerVariable(new sys_var_const_string_val("data-home-dir", innobase_data_home_dir));
2393
context.registerVariable(new sys_var_const_string_val("flush-method",
2394
vm.count("flush-method") ? vm["flush-method"].as<string>() : ""));
2395
context.registerVariable(new sys_var_const_string_val("log-group-home-dir", innobase_log_group_home_dir));
2396
context.registerVariable(new sys_var_const_string_val("data-file-path", innobase_data_file_path));
2397
context.registerVariable(new sys_var_const_string_val("version", vm["version"].as<string>()));
2400
context.registerVariable(new sys_var_bool_ptr_readonly("replication_log", &innobase_use_replication_log));
2401
context.registerVariable(new sys_var_bool_ptr_readonly("checksums", &innobase_use_checksums));
2402
context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite", &innobase_use_doublewrite));
2403
context.registerVariable(new sys_var_bool_ptr("file-per-table", &srv_file_per_table));
2404
context.registerVariable(new sys_var_bool_ptr_readonly("file-format-check", &innobase_file_format_check));
2405
context.registerVariable(new sys_var_bool_ptr("adaptive-flushing", &srv_adaptive_flushing));
2406
context.registerVariable(new sys_var_bool_ptr("status-file", &innobase_create_status_file));
2407
context.registerVariable(new sys_var_bool_ptr_readonly("use-sys-malloc", &srv_use_sys_malloc));
2408
context.registerVariable(new sys_var_bool_ptr_readonly("use-native-aio", &srv_use_native_aio));
2410
context.registerVariable(new sys_var_bool_ptr("support-xa", &support_xa));
2411
context.registerVariable(new sys_var_bool_ptr("strict_mode", &strict_mode));
2412
context.registerVariable(new sys_var_constrained_value<uint32_t>("lock_wait_timeout", lock_wait_timeout));
2414
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("additional_mem_pool_size",innobase_additional_mem_pool_size));
2415
context.registerVariable(new sys_var_constrained_value<uint32_t>("autoextend_increment",
2416
innodb_auto_extend_increment,
2417
auto_extend_update));
2418
context.registerVariable(new sys_var_constrained_value<uint32_t>("io_capacity",
2420
io_capacity_update));
2421
context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_batch_size",
2422
innodb_purge_batch_size,
2423
purge_batch_update));
2424
context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_threads",
2425
innodb_n_purge_threads,
2426
purge_threads_update));
2427
context.registerVariable(new sys_var_constrained_value<uint16_t>("fast_shutdown", innobase_fast_shutdown));
2428
context.registerVariable(new sys_var_std_string("file_format",
2429
innobase_file_format_name,
2430
innodb_file_format_name_validate));
2431
context.registerVariable(new sys_var_std_string("change_buffering",
2432
innobase_change_buffering,
2433
innodb_change_buffering_validate));
2434
context.registerVariable(new sys_var_std_string("file_format_max",
2435
innobase_file_format_max,
2436
innodb_file_format_max_validate));
2437
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
2438
context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
2439
context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("flush_log_at_trx_commit",
2440
innodb_flush_log_at_trx_commit));
2441
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
2442
innodb_max_dirty_pages_pct));
2443
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", innodb_max_purge_lag));
2444
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("stats_sample_pages", innodb_stats_sample_pages));
2445
context.registerVariable(new sys_var_bool_ptr("adaptive_hash_index", &btr_search_enabled, innodb_adaptive_hash_index_update));
2447
context.registerVariable(new sys_var_constrained_value<uint32_t>("commit_concurrency",
2448
innobase_commit_concurrency,
2449
innodb_commit_concurrency_validate));
2450
context.registerVariable(new sys_var_constrained_value<uint32_t>("concurrency_tickets",
2451
innodb_concurrency_tickets));
2452
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("read_io_threads", innobase_read_io_threads));
2453
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("write_io_threads", innobase_write_io_threads));
2454
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("replication_delay", innodb_replication_delay));
2455
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("force_recovery", innobase_force_recovery));
2456
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("log_buffer_size", innobase_log_buffer_size));
2457
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("log_files_in_group", innobase_log_files_in_group));
2458
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("mirrored_log_groups", innobase_mirrored_log_groups));
2459
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("open_files", innobase_open_files));
2460
context.registerVariable(new sys_var_constrained_value<uint32_t>("old_blocks_pct",
2461
innobase_old_blocks_pct,
2462
innodb_old_blocks_pct_update));
2463
context.registerVariable(new sys_var_uint32_t_ptr("old_blocks_time", &buf_LRU_old_threshold_ms));
2464
context.registerVariable(new sys_var_constrained_value<uint32_t>("sync_spin_loops", innodb_sync_spin_loops, innodb_sync_spin_loops_update));
2465
context.registerVariable(new sys_var_constrained_value<uint32_t>("spin_wait_delay", innodb_spin_wait_delay, innodb_spin_wait_delay_update));
2466
context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_sleep_delay", innodb_thread_sleep_delay, innodb_thread_sleep_delay_update));
2467
context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_concurrency",
2468
innobase_thread_concurrency,
2469
innodb_thread_concurrency_update));
2470
context.registerVariable(new sys_var_constrained_value<uint32_t>("read_ahead_threshold",
2471
innodb_read_ahead_threshold,
2472
innodb_read_ahead_threshold_update));
2473
2352
/* Get the current high water mark format. */
2474
innobase_file_format_max = trx_sys_file_format_max_get();
2475
btr_search_fully_disabled = (!btr_search_enabled);
2353
innobase_file_format_check = (char*) trx_sys_file_format_max_get();
9187
8996
/************************************************************//**
8997
Validate the file format check value, is it one of "on" or "off",
8998
as a side effect it sets the srv_check_file_format_at_startup variable.
8999
@return true if config value one of "on" or "off" */
9002
innobase_file_format_check_on_off(
9003
/*==============================*/
9004
const char* format_check) /*!< in: parameter value */
9008
if (!innobase_strcasecmp(format_check, "off")) {
9010
/* Set the value to disable checking. */
9011
srv_check_file_format_at_startup = DICT_TF_FORMAT_MAX + 1;
9013
} else if (!innobase_strcasecmp(format_check, "on")) {
9015
/* Set the value to the lowest supported format. */
9016
srv_check_file_format_at_startup = DICT_TF_FORMAT_51;
9024
/************************************************************//**
9188
9025
Validate the file format check config parameters, as a side effect it
9189
sets the srv_max_file_format_at_startup variable.
9026
sets the srv_check_file_format_at_startup variable.
9190
9027
@return the format_id if valid config value, otherwise, return -1 */
9193
9030
innobase_file_format_validate_and_set(
9194
9031
/*================================*/
9195
const char* format_max) /*!< in: parameter value */
9032
const char* format_check) /*!< in: parameter value */
9197
9034
uint format_id;
9199
format_id = innobase_file_format_name_lookup(format_max);
9036
format_id = innobase_file_format_name_lookup(format_check);
9201
9038
if (format_id < DICT_TF_FORMAT_MAX + 1) {
9202
srv_max_file_format_at_startup = format_id;
9039
srv_check_file_format_at_startup = format_id;
9203
9040
return((int) format_id);
9046
/*************************************************************//**
9047
Check if it is a valid file format. This function is registered as
9048
a callback with MySQL.
9049
@return 0 for valid file format */
9052
innodb_file_format_name_validate(
9053
/*=============================*/
9054
Session* , /*!< in: thread handle */
9055
drizzle_sys_var* , /*!< in: pointer to system
9057
void* save, /*!< out: immediate result
9058
for update function */
9059
drizzle_value* value) /*!< in: incoming string */
9061
const char* file_format_input;
9062
char buff[STRING_BUFFER_USUAL_SIZE];
9063
int len = sizeof(buff);
9066
ut_a(value != NULL);
9068
file_format_input = value->val_str(value, buff, &len);
9070
if (file_format_input != NULL) {
9073
format_id = innobase_file_format_name_lookup(
9076
if (format_id <= DICT_TF_FORMAT_MAX) {
9077
/* Save a pointer to the name in the
9078
'file_format_name_map' constant array. */
9079
*static_cast<const char**>(save) =
9080
trx_sys_file_format_id_to_name(format_id);
9086
*static_cast<const char**>(save) = NULL;
9090
/****************************************************************//**
9091
Update the system variable innodb_file_format using the "saved"
9092
value. This function is registered as a callback with MySQL. */
9095
innodb_file_format_name_update(
9096
/*===========================*/
9097
Session* , /*!< in: thread handle */
9098
drizzle_sys_var* , /*!< in: pointer to
9100
void* var_ptr, /*!< out: where the
9101
formal string goes */
9102
const void* save) /*!< in: immediate result
9103
from check function */
9105
const char* format_name;
9107
ut_a(var_ptr != NULL);
9110
format_name = *static_cast<const char*const*>(save);
9115
format_id = innobase_file_format_name_lookup(format_name);
9117
if (format_id <= DICT_TF_FORMAT_MAX) {
9118
srv_file_format = format_id;
9122
*static_cast<const char**>(var_ptr)
9123
= trx_sys_file_format_id_to_name(srv_file_format);
9126
/*************************************************************//**
9127
Check if valid argument to innodb_file_format_check. This
9128
function is registered as a callback with MySQL.
9129
@return 0 for valid file format */
9132
innodb_file_format_check_validate(
9133
/*==============================*/
9134
Session* session, /*!< in: thread handle */
9135
drizzle_sys_var* , /*!< in: pointer to system
9137
void* save, /*!< out: immediate result
9138
for update function */
9139
drizzle_value* value) /*!< in: incoming string */
9141
const char* file_format_input;
9142
char buff[STRING_BUFFER_USUAL_SIZE];
9143
int len = sizeof(buff);
9147
ut_a(value != NULL);
9149
file_format_input = value->val_str(value, buff, &len);
9151
if (file_format_input != NULL) {
9153
/* Check if user set on/off, we want to print a suitable
9154
message if they did so. */
9156
if (innobase_file_format_check_on_off(file_format_input)) {
9157
push_warning_printf(session,
9158
DRIZZLE_ERROR::WARN_LEVEL_WARN,
9160
"InnoDB: invalid innodb_file_format_check "
9161
"value; on/off can only be set at startup or "
9162
"in the configuration file");
9164
format_id = innobase_file_format_validate_and_set(file_format_input);
9165
if (format_id >= 0) {
9166
/* Save a pointer to the name in the
9167
'file_format_name_map' constant array. */
9168
*static_cast<const char**>(save) =
9169
trx_sys_file_format_id_to_name(
9175
push_warning_printf(session,
9176
DRIZZLE_ERROR::WARN_LEVEL_WARN,
9178
"InnoDB: invalid innodb_file_format_check "
9179
"value; can be any format up to %s "
9180
"or its equivalent numeric id",
9181
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX));
9186
*static_cast<const char**>(save) = NULL;
9190
/****************************************************************//**
9191
Update the system variable innodb_file_format_check using the "saved"
9192
value. This function is registered as a callback with MySQL. */
9195
innodb_file_format_check_update(
9196
/*============================*/
9197
Session* session, /*!< in: thread handle */
9198
drizzle_sys_var* , /*!< in: pointer to
9200
void* var_ptr, /*!< out: where the
9201
formal string goes */
9202
const void* save) /*!< in: immediate result
9203
from check function */
9205
const char* format_name_in;
9206
const char** format_name_out;
9210
ut_a(var_ptr != NULL);
9212
format_name_in = *static_cast<const char*const*>(save);
9214
if (!format_name_in) {
9219
format_id = innobase_file_format_name_lookup(format_name_in);
9221
if (format_id > DICT_TF_FORMAT_MAX) {
9222
/* DEFAULT is "on", which is invalid at runtime. */
9223
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
9225
"Ignoring SET innodb_file_format=%s",
9230
format_name_out = static_cast<const char**>(var_ptr);
9232
/* Update the max format id in the system tablespace. */
9233
if (trx_sys_file_format_max_set(format_id, format_name_out)) {
9234
ut_print_timestamp(stderr);
9236
" [Info] InnoDB: the file format in the system "
9237
"tablespace is now set to %s.\n", *format_name_out);
9241
/****************************************************************//**
9242
Update the system variable innodb_adaptive_hash_index using the "saved"
9243
value. This function is registered as a callback with MySQL. */
9246
innodb_adaptive_hash_index_update(
9247
/*==============================*/
9248
Session* , /*!< in: thread handle */
9249
drizzle_sys_var* , /*!< in: pointer to
9251
void* , /*!< out: where the
9252
formal string goes */
9253
const void* save) /*!< in: immediate result
9254
from check function */
9256
if (*(bool*) save) {
9257
btr_search_enable();
9259
btr_search_disable();
9263
/****************************************************************//**
9264
Update the system variable innodb_old_blocks_pct using the "saved"
9265
value. This function is registered as a callback with MySQL. */
9268
innodb_old_blocks_pct_update(
9269
/*=========================*/
9270
Session* , /*!< in: thread handle */
9271
drizzle_sys_var* , /*!< in: pointer to
9273
void* ,/*!< out: where the
9274
formal string goes */
9275
const void* save) /*!< in: immediate result
9276
from check function */
9278
innobase_old_blocks_pct = buf_LRU_old_ratio_update(
9279
*static_cast<const uint*>(save), TRUE);
9282
/*************************************************************//**
9283
Check if it is a valid value of innodb_change_buffering. This function is
9284
registered as a callback with MySQL.
9285
@return 0 for valid innodb_change_buffering */
9288
innodb_change_buffering_validate(
9289
/*=============================*/
9290
Session* , /*!< in: thread handle */
9291
drizzle_sys_var* , /*!< in: pointer to system
9293
void* save, /*!< out: immediate result
9294
for update function */
9295
drizzle_value* value) /*!< in: incoming string */
9297
const char* change_buffering_input;
9298
char buff[STRING_BUFFER_USUAL_SIZE];
9299
int len = sizeof(buff);
9302
ut_a(value != NULL);
9304
change_buffering_input = value->val_str(value, buff, &len);
9306
if (change_buffering_input != NULL) {
9309
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
9311
if (!innobase_strcasecmp(
9312
change_buffering_input,
9313
innobase_change_buffering_values[use])) {
9314
*(ibuf_use_t*) save = (ibuf_use_t) use;
9323
/****************************************************************//**
9324
Update the system variable innodb_change_buffering using the "saved"
9325
value. This function is registered as a callback with MySQL. */
9328
innodb_change_buffering_update(
9329
/*===========================*/
9330
Session* , /*!< in: thread handle */
9331
drizzle_sys_var* , /*!< in: pointer to
9333
void* var_ptr, /*!< out: where the
9334
formal string goes */
9335
const void* save) /*!< in: immediate result
9336
from check function */
9338
ut_a(var_ptr != NULL);
9340
ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
9342
ibuf_use = *(const ibuf_use_t*) save;
9344
*(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
9347
/* plugin options */
9348
static DRIZZLE_SYSVAR_BOOL(checksums, innobase_use_checksums,
9349
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9350
"Enable InnoDB checksums validation (enabled by default). ",
9353
static DRIZZLE_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
9354
PLUGIN_VAR_READONLY,
9355
"The common part for InnoDB table spaces.",
9358
static DRIZZLE_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
9359
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9360
"Enable InnoDB doublewrite buffer (enabled by default). ",
9363
static DRIZZLE_SYSVAR_ULONG(io_capacity, srv_io_capacity,
9364
PLUGIN_VAR_RQCMDARG,
9365
"Number of IOPs the server can do. Tunes the background IO rate",
9366
NULL, NULL, 200, 100, ~0L, 0);
9368
static DRIZZLE_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
9369
PLUGIN_VAR_OPCMDARG,
9370
"Speeds up the shutdown process of the InnoDB storage engine. Possible "
9371
"values are 0, 1 (faster)"
9372
" or 2 (fastest - crash-like)"
9374
NULL, NULL, 1, 0, 2, 0);
9376
static DRIZZLE_SYSVAR_BOOL(file_per_table, srv_file_per_table,
9377
PLUGIN_VAR_NOCMDARG,
9378
"Stores each InnoDB table to an .ibd file in the database dir.",
9381
static DRIZZLE_SYSVAR_STR(file_format, innobase_file_format_name,
9382
PLUGIN_VAR_RQCMDARG,
9383
"File format to use for new tables in .ibd files.",
9384
innodb_file_format_name_validate,
9385
innodb_file_format_name_update, "Antelope");
9387
/* If a new file format is introduced, the file format
9388
name needs to be updated accordingly. Please refer to
9389
file_format_name_map[] defined in trx0sys.c for the next
9390
file format name. */
9391
static DRIZZLE_SYSVAR_STR(file_format_check, innobase_file_format_check,
9392
PLUGIN_VAR_OPCMDARG,
9393
"The highest file format in the tablespace.",
9394
innodb_file_format_check_validate,
9395
innodb_file_format_check_update,
9398
static DRIZZLE_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
9399
PLUGIN_VAR_OPCMDARG,
9400
"Set to 0 (write and flush once per second),"
9401
" 1 (write and flush at each commit)"
9402
" or 2 (write at commit, flush once per second).",
9403
NULL, NULL, 1, 0, 2, 0);
9405
static DRIZZLE_SYSVAR_STR(flush_method, innobase_file_flush_method,
9406
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9407
"With which method to flush data.", NULL, NULL, NULL);
9409
#ifdef UNIV_LOG_ARCHIVE
9410
static DRIZZLE_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
9411
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9412
"Where full logs should be archived.", NULL, NULL, NULL);
9414
static DRIZZLE_SYSVAR_BOOL(log_archive, innobase_log_archive,
9415
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
9416
"Set to 1 if you want to have logs archived.", NULL, NULL, FALSE);
9417
#endif /* UNIV_LOG_ARCHIVE */
9419
static DRIZZLE_SYSVAR_STR(log_group_home_dir, innobase_log_group_home_dir,
9420
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9421
"Path to InnoDB log files.", NULL, NULL, NULL);
9423
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
9424
PLUGIN_VAR_RQCMDARG,
9425
"Percentage of dirty pages allowed in bufferpool.",
9426
NULL, NULL, 75, 0, 99, 0);
9428
static DRIZZLE_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
9429
PLUGIN_VAR_NOCMDARG,
9430
"Attempt flushing dirty pages to avoid IO bursts at checkpoints.",
9433
static DRIZZLE_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
9434
PLUGIN_VAR_RQCMDARG,
9435
"Desired maximum length of the purge queue (0 = no limit)",
9436
NULL, NULL, 0, 0, ~0L, 0);
9438
static DRIZZLE_SYSVAR_BOOL(status_file, innobase_create_status_file,
9439
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_NOSYSVAR,
9440
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
9443
static DRIZZLE_SYSVAR_ULONGLONG(stats_sample_pages, srv_stats_sample_pages,
9444
PLUGIN_VAR_RQCMDARG,
9445
"The number of index pages to sample when calculating statistics (default 8)",
9446
NULL, NULL, 8, 1, ~0ULL, 0);
9448
static DRIZZLE_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
9449
PLUGIN_VAR_OPCMDARG,
9450
"Enable InnoDB adaptive hash index (enabled by default).",
9451
NULL, innodb_adaptive_hash_index_update, TRUE);
9453
static DRIZZLE_SYSVAR_ULONG(replication_delay, srv_replication_delay,
9454
PLUGIN_VAR_RQCMDARG,
9455
"Replication thread delay (ms) on the slave server if "
9456
"innodb_thread_concurrency is reached (0 by default)",
9457
NULL, NULL, 0, 0, ~0UL, 0);
9459
static DRIZZLE_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size,
9460
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9461
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
9462
NULL, NULL, 8*1024*1024L, 512*1024L, LONG_MAX, 1024);
9464
static DRIZZLE_SYSVAR_UINT(autoextend_increment, srv_auto_extend_increment,
9465
PLUGIN_VAR_RQCMDARG,
9466
"Data file autoextend increment in megabytes",
9467
NULL, NULL, 8L, 1L, 1000L, 0);
9469
static DRIZZLE_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
9470
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9471
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
9472
NULL, NULL, 128*1024*1024L, 5*1024*1024L, INT64_MAX, 1024*1024L);
9474
static DRIZZLE_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
9475
PLUGIN_VAR_RQCMDARG,
9476
"Helps in performance tuning in heavily concurrent environments.",
9477
innobase_commit_concurrency_validate, NULL, 0, 0, 1000, 0);
9479
static DRIZZLE_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
9480
PLUGIN_VAR_RQCMDARG,
9481
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
9482
NULL, NULL, 500L, 1L, ~0L, 0);
9484
static DRIZZLE_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
9485
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9486
"Number of background read I/O threads in InnoDB.",
9487
NULL, NULL, 4, 1, 64, 0);
9489
static DRIZZLE_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
9490
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9491
"Number of background write I/O threads in InnoDB.",
9492
NULL, NULL, 4, 1, 64, 0);
9494
static DRIZZLE_SYSVAR_LONG(force_recovery, innobase_force_recovery,
9495
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9496
"Helps to save your data in case the disk image of the database becomes corrupt.",
9497
NULL, NULL, 0, 0, 6, 0);
9499
static DRIZZLE_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size,
9500
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9501
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
9502
NULL, NULL, 8*1024*1024L, 256*1024L, LONG_MAX, 1024);
9504
static DRIZZLE_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size,
9505
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9506
"Size of each log file in a log group.",
9507
NULL, NULL, 20*1024*1024L, 1*1024*1024L, INT64_MAX, 1024*1024L);
9509
static DRIZZLE_SYSVAR_LONG(log_files_in_group, innobase_log_files_in_group,
9510
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9511
"Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
9512
NULL, NULL, 2, 2, 100, 0);
9514
static DRIZZLE_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups,
9515
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9516
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
9517
NULL, NULL, 1, 1, 10, 0);
9519
static DRIZZLE_SYSVAR_UINT(old_blocks_pct, innobase_old_blocks_pct,
9520
PLUGIN_VAR_RQCMDARG,
9521
"Percentage of the buffer pool to reserve for 'old' blocks.",
9522
NULL, innodb_old_blocks_pct_update, 100 * 3 / 8, 5, 95, 0);
9524
static DRIZZLE_SYSVAR_UINT(old_blocks_time, buf_LRU_old_threshold_ms,
9525
PLUGIN_VAR_RQCMDARG,
9526
"Move blocks to the 'new' end of the buffer pool if the first access"
9527
" was at least this many milliseconds ago."
9528
" The timeout is disabled if 0 (the default).",
9529
NULL, NULL, 0, 0, UINT32_MAX, 0);
9531
static DRIZZLE_SYSVAR_LONG(open_files, innobase_open_files,
9532
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9533
"How many files at the maximum InnoDB keeps open at the same time.",
9534
NULL, NULL, 300L, 10L, LONG_MAX, 0);
9536
static DRIZZLE_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
9537
PLUGIN_VAR_RQCMDARG,
9538
"Count of spin-loop rounds in InnoDB mutexes (30 by default)",
9539
NULL, NULL, 30L, 0L, ~0L, 0);
9541
static DRIZZLE_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
9542
PLUGIN_VAR_OPCMDARG,
9543
"Maximum delay between polling for a spin lock (6 by default)",
9544
NULL, NULL, 6L, 0L, ~0L, 0);
9546
static DRIZZLE_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
9547
PLUGIN_VAR_RQCMDARG,
9548
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
9549
NULL, NULL, 0, 0, 1000, 0);
9551
static DRIZZLE_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
9552
PLUGIN_VAR_RQCMDARG,
9553
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
9554
NULL, NULL, 10000L, 0L, ~0L, 0);
9556
static DRIZZLE_SYSVAR_STR(data_file_path, innobase_data_file_path,
9557
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9558
"Path to individual files and their sizes.",
9561
static DRIZZLE_SYSVAR_STR(version, innodb_version_str,
9562
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
9563
"InnoDB version", NULL, NULL, INNODB_VERSION_STR);
9565
static DRIZZLE_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
9566
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9567
"Use OS memory allocator instead of InnoDB's internal memory allocator",
9570
static DRIZZLE_SYSVAR_STR(change_buffering, innobase_change_buffering,
9571
PLUGIN_VAR_RQCMDARG,
9572
"Buffer changes to reduce random access: "
9573
"OFF, ON, none, inserts.",
9574
innodb_change_buffering_validate,
9575
innodb_change_buffering_update, NULL);
9577
static DRIZZLE_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
9578
PLUGIN_VAR_RQCMDARG,
9579
"Number of pages that must be accessed sequentially for InnoDB to "
9580
"trigger a readahead.",
9581
NULL, NULL, 56, 0, 64, 0);
9211
9583
static void init_options(drizzled::module::option_context &context)
9265
9635
context("disable-stats-on-metadata",
9266
9636
"Disable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)");
9267
9637
context("stats-sample-pages",
9268
po::value<uint64_nonzero_constraint>(&innodb_stats_sample_pages)->default_value(8),
9638
po::value<uint64_t>(&srv_stats_sample_pages)->default_value(8),
9269
9639
"The number of index pages to sample when calculating statistics (default 8)");
9270
9640
context("disable-adaptive-hash-index",
9271
9641
"Enable InnoDB adaptive hash index (enabled by default)");
9272
9642
context("replication-delay",
9273
po::value<uint64_constraint>(&innodb_replication_delay)->default_value(0),
9643
po::value<unsigned long>(&srv_replication_delay)->default_value(0),
9274
9644
"Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
9275
9645
context("additional-mem-pool-size",
9276
po::value<additional_mem_pool_constraint>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9646
po::value<long>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9277
9647
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
9278
9648
context("autoextend-increment",
9279
po::value<autoextend_constraint>(&innodb_auto_extend_increment)->default_value(8L),
9649
po::value<uint32_t>(&srv_auto_extend_increment)->default_value(8L),
9280
9650
"Data file autoextend increment in megabytes");
9281
9651
context("buffer-pool-size",
9282
po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9652
po::value<int64_t>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9283
9653
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
9284
context("buffer-pool-instances",
9285
po::value<buffer_pool_instances_constraint>(&innobase_buffer_pool_instances)->default_value(1),
9286
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability");
9288
9654
context("commit-concurrency",
9289
po::value<concurrency_constraint>(&innobase_commit_concurrency)->default_value(0),
9655
po::value<unsigned long>(&innobase_commit_concurrency)->default_value(0),
9290
9656
"Helps in performance tuning in heavily concurrent environments.");
9291
9657
context("concurrency-tickets",
9292
po::value<uint32_nonzero_constraint>(&innodb_concurrency_tickets)->default_value(500L),
9658
po::value<unsigned long>(&srv_n_free_tickets_to_enter)->default_value(500L),
9293
9659
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket");
9294
9660
context("read-io-threads",
9295
po::value<io_threads_constraint>(&innobase_read_io_threads)->default_value(4),
9661
po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
9296
9662
"Number of background read I/O threads in InnoDB.");
9297
9663
context("write-io-threads",
9298
po::value<io_threads_constraint>(&innobase_write_io_threads)->default_value(4),
9664
po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
9299
9665
"Number of background write I/O threads in InnoDB.");
9300
9666
context("force-recovery",
9301
po::value<force_recovery_constraint>(&innobase_force_recovery)->default_value(0),
9667
po::value<long>(&innobase_force_recovery)->default_value(0),
9302
9668
"Helps to save your data in case the disk image of the database becomes corrupt.");
9303
9669
context("log-buffer-size",
9304
po::value<log_buffer_constraint>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9670
po::value<long>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9305
9671
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9306
9672
context("log-file-size",
9307
po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
9673
po::value<int64_t>(&innobase_log_file_size)->default_value(20*1024*1024L),
9308
9674
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9309
9675
context("log-files-in-group",
9310
po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
9676
po::value<long>(&innobase_log_files_in_group)->default_value(2),
9311
9677
"Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
9312
9678
context("mirrored-log-groups",
9313
po::value<mirrored_log_groups_constraint>(&innobase_mirrored_log_groups)->default_value(1),
9679
po::value<long>(&innobase_mirrored_log_groups)->default_value(1),
9314
9680
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.");
9315
9681
context("open-files",
9316
po::value<open_files_constraint>(&innobase_open_files)->default_value(300L),
9682
po::value<long>(&innobase_open_files)->default_value(300L),
9317
9683
"How many files at the maximum InnoDB keeps open at the same time.");
9318
9684
context("sync-spin-loops",
9319
po::value<uint32_constraint>(&innodb_sync_spin_loops)->default_value(30L),
9685
po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
9320
9686
"Count of spin-loop rounds in InnoDB mutexes (30 by default)");
9321
9687
context("spin-wait-delay",
9322
po::value<uint32_constraint>(&innodb_spin_wait_delay)->default_value(6L),
9688
po::value<unsigned long>(&srv_spin_wait_delay)->default_value(6L),
9323
9689
"Maximum delay between polling for a spin lock (6 by default)");
9324
9690
context("thread-concurrency",
9325
po::value<concurrency_constraint>(&innobase_thread_concurrency)->default_value(0),
9691
po::value<unsigned long>(&srv_thread_concurrency)->default_value(0),
9326
9692
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.");
9327
9693
context("thread-sleep-delay",
9328
po::value<uint32_constraint>(&innodb_thread_sleep_delay)->default_value(10000L),
9694
po::value<unsigned long>(&srv_thread_sleep_delay)->default_value(10000L),
9329
9695
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep");
9330
9696
context("data-file-path",
9331
9697
po::value<string>(),
9336
9702
context("use-internal-malloc",
9337
9703
"Use InnoDB's internal memory allocator instal of the OS memory allocator.");
9338
9704
context("change-buffering",
9339
po::value<string>(&innobase_change_buffering),
9705
po::value<string>(),
9340
9706
"Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9341
9707
context("read-ahead-threshold",
9342
po::value<read_ahead_threshold_constraint>(&innodb_read_ahead_threshold)->default_value(56),
9708
po::value<unsigned long>(&srv_read_ahead_threshold)->default_value(56),
9343
9709
"Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9344
9710
context("disable-xa",
9345
9711
"Disable InnoDB support for the XA two-phase commit");
9346
9712
context("disable-table-locks",
9347
9713
"Disable InnoDB locking in LOCK TABLES");
9348
9714
context("strict-mode",
9349
po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9715
po::value<bool>()->default_value(false)->zero_tokens(),
9350
9716
"Use strict mode when evaluating create options.");
9351
context("replication-log",
9352
po::value<bool>(&innobase_use_replication_log)->default_value(false),
9353
_("Enable internal replication log."));
9354
9717
context("lock-wait-timeout",
9355
po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),
9356
_("Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout."));
9357
context("old-blocks-pct",
9358
po::value<old_blocks_constraint>(&innobase_old_blocks_pct)->default_value(100 * 3 / 8),
9359
_("Percentage of the buffer pool to reserve for 'old' blocks."));
9360
context("old-blocks-time",
9361
po::value<uint32_t>(&buf_LRU_old_threshold_ms)->default_value(0),
9362
_("ove blocks to the 'new' end of the buffer pool if the first access"
9363
" was at least this many milliseconds ago."
9364
" The timeout is disabled if 0 (the default)."));
9718
po::value<unsigned long>()->default_value(50),
9719
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.");
9722
static drizzle_sys_var* innobase_system_variables[]= {
9723
DRIZZLE_SYSVAR(additional_mem_pool_size),
9724
DRIZZLE_SYSVAR(autoextend_increment),
9725
DRIZZLE_SYSVAR(buffer_pool_size),
9726
DRIZZLE_SYSVAR(checksums),
9727
DRIZZLE_SYSVAR(commit_concurrency),
9728
DRIZZLE_SYSVAR(concurrency_tickets),
9729
DRIZZLE_SYSVAR(data_file_path),
9730
DRIZZLE_SYSVAR(data_home_dir),
9731
DRIZZLE_SYSVAR(doublewrite),
9732
DRIZZLE_SYSVAR(fast_shutdown),
9733
DRIZZLE_SYSVAR(read_io_threads),
9734
DRIZZLE_SYSVAR(write_io_threads),
9735
DRIZZLE_SYSVAR(file_per_table),
9736
DRIZZLE_SYSVAR(file_format),
9737
DRIZZLE_SYSVAR(file_format_check),
9738
DRIZZLE_SYSVAR(flush_log_at_trx_commit),
9739
DRIZZLE_SYSVAR(flush_method),
9740
DRIZZLE_SYSVAR(force_recovery),
9741
DRIZZLE_SYSVAR(lock_wait_timeout),
9742
#ifdef UNIV_LOG_ARCHIVE
9743
DRIZZLE_SYSVAR(log_arch_dir),
9744
DRIZZLE_SYSVAR(log_archive),
9745
#endif /* UNIV_LOG_ARCHIVE */
9746
DRIZZLE_SYSVAR(log_buffer_size),
9747
DRIZZLE_SYSVAR(log_file_size),
9748
DRIZZLE_SYSVAR(log_files_in_group),
9749
DRIZZLE_SYSVAR(log_group_home_dir),
9750
DRIZZLE_SYSVAR(max_dirty_pages_pct),
9751
DRIZZLE_SYSVAR(max_purge_lag),
9752
DRIZZLE_SYSVAR(adaptive_flushing),
9753
DRIZZLE_SYSVAR(mirrored_log_groups),
9754
DRIZZLE_SYSVAR(old_blocks_pct),
9755
DRIZZLE_SYSVAR(old_blocks_time),
9756
DRIZZLE_SYSVAR(open_files),
9757
DRIZZLE_SYSVAR(stats_sample_pages),
9758
DRIZZLE_SYSVAR(adaptive_hash_index),
9759
DRIZZLE_SYSVAR(replication_delay),
9760
DRIZZLE_SYSVAR(status_file),
9761
DRIZZLE_SYSVAR(strict_mode),
9762
DRIZZLE_SYSVAR(support_xa),
9763
DRIZZLE_SYSVAR(sync_spin_loops),
9764
DRIZZLE_SYSVAR(spin_wait_delay),
9765
DRIZZLE_SYSVAR(table_locks),
9766
DRIZZLE_SYSVAR(thread_concurrency),
9767
DRIZZLE_SYSVAR(thread_sleep_delay),
9768
DRIZZLE_SYSVAR(version),
9769
DRIZZLE_SYSVAR(use_sys_malloc),
9770
DRIZZLE_SYSVAR(change_buffering),
9771
DRIZZLE_SYSVAR(read_ahead_threshold),
9772
DRIZZLE_SYSVAR(io_capacity),
9369
9776
DRIZZLE_DECLARE_PLUGIN