179
171
static plugin::TableFunction* innodb_sys_foreign_tool= NULL;
180
172
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;
174
static long innobase_mirrored_log_groups, innobase_log_files_in_group,
175
innobase_log_buffer_size,
176
innobase_force_recovery, innobase_open_files;
177
static long innobase_additional_mem_pool_size= 8*1024*1024L;
178
static ulong innobase_commit_concurrency = 0;
179
static ulong innobase_read_io_threads;
180
static ulong innobase_write_io_threads;
181
static int64_t innobase_buffer_pool_instances = 1;
184
* @TODO: Turn this into size_t as soon as we have a Variable<size_t>
186
static int64_t innobase_buffer_pool_size= 128*1024*1024;
187
static int64_t innobase_log_file_size;
227
189
/** Percentage of the buffer pool to reserve for 'old' blocks.
228
190
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;
191
static uint innobase_old_blocks_pct;
239
193
/* The default values for the following char* start-up parameters
240
194
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;
196
static char* innobase_data_home_dir = NULL;
197
static char* innobase_data_file_path = NULL;
198
static char* innobase_log_group_home_dir = NULL;
199
static char* innobase_file_format_name = NULL;
200
static char* innobase_change_buffering = NULL;
248
202
/* The highest file format being used in the database. The value can be
249
203
set by user, however, it will be adjusted to the newer file format if
250
204
a table of such format is created/opened. */
251
static string innobase_file_format_max;
205
static char* innobase_file_format_max = NULL;
207
static char* innobase_file_flush_method = NULL;
253
209
/* 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
212
static ulong innobase_fast_shutdown = 1;
271
213
static my_bool innobase_file_format_check = TRUE;
214
#ifdef UNIV_LOG_ARCHIVE
215
static my_bool innobase_log_archive = FALSE;
216
static char* innobase_log_arch_dir = NULL;
217
#endif /* UNIV_LOG_ARCHIVE */
272
218
static my_bool innobase_use_doublewrite = TRUE;
273
219
static my_bool innobase_use_checksums = TRUE;
274
220
static my_bool innobase_rollback_on_timeout = FALSE;
275
221
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
223
static char* internal_innobase_data_file_path = NULL;
225
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
284
227
/* The following counter is used to convey information to InnoDB
285
228
about server activity: in selects it is not sensible to call
286
229
srv_active_wake_master_thread after each fetch or search, we only do
1839
1796
value= value - (value % align_val);
1842
static void auto_extend_update(Session *, sql_var_t)
1844
srv_auto_extend_increment= innodb_auto_extend_increment.get();
1847
static void io_capacity_update(Session *, sql_var_t)
1849
srv_io_capacity= innodb_io_capacity.get();
1852
static void purge_batch_update(Session *, sql_var_t)
1854
srv_purge_batch_size= innodb_purge_batch_size.get();
1857
static void purge_threads_update(Session *, sql_var_t)
1859
srv_n_purge_threads= innodb_n_purge_threads.get();
1862
static void innodb_adaptive_hash_index_update(Session *, sql_var_t)
1864
if (btr_search_enabled)
1866
btr_search_enable();
1868
btr_search_disable();
1872
static void innodb_old_blocks_pct_update(Session *, sql_var_t)
1874
innobase_old_blocks_pct= buf_LRU_old_ratio_update(innobase_old_blocks_pct.get(), TRUE);
1877
static void innodb_thread_concurrency_update(Session *, sql_var_t)
1879
srv_thread_concurrency= innobase_thread_concurrency.get();
1882
static void innodb_sync_spin_loops_update(Session *, sql_var_t)
1884
srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
1887
static void innodb_spin_wait_delay_update(Session *, sql_var_t)
1889
srv_spin_wait_delay= innodb_spin_wait_delay.get();
1892
static void innodb_thread_sleep_delay_update(Session *, sql_var_t)
1894
srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
1897
static void innodb_read_ahead_threshold_update(Session *, sql_var_t)
1899
srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
1903
static int innodb_commit_concurrency_validate(Session *session, set_var *var)
1905
uint32_t new_value= var->save_result.uint32_t_value;
1907
if ((innobase_commit_concurrency.get() == 0 && new_value != 0) ||
1908
(innobase_commit_concurrency.get() != 0 && new_value == 0))
1910
push_warning_printf(session,
1911
DRIZZLE_ERROR::WARN_LEVEL_WARN,
1913
_("Once InnoDB is running, innodb_commit_concurrency "
1914
"must not change between zero and nonzero."));
1920
/*************************************************************//**
1921
Check if it is a valid file format. This function is registered as
1922
a callback with MySQL.
1923
@return 0 for valid file format */
1926
innodb_file_format_name_validate(
1927
/*=============================*/
1928
Session* , /*!< in: thread handle */
1931
const char *file_format_input = var->value->str_value.ptr();
1932
if (file_format_input == NULL)
1935
if (file_format_input != NULL) {
1938
format_id = innobase_file_format_name_lookup(
1941
if (format_id <= DICT_TF_FORMAT_MAX) {
1942
innobase_file_format_name =
1943
trx_sys_file_format_id_to_name(format_id);
1952
/*************************************************************//**
1953
Check if it is a valid value of innodb_change_buffering. This function is
1954
registered as a callback with MySQL.
1955
@return 0 for valid innodb_change_buffering */
1958
innodb_change_buffering_validate(
1959
/*=============================*/
1960
Session* , /*!< in: thread handle */
1963
const char *change_buffering_input = var->value->str_value.ptr();
1965
if (change_buffering_input == NULL)
1971
use < UT_ARR_SIZE(innobase_change_buffering_values);
1973
if (!innobase_strcasecmp(change_buffering_input,
1974
innobase_change_buffering_values[use]))
1976
ibuf_use= static_cast<ibuf_use_t>(use);
1985
/*************************************************************//**
1986
Check if valid argument to innodb_file_format_max. This function
1987
is registered as a callback with MySQL.
1988
@return 0 for valid file format */
1991
innodb_file_format_max_validate(
1992
/*==============================*/
1993
Session* session, /*!< in: thread handle */
1996
const char *file_format_input = var->value->str_value.ptr();
1997
if (file_format_input == NULL)
2000
if (file_format_input != NULL) {
2001
int format_id = innobase_file_format_validate_and_set(file_format_input);
2003
if (format_id > DICT_TF_FORMAT_MAX) {
2004
/* DEFAULT is "on", which is invalid at runtime. */
2008
if (format_id >= 0) {
2009
innobase_file_format_max=
2010
trx_sys_file_format_id_to_name((uint)format_id);
2012
/* Update the max format id in the system tablespace. */
2013
char name_buff[100];
2014
strcpy(name_buff, innobase_file_format_max.c_str());
2015
if (trx_sys_file_format_max_set(format_id, (const char **)&name_buff))
2017
errmsg_printf(ERRMSG_LVL_WARN,
2018
" [Info] InnoDB: the file format in the system "
2019
"tablespace is now set to %s.\n", name_buff);
2020
innobase_file_format_max= name_buff;
2025
push_warning_printf(session,
2026
DRIZZLE_ERROR::WARN_LEVEL_WARN,
2028
"InnoDB: invalid innodb_file_format_max "
2029
"value; can be any format up to %s "
2030
"or equivalent id of %d",
2031
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
2032
DICT_TF_FORMAT_MAX);
2040
1799
/*********************************************************************//**
2041
1800
Opens an InnoDB database.
2042
1801
@return 0 on success, error code on failure */
2052
1811
InnobaseEngine *actuall_engine_ptr;
2053
1812
const module::option_map &vm= context.getOptions();
2055
srv_auto_extend_increment= innodb_auto_extend_increment.get();
2056
srv_io_capacity= innodb_io_capacity.get();
2057
srv_purge_batch_size= innodb_purge_batch_size.get();
2058
srv_n_purge_threads= innodb_n_purge_threads.get();
2059
srv_flush_log_at_trx_commit= innodb_flush_log_at_trx_commit.get();
2060
srv_max_buf_pool_modified_pct= innodb_max_dirty_pages_pct.get();
2061
srv_max_purge_lag= innodb_max_purge_lag.get();
2062
srv_stats_sample_pages= innodb_stats_sample_pages.get();
2063
srv_n_free_tickets_to_enter= innodb_concurrency_tickets.get();
2064
srv_replication_delay= innodb_replication_delay.get();
2065
srv_thread_concurrency= innobase_thread_concurrency.get();
2066
srv_n_spin_wait_rounds= innodb_sync_spin_loops.get();
2067
srv_spin_wait_delay= innodb_spin_wait_delay.get();
2068
srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
2069
srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
2071
1814
/* Inverted Booleans */
2073
1816
innobase_use_checksums= (vm.count("disable-checksums")) ? false : true;
2074
1817
innobase_use_doublewrite= (vm.count("disable-doublewrite")) ? false : true;
2075
1818
srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
2076
1819
srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
2077
support_xa= (vm.count("disable-xa")) ? false : true;
2078
btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? false : true;
2081
/* Hafta do this here because we need to late-bind the default value */
1820
(SessionVAR(NULL,support_xa))= (vm.count("disable-xa")) ? false : true;
1821
(SessionVAR(NULL,table_locks))= (vm.count("disable-table-locks")) ? false : true;
1823
if (vm.count("io-capacity"))
1825
if (srv_io_capacity < 100)
1827
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for io-capacity\n"));
2082
1832
if (vm.count("data-home-dir"))
2084
innobase_data_home_dir= vm["data-home-dir"].as<string>();
2088
innobase_data_home_dir= getDataHome().file_string();
1834
innobase_data_home_dir= strdup(vm["data-home-dir"].as<string>().c_str());
1838
innobase_data_home_dir= strdup(getDataHome().file_string().c_str());
1841
if (vm.count("fast-shutdown"))
1843
if (innobase_fast_shutdown > 2)
1845
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for fast-shutdown\n"));
1850
if (vm.count("file-format-max"))
1852
innobase_file_format_max= const_cast<char *>(vm["file-format-max"].as<string>().c_str());
1855
if (vm.count("file-format-check"))
1857
innobase_file_format_check= vm["file-format-check"].as<bool>();
1860
if (vm.count("flush-log-at-trx-commit"))
1862
if (srv_flush_log_at_trx_commit > 2)
1864
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for flush-log-at-trx-commit\n"));
1869
if (vm.count("flush-method"))
1871
innobase_file_flush_method= const_cast<char *>(vm["flush-method"].as<string>().c_str());
1875
innobase_file_flush_method= NULL;
1878
#ifdef UNIV_LOG_ARCHIVE
1879
if (vm.count("log-arch-dir"))
1881
innobase_log_arch_dir= const_cast<char *>(vm["log-arch-dir"].as<string>().c_str());
1886
innobase_log_arch_dir= NULL;
1888
#endif /* UNIV_LOG_ARCHIVE */
1890
if (vm.count("max-dirty-pages-pct"))
1892
if (srv_max_buf_pool_modified_pct > 99)
1894
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for max-dirty-pages-pct\n"));
1899
if (vm.count("stats-sample-pages"))
1901
if (srv_stats_sample_pages < 8)
1903
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for stats-sample-pages\n"));
1908
if (vm.count("additional-mem-pool-size"))
1910
align_value(innobase_additional_mem_pool_size);
1912
if (innobase_additional_mem_pool_size < 512*1024L)
1914
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for additional-mem-pool-size\n"));
1920
if (vm.count("autoextend-increment"))
1922
if (srv_auto_extend_increment < 1 || srv_auto_extend_increment > 1000)
1924
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for autoextend-increment\n"));
1929
if (vm.count("buffer-pool-size"))
1931
align_value(innobase_buffer_pool_size, 1024*1024);
1932
if (innobase_buffer_pool_size < 5*1024*1024)
1934
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer-pool-size\n"));
1940
if (vm.count("buffer-pool-instances"))
1942
if (innobase_buffer_pool_instances > MAX_BUFFER_POOLS)
1944
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for buffer-pool-instances\n"));
1950
if (vm.count("commit-concurrency"))
1952
if (srv_replication_delay > 1000)
1954
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for commit-concurrency\n"));
1959
if (vm.count("concurrency-tickets"))
1961
if (srv_n_free_tickets_to_enter < 1)
1963
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for concurrency-tickets\n"));
1968
if (vm.count("read-io-threads"))
1970
if (innobase_read_io_threads < 1 || innobase_read_io_threads > 64)
1972
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-io-threads\n"));
1977
if (vm.count("write-io-threads"))
1979
if (innobase_write_io_threads < 1 || innobase_write_io_threads > 64)
1981
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for write-io-threads\n"));
1986
if (vm.count("force-recovery"))
1988
if (innobase_force_recovery > 6)
1990
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for force-recovery\n"));
1995
if (vm.count("log-buffer-size"))
1997
align_value(innobase_log_buffer_size);
1998
if (innobase_log_buffer_size < 256*1024L)
2000
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
2005
if (vm.count("log-file-size"))
2007
align_value(innobase_log_file_size, 1024*1024);
2008
if (innobase_log_file_size < 1*1024*1024L)
2010
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-file-size\n"));
2015
if (vm.count("log-files-in-group"))
2017
if (innobase_log_files_in_group < 2 || innobase_log_files_in_group > 100)
2019
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for log-files-in-group\n"));
2024
if (vm.count("mirrored-log-groups"))
2026
if (innobase_mirrored_log_groups < 1 || innobase_mirrored_log_groups > 10)
2028
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for mirrored-log-groups\n"));
2033
if (vm.count("open-files"))
2035
if (innobase_open_files < 10)
2037
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for open-files\n"));
2042
if (vm.count("thread-concurrency"))
2044
if (srv_thread_concurrency > 1000)
2046
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for thread-concurrency\n"));
2092
2051
if (vm.count("data-file-path"))
2094
innobase_data_file_path= vm["data-file-path"].as<string>();
2053
innobase_data_file_path= const_cast<char *>(vm["data-file-path"].as<string>().c_str());
2057
innobase_data_file_path= NULL;
2060
if (vm.count("version"))
2062
innodb_version_str= const_cast<char *>(vm["version"].as<string>().c_str());
2065
if (vm.count("read-ahead-threshold"))
2067
if (srv_read_ahead_threshold > 64)
2069
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for read-ahead-threshold\n"));
2074
if (vm.count("strict-mode"))
2076
(SessionVAR(NULL,strict_mode))= vm["strict-mode"].as<bool>();
2079
if (vm.count("lock-wait-timeout"))
2081
if (vm["lock-wait-timeout"].as<unsigned long>() < 1 || vm["lock-wait-timeout"].as<unsigned long>() > 1024*1024*1024)
2083
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for lock-wait-timeout\n"));
2087
(SessionVAR(NULL,lock_wait_timeout))= vm["lock-wait-timeout"].as<unsigned long>();
2098
2090
innodb_engine_ptr= actuall_engine_ptr= new InnobaseEngine(innobase_engine_name);
2378
2417
context.add(innodb_sys_foreign_cols_tool);
2380
2419
context.add(new(std::nothrow)InnodbInternalTables());
2381
context.add(new(std::nothrow)InnodbReplicationTable());
2383
if (innobase_use_replication_log)
2385
replication_logger= new(std::nothrow)ReplicationLog();
2386
context.add(replication_logger);
2387
ReplicationLog::setup(replication_logger);
2390
context.registerVariable(new sys_var_const_string_val("data-home-dir", innobase_data_home_dir));
2391
context.registerVariable(new sys_var_const_string_val("flush-method",
2392
vm.count("flush-method") ? vm["flush-method"].as<string>() : ""));
2393
context.registerVariable(new sys_var_const_string_val("log-group-home-dir", innobase_log_group_home_dir));
2394
context.registerVariable(new sys_var_const_string_val("data-file-path", innobase_data_file_path));
2395
context.registerVariable(new sys_var_const_string_val("version", vm["version"].as<string>()));
2398
context.registerVariable(new sys_var_bool_ptr_readonly("replication_log", &innobase_use_replication_log));
2399
context.registerVariable(new sys_var_bool_ptr_readonly("checksums", &innobase_use_checksums));
2400
context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite", &innobase_use_doublewrite));
2401
context.registerVariable(new sys_var_bool_ptr("file-per-table", &srv_file_per_table));
2402
context.registerVariable(new sys_var_bool_ptr_readonly("file-format-check", &innobase_file_format_check));
2403
context.registerVariable(new sys_var_bool_ptr("adaptive-flushing", &srv_adaptive_flushing));
2404
context.registerVariable(new sys_var_bool_ptr("status-file", &innobase_create_status_file));
2405
context.registerVariable(new sys_var_bool_ptr_readonly("use-sys-malloc", &srv_use_sys_malloc));
2406
context.registerVariable(new sys_var_bool_ptr_readonly("use-native-aio", &srv_use_native_aio));
2408
context.registerVariable(new sys_var_bool_ptr("support-xa", &support_xa));
2409
context.registerVariable(new sys_var_bool_ptr("strict_mode", &strict_mode));
2410
context.registerVariable(new sys_var_constrained_value<uint32_t>("lock_wait_timeout", lock_wait_timeout));
2412
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("additional_mem_pool_size",innobase_additional_mem_pool_size));
2413
context.registerVariable(new sys_var_constrained_value<uint32_t>("autoextend_increment",
2414
innodb_auto_extend_increment,
2415
auto_extend_update));
2416
context.registerVariable(new sys_var_constrained_value<uint32_t>("io_capacity",
2418
io_capacity_update));
2419
context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_batch_size",
2420
innodb_purge_batch_size,
2421
purge_batch_update));
2422
context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_threads",
2423
innodb_n_purge_threads,
2424
purge_threads_update));
2425
context.registerVariable(new sys_var_constrained_value<uint16_t>("fast_shutdown", innobase_fast_shutdown));
2426
context.registerVariable(new sys_var_std_string("file_format",
2427
innobase_file_format_name,
2428
innodb_file_format_name_validate));
2429
context.registerVariable(new sys_var_std_string("change_buffering",
2430
innobase_change_buffering,
2431
innodb_change_buffering_validate));
2432
context.registerVariable(new sys_var_std_string("file_format_max",
2433
innobase_file_format_max,
2434
innodb_file_format_max_validate));
2435
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
2436
context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
2437
context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("flush_log_at_trx_commit",
2438
innodb_flush_log_at_trx_commit));
2439
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
2440
innodb_max_dirty_pages_pct));
2441
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", innodb_max_purge_lag));
2442
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("stats_sample_pages", innodb_stats_sample_pages));
2443
context.registerVariable(new sys_var_bool_ptr("adaptive_hash_index", &btr_search_enabled, innodb_adaptive_hash_index_update));
2445
context.registerVariable(new sys_var_constrained_value<uint32_t>("commit_concurrency",
2446
innobase_commit_concurrency,
2447
innodb_commit_concurrency_validate));
2448
context.registerVariable(new sys_var_constrained_value<uint32_t>("concurrency_tickets",
2449
innodb_concurrency_tickets));
2450
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("read_io_threads", innobase_read_io_threads));
2451
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("write_io_threads", innobase_write_io_threads));
2452
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("replication_delay", innodb_replication_delay));
2453
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("force_recovery", innobase_force_recovery));
2454
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("log_buffer_size", innobase_log_buffer_size));
2455
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("log_files_in_group", innobase_log_files_in_group));
2456
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("mirrored_log_groups", innobase_mirrored_log_groups));
2457
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("open_files", innobase_open_files));
2458
context.registerVariable(new sys_var_constrained_value<uint32_t>("old_blocks_pct",
2459
innobase_old_blocks_pct,
2460
innodb_old_blocks_pct_update));
2461
context.registerVariable(new sys_var_uint32_t_ptr("old_blocks_time", &buf_LRU_old_threshold_ms));
2462
context.registerVariable(new sys_var_constrained_value<uint32_t>("sync_spin_loops", innodb_sync_spin_loops, innodb_sync_spin_loops_update));
2463
context.registerVariable(new sys_var_constrained_value<uint32_t>("spin_wait_delay", innodb_spin_wait_delay, innodb_spin_wait_delay_update));
2464
context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_sleep_delay", innodb_thread_sleep_delay, innodb_thread_sleep_delay_update));
2465
context.registerVariable(new sys_var_constrained_value<uint32_t>("thread_concurrency",
2466
innobase_thread_concurrency,
2467
innodb_thread_concurrency_update));
2468
context.registerVariable(new sys_var_constrained_value<uint32_t>("read_ahead_threshold",
2469
innodb_read_ahead_threshold,
2470
innodb_read_ahead_threshold_update));
2471
2421
/* Get the current high water mark format. */
2472
innobase_file_format_max = trx_sys_file_format_max_get();
2473
btr_search_fully_disabled = (!btr_search_enabled);
2422
innobase_file_format_max = (char*) trx_sys_file_format_max_get();
9141
/*************************************************************//**
9142
Check if it is a valid file format. This function is registered as
9143
a callback with MySQL.
9144
@return 0 for valid file format */
9147
innodb_file_format_name_validate(
9148
/*=============================*/
9149
Session* , /*!< in: thread handle */
9150
drizzle_sys_var* , /*!< in: pointer to system
9152
void* save, /*!< out: immediate result
9153
for update function */
9154
drizzle_value* value) /*!< in: incoming string */
9156
const char* file_format_input;
9157
char buff[STRING_BUFFER_USUAL_SIZE];
9158
int len = sizeof(buff);
9161
ut_a(value != NULL);
9163
file_format_input = value->val_str(value, buff, &len);
9165
if (file_format_input != NULL) {
9168
format_id = innobase_file_format_name_lookup(
9171
if (format_id <= DICT_TF_FORMAT_MAX) {
9172
/* Save a pointer to the name in the
9173
'file_format_name_map' constant array. */
9174
*static_cast<const char**>(save) =
9175
trx_sys_file_format_id_to_name(format_id);
9181
*static_cast<const char**>(save) = NULL;
9185
/****************************************************************//**
9186
Update the system variable innodb_file_format using the "saved"
9187
value. This function is registered as a callback with MySQL. */
9190
innodb_file_format_name_update(
9191
/*===========================*/
9192
Session* , /*!< in: thread handle */
9193
drizzle_sys_var* , /*!< in: pointer to
9195
void* var_ptr, /*!< out: where the
9196
formal string goes */
9197
const void* save) /*!< in: immediate result
9198
from check function */
9200
const char* format_name;
9202
ut_a(var_ptr != NULL);
9205
format_name = *static_cast<const char*const*>(save);
9210
format_id = innobase_file_format_name_lookup(format_name);
9212
if (format_id <= DICT_TF_FORMAT_MAX) {
9213
srv_file_format = format_id;
9217
*static_cast<const char**>(var_ptr)
9218
= trx_sys_file_format_id_to_name(srv_file_format);
9221
/*************************************************************//**
9222
Check if valid argument to innodb_file_format_max. This function
9223
is registered as a callback with MySQL.
9224
@return 0 for valid file format */
9227
innodb_file_format_max_validate(
9228
/*==============================*/
9229
Session* session, /*!< in: thread handle */
9230
drizzle_sys_var* , /*!< in: pointer to system
9232
void* save, /*!< out: immediate result
9233
for update function */
9234
drizzle_value* value) /*!< in: incoming string */
9236
const char* file_format_input;
9237
char buff[STRING_BUFFER_USUAL_SIZE];
9238
int len = sizeof(buff);
9242
ut_a(value != NULL);
9244
file_format_input = value->val_str(value, buff, &len);
9246
if (file_format_input != NULL) {
9247
format_id = innobase_file_format_validate_and_set(file_format_input);
9249
if (format_id >= 0) {
9250
/* Save a pointer to the name in the
9251
'file_format_name_map' constant array. */
9252
*static_cast<const char**>(save) =
9253
trx_sys_file_format_id_to_name((uint)format_id);
9258
push_warning_printf(session,
9259
DRIZZLE_ERROR::WARN_LEVEL_WARN,
9261
"InnoDB: invalid innodb_file_format_max "
9262
"value; can be any format up to %s "
9263
"or equivalent id of %d",
9264
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
9265
DICT_TF_FORMAT_MAX);
9269
*static_cast<const char**>(save) = NULL;
9273
/****************************************************************//**
9274
Update the system variable innodb_file_format_max using the "saved"
9275
value. This function is registered as a callback with MySQL. */
9278
innodb_file_format_max_update(
9279
/*============================*/
9280
Session* session, /*!< in: thread handle */
9281
drizzle_sys_var* , /*!< in: pointer to
9283
void* var_ptr, /*!< out: where the
9284
formal string goes */
9285
const void* save) /*!< in: immediate result
9286
from check function */
9288
const char* format_name_in;
9289
const char** format_name_out;
9293
ut_a(var_ptr != NULL);
9295
format_name_in = *static_cast<const char*const*>(save);
9297
if (!format_name_in) {
9302
format_id = innobase_file_format_name_lookup(format_name_in);
9304
if (format_id > DICT_TF_FORMAT_MAX) {
9305
/* DEFAULT is "on", which is invalid at runtime. */
9306
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
9308
"Ignoring SET innodb_file_format=%s",
9313
format_name_out = static_cast<const char**>(var_ptr);
9315
/* Update the max format id in the system tablespace. */
9316
if (trx_sys_file_format_max_set(format_id, format_name_out)) {
9317
ut_print_timestamp(stderr);
9319
" [Info] InnoDB: the file format in the system "
9320
"tablespace is now set to %s.\n", *format_name_out);
9324
/****************************************************************//**
9325
Update the system variable innodb_adaptive_hash_index using the "saved"
9326
value. This function is registered as a callback with MySQL. */
9329
innodb_adaptive_hash_index_update(
9330
/*==============================*/
9331
Session* , /*!< in: thread handle */
9332
drizzle_sys_var* , /*!< in: pointer to
9334
void* , /*!< out: where the
9335
formal string goes */
9336
const void* save) /*!< in: immediate result
9337
from check function */
9339
if (*(bool*) save) {
9340
btr_search_enable();
9342
btr_search_disable();
9346
/****************************************************************//**
9347
Update the system variable innodb_old_blocks_pct using the "saved"
9348
value. This function is registered as a callback with MySQL. */
9351
innodb_old_blocks_pct_update(
9352
/*=========================*/
9353
Session* , /*!< in: thread handle */
9354
drizzle_sys_var* , /*!< in: pointer to
9356
void* ,/*!< out: where the
9357
formal string goes */
9358
const void* save) /*!< in: immediate result
9359
from check function */
9361
innobase_old_blocks_pct = buf_LRU_old_ratio_update(
9362
*static_cast<const uint*>(save), TRUE);
9365
/*************************************************************//**
9366
Check if it is a valid value of innodb_change_buffering. This function is
9367
registered as a callback with MySQL.
9368
@return 0 for valid innodb_change_buffering */
9371
innodb_change_buffering_validate(
9372
/*=============================*/
9373
Session* , /*!< in: thread handle */
9374
drizzle_sys_var* , /*!< in: pointer to system
9376
void* save, /*!< out: immediate result
9377
for update function */
9378
drizzle_value* value) /*!< in: incoming string */
9380
const char* change_buffering_input;
9381
char buff[STRING_BUFFER_USUAL_SIZE];
9382
int len = sizeof(buff);
9385
ut_a(value != NULL);
9387
change_buffering_input = value->val_str(value, buff, &len);
9389
if (change_buffering_input != NULL) {
9392
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
9394
if (!innobase_strcasecmp(
9395
change_buffering_input,
9396
innobase_change_buffering_values[use])) {
9397
*(ibuf_use_t*) save = (ibuf_use_t) use;
9406
/****************************************************************//**
9407
Update the system variable innodb_change_buffering using the "saved"
9408
value. This function is registered as a callback with MySQL. */
9411
innodb_change_buffering_update(
9412
/*===========================*/
9413
Session* , /*!< in: thread handle */
9414
drizzle_sys_var* , /*!< in: pointer to
9416
void* var_ptr, /*!< out: where the
9417
formal string goes */
9418
const void* save) /*!< in: immediate result
9419
from check function */
9421
ut_a(var_ptr != NULL);
9423
ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
9425
ibuf_use = *(const ibuf_use_t*) save;
9427
*(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
9430
/* plugin options */
9431
static DRIZZLE_SYSVAR_BOOL(checksums, innobase_use_checksums,
9432
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9433
"Enable InnoDB checksums validation (enabled by default). ",
9436
static DRIZZLE_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
9437
PLUGIN_VAR_READONLY,
9438
"The common part for InnoDB table spaces.",
9441
static DRIZZLE_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
9442
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9443
"Enable InnoDB doublewrite buffer (enabled by default). ",
9446
static DRIZZLE_SYSVAR_ULONG(io_capacity, srv_io_capacity,
9447
PLUGIN_VAR_RQCMDARG,
9448
"Number of IOPs the server can do. Tunes the background IO rate",
9449
NULL, NULL, 200, 100, ~0L, 0);
9451
static DRIZZLE_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
9452
PLUGIN_VAR_OPCMDARG,
9453
"Number of UNDO logs to purge in one batch from the history list. "
9456
20, /* Default setting */
9457
1, /* Minimum value */
9458
5000, 0); /* Maximum value */
9460
static DRIZZLE_SYSVAR_ULONG(purge_threads, srv_n_purge_threads,
9461
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
9462
"Purge threads can be either 0 or 1. Default is 0.",
9464
0, /* Default setting */
9465
0, /* Minimum value */
9466
1, 0); /* Maximum value */
9468
static DRIZZLE_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
9469
PLUGIN_VAR_OPCMDARG,
9470
"Speeds up the shutdown process of the InnoDB storage engine. Possible "
9471
"values are 0, 1 (faster)"
9472
" or 2 (fastest - crash-like)"
9474
NULL, NULL, 1, 0, 2, 0);
9476
static DRIZZLE_SYSVAR_BOOL(file_per_table, srv_file_per_table,
9477
PLUGIN_VAR_NOCMDARG,
9478
"Stores each InnoDB table to an .ibd file in the database dir.",
9481
static DRIZZLE_SYSVAR_STR(file_format, innobase_file_format_name,
9482
PLUGIN_VAR_RQCMDARG,
9483
"File format to use for new tables in .ibd files.",
9484
innodb_file_format_name_validate,
9485
innodb_file_format_name_update, "Barracuda");
9487
/* "innobase_file_format_check" decides whether we would continue
9488
booting the server if the file format stamped on the system
9489
table space exceeds the maximum file format supported
9490
by the server. Can be set during server startup at command
9491
line or configure file, and a read only variable after
9493
static DRIZZLE_SYSVAR_BOOL(file_format_check, innobase_file_format_check,
9494
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
9495
"Whether to perform system file format check.",
9498
/* If a new file format is introduced, the file format
9499
name needs to be updated accordingly. Please refer to
9500
file_format_name_map[] defined in trx0sys.c for the next
9501
file format name. */
9502
static DRIZZLE_SYSVAR_STR(file_format_max, innobase_file_format_max,
9503
PLUGIN_VAR_OPCMDARG,
9504
"The highest file format in the tablespace.",
9505
innodb_file_format_max_validate,
9506
innodb_file_format_max_update,
9509
static DRIZZLE_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
9510
PLUGIN_VAR_OPCMDARG,
9511
"Set to 0 (write and flush once per second),"
9512
" 1 (write and flush at each commit)"
9513
" or 2 (write at commit, flush once per second).",
9514
NULL, NULL, 1, 0, 2, 0);
9516
static DRIZZLE_SYSVAR_STR(flush_method, innobase_file_flush_method,
9517
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9518
"With which method to flush data.", NULL, NULL, NULL);
9520
#ifdef UNIV_LOG_ARCHIVE
9521
static DRIZZLE_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
9522
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9523
"Where full logs should be archived.", NULL, NULL, NULL);
9525
static DRIZZLE_SYSVAR_BOOL(log_archive, innobase_log_archive,
9526
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
9527
"Set to 1 if you want to have logs archived.", NULL, NULL, FALSE);
9528
#endif /* UNIV_LOG_ARCHIVE */
9530
static DRIZZLE_SYSVAR_STR(log_group_home_dir, innobase_log_group_home_dir,
9531
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9532
"Path to InnoDB log files.", NULL, NULL, NULL);
9534
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
9535
PLUGIN_VAR_RQCMDARG,
9536
"Percentage of dirty pages allowed in bufferpool.",
9537
NULL, NULL, 75, 0, 99, 0);
9539
static DRIZZLE_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
9540
PLUGIN_VAR_NOCMDARG,
9541
"Attempt flushing dirty pages to avoid IO bursts at checkpoints.",
9544
static DRIZZLE_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
9545
PLUGIN_VAR_RQCMDARG,
9546
"Desired maximum length of the purge queue (0 = no limit)",
9547
NULL, NULL, 0, 0, ~0L, 0);
9549
static DRIZZLE_SYSVAR_BOOL(status_file, innobase_create_status_file,
9550
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_NOSYSVAR,
9551
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
9554
static DRIZZLE_SYSVAR_ULONGLONG(stats_sample_pages, srv_stats_sample_pages,
9555
PLUGIN_VAR_RQCMDARG,
9556
"The number of index pages to sample when calculating statistics (default 8)",
9557
NULL, NULL, 8, 1, ~0ULL, 0);
9559
static DRIZZLE_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
9560
PLUGIN_VAR_OPCMDARG,
9561
"Enable InnoDB adaptive hash index (enabled by default).",
9562
NULL, innodb_adaptive_hash_index_update, TRUE);
9564
static DRIZZLE_SYSVAR_ULONG(replication_delay, srv_replication_delay,
9565
PLUGIN_VAR_RQCMDARG,
9566
"Replication thread delay (ms) on the slave server if "
9567
"innodb_thread_concurrency is reached (0 by default)",
9568
NULL, NULL, 0, 0, ~0UL, 0);
9570
static DRIZZLE_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size,
9571
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9572
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
9573
NULL, NULL, 8*1024*1024L, 512*1024L, LONG_MAX, 1024);
9575
static DRIZZLE_SYSVAR_UINT(autoextend_increment, srv_auto_extend_increment,
9576
PLUGIN_VAR_RQCMDARG,
9577
"Data file autoextend increment in megabytes",
9578
NULL, NULL, 8L, 1L, 1000L, 0);
9580
static DRIZZLE_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
9581
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9582
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
9583
NULL, NULL, 128*1024*1024L, 5*1024*1024L, INT64_MAX, 1024*1024L);
9585
static DRIZZLE_SYSVAR_LONGLONG(buffer_pool_instances, innobase_buffer_pool_instances,
9586
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9587
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability",
9588
NULL, NULL, 1L, 1L, MAX_BUFFER_POOLS, 1L);
9590
static DRIZZLE_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
9591
PLUGIN_VAR_RQCMDARG,
9592
"Helps in performance tuning in heavily concurrent environments.",
9593
innobase_commit_concurrency_validate, NULL, 0, 0, 1000, 0);
9595
static DRIZZLE_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
9596
PLUGIN_VAR_RQCMDARG,
9597
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
9598
NULL, NULL, 500L, 1L, ~0L, 0);
9600
static DRIZZLE_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
9601
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9602
"Number of background read I/O threads in InnoDB.",
9603
NULL, NULL, 4, 1, 64, 0);
9605
static DRIZZLE_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
9606
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9607
"Number of background write I/O threads in InnoDB.",
9608
NULL, NULL, 4, 1, 64, 0);
9610
static DRIZZLE_SYSVAR_LONG(force_recovery, innobase_force_recovery,
9611
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9612
"Helps to save your data in case the disk image of the database becomes corrupt.",
9613
NULL, NULL, 0, 0, 6, 0);
9615
static DRIZZLE_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size,
9616
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9617
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
9618
NULL, NULL, 8*1024*1024L, 256*1024L, LONG_MAX, 1024);
9620
static DRIZZLE_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size,
9621
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9622
"Size of each log file in a log group.",
9623
NULL, NULL, 20*1024*1024L, 1*1024*1024L, INT64_MAX, 1024*1024L);
9625
static DRIZZLE_SYSVAR_LONG(log_files_in_group, innobase_log_files_in_group,
9626
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9627
"Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
9628
NULL, NULL, 2, 2, 100, 0);
9630
static DRIZZLE_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups,
9631
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9632
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
9633
NULL, NULL, 1, 1, 10, 0);
9635
static DRIZZLE_SYSVAR_UINT(old_blocks_pct, innobase_old_blocks_pct,
9636
PLUGIN_VAR_RQCMDARG,
9637
"Percentage of the buffer pool to reserve for 'old' blocks.",
9638
NULL, innodb_old_blocks_pct_update, 100 * 3 / 8, 5, 95, 0);
9640
static DRIZZLE_SYSVAR_UINT(old_blocks_time, buf_LRU_old_threshold_ms,
9641
PLUGIN_VAR_RQCMDARG,
9642
"Move blocks to the 'new' end of the buffer pool if the first access"
9643
" was at least this many milliseconds ago."
9644
" The timeout is disabled if 0 (the default).",
9645
NULL, NULL, 0, 0, UINT32_MAX, 0);
9647
static DRIZZLE_SYSVAR_LONG(open_files, innobase_open_files,
9648
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9649
"How many files at the maximum InnoDB keeps open at the same time.",
9650
NULL, NULL, 300L, 10L, LONG_MAX, 0);
9652
static DRIZZLE_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
9653
PLUGIN_VAR_RQCMDARG,
9654
"Count of spin-loop rounds in InnoDB mutexes (30 by default)",
9655
NULL, NULL, 30L, 0L, ~0L, 0);
9657
static DRIZZLE_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
9658
PLUGIN_VAR_OPCMDARG,
9659
"Maximum delay between polling for a spin lock (6 by default)",
9660
NULL, NULL, 6L, 0L, ~0L, 0);
9662
static DRIZZLE_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
9663
PLUGIN_VAR_RQCMDARG,
9664
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
9665
NULL, NULL, 0, 0, 1000, 0);
9667
static DRIZZLE_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
9668
PLUGIN_VAR_RQCMDARG,
9669
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
9670
NULL, NULL, 10000L, 0L, ~0L, 0);
9672
static DRIZZLE_SYSVAR_STR(data_file_path, innobase_data_file_path,
9673
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9674
"Path to individual files and their sizes.",
9677
static DRIZZLE_SYSVAR_STR(version, innodb_version_str,
9678
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
9679
"InnoDB version", NULL, NULL, INNODB_VERSION_STR);
9681
static DRIZZLE_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
9682
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9683
"Use OS memory allocator instead of InnoDB's internal memory allocator",
9686
static DRIZZLE_SYSVAR_BOOL(use_native_aio, srv_use_native_aio,
9687
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
9688
"Use native AIO if supported on this platform.",
9691
static DRIZZLE_SYSVAR_STR(change_buffering, innobase_change_buffering,
9692
PLUGIN_VAR_RQCMDARG,
9693
"Buffer changes to reduce random access: "
9694
"OFF, ON, inserting, deleting, changing or purging..",
9695
innodb_change_buffering_validate,
9696
innodb_change_buffering_update, "all");
9698
static DRIZZLE_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
9699
PLUGIN_VAR_RQCMDARG,
9700
"Number of pages that must be accessed sequentially for InnoDB to "
9701
"trigger a readahead.",
9702
NULL, NULL, 56, 0, 64, 0);
9209
9704
static void init_options(drizzled::module::option_context &context)
9263
9766
context("disable-stats-on-metadata",
9264
9767
"Disable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)");
9265
9768
context("stats-sample-pages",
9266
po::value<uint64_nonzero_constraint>(&innodb_stats_sample_pages)->default_value(8),
9769
po::value<uint64_t>(&srv_stats_sample_pages)->default_value(8),
9267
9770
"The number of index pages to sample when calculating statistics (default 8)");
9268
9771
context("disable-adaptive-hash-index",
9269
9772
"Enable InnoDB adaptive hash index (enabled by default)");
9270
9773
context("replication-delay",
9271
po::value<uint64_constraint>(&innodb_replication_delay)->default_value(0),
9774
po::value<unsigned long>(&srv_replication_delay)->default_value(0),
9272
9775
"Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
9273
9776
context("additional-mem-pool-size",
9274
po::value<additional_mem_pool_constraint>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9777
po::value<long>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9275
9778
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
9276
9779
context("autoextend-increment",
9277
po::value<autoextend_constraint>(&innodb_auto_extend_increment)->default_value(8L),
9780
po::value<uint32_t>(&srv_auto_extend_increment)->default_value(8L),
9278
9781
"Data file autoextend increment in megabytes");
9279
9782
context("buffer-pool-size",
9280
po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9783
po::value<int64_t>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9281
9784
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
9282
9785
context("buffer-pool-instances",
9283
po::value<buffer_pool_instances_constraint>(&innobase_buffer_pool_instances)->default_value(1),
9786
po::value<int64_t>(&innobase_buffer_pool_instances)->default_value(1),
9284
9787
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability");
9286
9789
context("commit-concurrency",
9287
po::value<concurrency_constraint>(&innobase_commit_concurrency)->default_value(0),
9790
po::value<unsigned long>(&innobase_commit_concurrency)->default_value(0),
9288
9791
"Helps in performance tuning in heavily concurrent environments.");
9289
9792
context("concurrency-tickets",
9290
po::value<uint32_nonzero_constraint>(&innodb_concurrency_tickets)->default_value(500L),
9793
po::value<unsigned long>(&srv_n_free_tickets_to_enter)->default_value(500L),
9291
9794
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket");
9292
9795
context("read-io-threads",
9293
po::value<io_threads_constraint>(&innobase_read_io_threads)->default_value(4),
9796
po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
9294
9797
"Number of background read I/O threads in InnoDB.");
9295
9798
context("write-io-threads",
9296
po::value<io_threads_constraint>(&innobase_write_io_threads)->default_value(4),
9799
po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
9297
9800
"Number of background write I/O threads in InnoDB.");
9298
9801
context("force-recovery",
9299
po::value<force_recovery_constraint>(&innobase_force_recovery)->default_value(0),
9802
po::value<long>(&innobase_force_recovery)->default_value(0),
9300
9803
"Helps to save your data in case the disk image of the database becomes corrupt.");
9301
9804
context("log-buffer-size",
9302
po::value<log_buffer_constraint>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9805
po::value<long>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9303
9806
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9304
9807
context("log-file-size",
9305
po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
9808
po::value<int64_t>(&innobase_log_file_size)->default_value(20*1024*1024L),
9306
9809
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9307
9810
context("log-files-in-group",
9308
po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
9811
po::value<long>(&innobase_log_files_in_group)->default_value(2),
9309
9812
"Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
9310
9813
context("mirrored-log-groups",
9311
po::value<mirrored_log_groups_constraint>(&innobase_mirrored_log_groups)->default_value(1),
9814
po::value<long>(&innobase_mirrored_log_groups)->default_value(1),
9312
9815
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.");
9313
9816
context("open-files",
9314
po::value<open_files_constraint>(&innobase_open_files)->default_value(300L),
9817
po::value<long>(&innobase_open_files)->default_value(300L),
9315
9818
"How many files at the maximum InnoDB keeps open at the same time.");
9316
9819
context("sync-spin-loops",
9317
po::value<uint32_constraint>(&innodb_sync_spin_loops)->default_value(30L),
9820
po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
9318
9821
"Count of spin-loop rounds in InnoDB mutexes (30 by default)");
9319
9822
context("spin-wait-delay",
9320
po::value<uint32_constraint>(&innodb_spin_wait_delay)->default_value(6L),
9823
po::value<unsigned long>(&srv_spin_wait_delay)->default_value(6L),
9321
9824
"Maximum delay between polling for a spin lock (6 by default)");
9322
9825
context("thread-concurrency",
9323
po::value<concurrency_constraint>(&innobase_thread_concurrency)->default_value(0),
9826
po::value<unsigned long>(&srv_thread_concurrency)->default_value(0),
9324
9827
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.");
9325
9828
context("thread-sleep-delay",
9326
po::value<uint32_constraint>(&innodb_thread_sleep_delay)->default_value(10000L),
9829
po::value<unsigned long>(&srv_thread_sleep_delay)->default_value(10000L),
9327
9830
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep");
9328
9831
context("data-file-path",
9329
9832
po::value<string>(),
9334
9837
context("use-internal-malloc",
9335
9838
"Use InnoDB's internal memory allocator instal of the OS memory allocator.");
9336
9839
context("change-buffering",
9337
po::value<string>(&innobase_change_buffering),
9840
po::value<string>(),
9338
9841
"Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9339
9842
context("read-ahead-threshold",
9340
po::value<read_ahead_threshold_constraint>(&innodb_read_ahead_threshold)->default_value(56),
9843
po::value<unsigned long>(&srv_read_ahead_threshold)->default_value(56),
9341
9844
"Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9342
9845
context("disable-xa",
9343
9846
"Disable InnoDB support for the XA two-phase commit");
9344
9847
context("disable-table-locks",
9345
9848
"Disable InnoDB locking in LOCK TABLES");
9346
9849
context("strict-mode",
9347
po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9850
po::value<bool>()->default_value(false)->zero_tokens(),
9348
9851
"Use strict mode when evaluating create options.");
9349
context("replication-log",
9350
po::value<bool>(&innobase_use_replication_log)->default_value(false),
9351
_("Enable internal replication log."));
9352
9852
context("lock-wait-timeout",
9353
po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),
9354
_("Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout."));
9355
context("old-blocks-pct",
9356
po::value<old_blocks_constraint>(&innobase_old_blocks_pct)->default_value(100 * 3 / 8),
9357
_("Percentage of the buffer pool to reserve for 'old' blocks."));
9358
context("old-blocks-time",
9359
po::value<uint32_t>(&buf_LRU_old_threshold_ms)->default_value(0),
9360
_("ove blocks to the 'new' end of the buffer pool if the first access"
9361
" was at least this many milliseconds ago."
9362
" The timeout is disabled if 0 (the default)."));
9853
po::value<unsigned long>()->default_value(50),
9854
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.");
9857
static drizzle_sys_var* innobase_system_variables[]= {
9858
DRIZZLE_SYSVAR(additional_mem_pool_size),
9859
DRIZZLE_SYSVAR(autoextend_increment),
9860
DRIZZLE_SYSVAR(buffer_pool_size),
9861
DRIZZLE_SYSVAR(buffer_pool_instances),
9862
DRIZZLE_SYSVAR(checksums),
9863
DRIZZLE_SYSVAR(commit_concurrency),
9864
DRIZZLE_SYSVAR(concurrency_tickets),
9865
DRIZZLE_SYSVAR(data_file_path),
9866
DRIZZLE_SYSVAR(data_home_dir),
9867
DRIZZLE_SYSVAR(doublewrite),
9868
DRIZZLE_SYSVAR(fast_shutdown),
9869
DRIZZLE_SYSVAR(read_io_threads),
9870
DRIZZLE_SYSVAR(write_io_threads),
9871
DRIZZLE_SYSVAR(file_per_table),
9872
DRIZZLE_SYSVAR(file_format),
9873
DRIZZLE_SYSVAR(file_format_check),
9874
DRIZZLE_SYSVAR(file_format_max),
9875
DRIZZLE_SYSVAR(flush_log_at_trx_commit),
9876
DRIZZLE_SYSVAR(flush_method),
9877
DRIZZLE_SYSVAR(force_recovery),
9878
DRIZZLE_SYSVAR(lock_wait_timeout),
9879
#ifdef UNIV_LOG_ARCHIVE
9880
DRIZZLE_SYSVAR(log_arch_dir),
9881
DRIZZLE_SYSVAR(log_archive),
9882
#endif /* UNIV_LOG_ARCHIVE */
9883
DRIZZLE_SYSVAR(log_buffer_size),
9884
DRIZZLE_SYSVAR(log_file_size),
9885
DRIZZLE_SYSVAR(log_files_in_group),
9886
DRIZZLE_SYSVAR(log_group_home_dir),
9887
DRIZZLE_SYSVAR(max_dirty_pages_pct),
9888
DRIZZLE_SYSVAR(max_purge_lag),
9889
DRIZZLE_SYSVAR(adaptive_flushing),
9890
DRIZZLE_SYSVAR(mirrored_log_groups),
9891
DRIZZLE_SYSVAR(old_blocks_pct),
9892
DRIZZLE_SYSVAR(old_blocks_time),
9893
DRIZZLE_SYSVAR(open_files),
9894
DRIZZLE_SYSVAR(stats_sample_pages),
9895
DRIZZLE_SYSVAR(adaptive_hash_index),
9896
DRIZZLE_SYSVAR(replication_delay),
9897
DRIZZLE_SYSVAR(status_file),
9898
DRIZZLE_SYSVAR(strict_mode),
9899
DRIZZLE_SYSVAR(support_xa),
9900
DRIZZLE_SYSVAR(sync_spin_loops),
9901
DRIZZLE_SYSVAR(spin_wait_delay),
9902
DRIZZLE_SYSVAR(table_locks),
9903
DRIZZLE_SYSVAR(thread_concurrency),
9904
DRIZZLE_SYSVAR(thread_sleep_delay),
9905
DRIZZLE_SYSVAR(version),
9906
DRIZZLE_SYSVAR(use_sys_malloc),
9907
DRIZZLE_SYSVAR(use_native_aio),
9908
DRIZZLE_SYSVAR(change_buffering),
9909
DRIZZLE_SYSVAR(read_ahead_threshold),
9910
DRIZZLE_SYSVAR(io_capacity),
9911
DRIZZLE_SYSVAR(purge_threads),
9912
DRIZZLE_SYSVAR(purge_batch_size),
9367
9916
DRIZZLE_DECLARE_PLUGIN