171
179
static plugin::TableFunction* innodb_sys_foreign_tool= NULL;
172
180
static plugin::TableFunction* innodb_sys_foreign_cols_tool= NULL;
182
static plugin::TransactionApplier *replication_logger= NULL;
174
184
static long innobase_mirrored_log_groups, innobase_log_files_in_group,
175
185
innobase_log_buffer_size,
176
186
innobase_force_recovery, innobase_open_files;
177
static long innobase_additional_mem_pool_size= 8*1024*1024L;
187
typedef constrained_check<size_t, SIZE_MAX, 512*1024, 1024> additional_mem_pool_constraint;
188
static additional_mem_pool_constraint innobase_additional_mem_pool_size;
189
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
190
static autoextend_constraint innodb_auto_extend_increment;
191
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
192
static buffer_pool_constraint innobase_buffer_pool_size;
193
typedef constrained_check<uint32_t, MAX_BUFFER_POOLS, 1> buffer_pool_instances_constraint;
194
static buffer_pool_instances_constraint innobase_buffer_pool_instances;
195
typedef constrained_check<uint32_t, UINT32_MAX, 100> io_capacity_constraint;
196
static io_capacity_constraint innodb_io_capacity;
197
typedef constrained_check<uint32_t, 5000, 1> purge_batch_constraint;
198
static purge_batch_constraint innodb_purge_batch_size;
199
typedef constrained_check<uint32_t, 1, 0> purge_threads_constraint;
200
static purge_threads_constraint innodb_n_purge_threads;
201
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
202
static trinary_constraint innodb_flush_log_at_trx_commit;
203
typedef constrained_check<unsigned int, 99, 0> max_dirty_pages_constraint;
204
static max_dirty_pages_constraint innodb_max_dirty_pages_pct;
205
static uint64_constraint innodb_max_purge_lag;
206
static uint64_nonzero_constraint innodb_stats_sample_pages;
178
211
static ulong innobase_commit_concurrency = 0;
179
212
static ulong innobase_read_io_threads;
180
213
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;
215
typedef constrained_check<int64_t, INT64_MAX, 1024*1024, 1024*1024> log_file_constraint;
216
static log_file_constraint innobase_log_file_size;
189
218
/** Percentage of the buffer pool to reserve for 'old' blocks.
190
219
Connected to buf_LRU_old_ratio. */
193
222
/* The default values for the following char* start-up parameters
194
223
are determined in innobase_init below: */
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;
225
std::string innobase_data_home_dir;
226
std::string innobase_data_file_path;
227
std::string innobase_log_group_home_dir;
228
static string innobase_file_format_name;
229
static char* innobase_change_buffering= NULL;
202
231
/* The highest file format being used in the database. The value can be
203
232
set by user, however, it will be adjusted to the newer file format if
204
233
a table of such format is created/opened. */
205
static char* innobase_file_format_max = NULL;
207
static char* innobase_file_flush_method = NULL;
234
static string innobase_file_format_max;
209
236
/* Below we have boolean-valued start-up parameters, and their default
212
static ulong innobase_fast_shutdown = 1;
239
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
240
static trinary_constraint innobase_fast_shutdown;
213
242
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 */
218
243
static my_bool innobase_use_doublewrite = TRUE;
219
244
static my_bool innobase_use_checksums = TRUE;
220
245
static my_bool innobase_rollback_on_timeout = FALSE;
221
246
static my_bool innobase_create_status_file = FALSE;
247
static bool support_xa;
248
static bool strict_mode;
249
typedef constrained_check<uint32_t, 1024*1024*1024, 1> lock_wait_constraint;
250
static lock_wait_constraint lock_wait_timeout;
223
252
static char* internal_innobase_data_file_path = NULL;
225
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
227
254
/* The following counter is used to convey information to InnoDB
228
255
about server activity: in selects it is not sensible to call
229
256
srv_active_wake_master_thread after each fetch or search, we only do
629
654
return(!(!commit_concurrency == !innobase_commit_concurrency));
632
static DRIZZLE_SessionVAR_BOOL(support_xa, PLUGIN_VAR_OPCMDARG,
633
"Enable InnoDB support for the XA two-phase commit",
634
/* check_func */ NULL, /* update_func */ NULL,
637
static DRIZZLE_SessionVAR_BOOL(table_locks, PLUGIN_VAR_OPCMDARG,
638
"Enable InnoDB locking in LOCK TABLES",
639
/* check_func */ NULL, /* update_func */ NULL,
642
static DRIZZLE_SessionVAR_BOOL(strict_mode, PLUGIN_VAR_OPCMDARG,
643
"Use strict mode when evaluating create options.",
646
static DRIZZLE_SessionVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG,
647
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
648
NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
651
658
/*****************************************************************//**
652
659
Commits a transaction in an InnoDB database. */
1796
1840
value= value - (value % align_val);
1843
static void auto_extend_update(Session *, sql_var_t)
1845
srv_auto_extend_increment= innodb_auto_extend_increment.get();
1848
static void io_capacity_update(Session *, sql_var_t)
1850
srv_io_capacity= innodb_io_capacity.get();
1853
static void purge_batch_update(Session *, sql_var_t)
1855
srv_purge_batch_size= innodb_purge_batch_size.get();
1858
static void purge_threads_update(Session *, sql_var_t)
1860
srv_n_purge_threads= innodb_n_purge_threads.get();
1863
static void innodb_adaptive_hash_index_update(Session *, sql_var_t)
1865
if (btr_search_enabled)
1867
btr_search_enable();
1869
btr_search_disable();
1873
/*************************************************************//**
1874
Check if it is a valid file format. This function is registered as
1875
a callback with MySQL.
1876
@return 0 for valid file format */
1879
innodb_file_format_name_validate(
1880
/*=============================*/
1881
Session* , /*!< in: thread handle */
1884
const char *file_format_input = var->value->str_value.ptr();
1885
if (file_format_input == NULL)
1888
if (file_format_input != NULL) {
1891
format_id = innobase_file_format_name_lookup(
1894
if (format_id <= DICT_TF_FORMAT_MAX) {
1895
innobase_file_format_name =
1896
trx_sys_file_format_id_to_name(format_id);
1905
/*************************************************************//**
1906
Check if valid argument to innodb_file_format_max. This function
1907
is registered as a callback with MySQL.
1908
@return 0 for valid file format */
1911
innodb_file_format_max_validate(
1912
/*==============================*/
1913
Session* session, /*!< in: thread handle */
1916
const char *file_format_input = var->value->str_value.ptr();
1917
if (file_format_input == NULL)
1920
if (file_format_input != NULL) {
1921
int format_id = innobase_file_format_validate_and_set(file_format_input);
1923
if (format_id > DICT_TF_FORMAT_MAX) {
1924
/* DEFAULT is "on", which is invalid at runtime. */
1928
if (format_id >= 0) {
1929
innobase_file_format_max=
1930
trx_sys_file_format_id_to_name((uint)format_id);
1932
/* Update the max format id in the system tablespace. */
1933
char name_buff[100];
1934
strcpy(name_buff, innobase_file_format_max.c_str());
1935
if (trx_sys_file_format_max_set(format_id, (const char **)&name_buff))
1937
errmsg_printf(ERRMSG_LVL_WARN,
1938
" [Info] InnoDB: the file format in the system "
1939
"tablespace is now set to %s.\n", name_buff);
1940
innobase_file_format_max= name_buff;
1945
push_warning_printf(session,
1946
DRIZZLE_ERROR::WARN_LEVEL_WARN,
1948
"InnoDB: invalid innodb_file_format_max "
1949
"value; can be any format up to %s "
1950
"or equivalent id of %d",
1951
trx_sys_file_format_id_to_name(DICT_TF_FORMAT_MAX),
1952
DICT_TF_FORMAT_MAX);
1799
1960
/*********************************************************************//**
1800
1961
Opens an InnoDB database.
1801
1962
@return 0 on success, error code on failure */
1811
1972
InnobaseEngine *actuall_engine_ptr;
1812
1973
const module::option_map &vm= context.getOptions();
1975
srv_auto_extend_increment= innodb_auto_extend_increment.get();
1976
srv_io_capacity= innodb_io_capacity.get();
1977
srv_purge_batch_size= innodb_purge_batch_size.get();
1978
srv_n_purge_threads= innodb_n_purge_threads.get();
1979
srv_flush_log_at_trx_commit= innodb_flush_log_at_trx_commit.get();
1980
srv_max_buf_pool_modified_pct= innodb_max_dirty_pages_pct.get();
1981
srv_max_purge_lag= innodb_max_purge_lag.get();
1982
srv_stats_sample_pages= innodb_stats_sample_pages.get();
1814
1984
/* Inverted Booleans */
1816
1986
innobase_use_checksums= (vm.count("disable-checksums")) ? false : true;
1817
1987
innobase_use_doublewrite= (vm.count("disable-doublewrite")) ? false : true;
1818
1988
srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
1819
1989
srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
1820
(SessionVAR(NULL,support_xa))= (vm.count("disable-xa")) ? false : true;
1821
(SessionVAR(NULL,table_locks))= (vm.count("disable-table-locks")) ? false : true;
1990
support_xa= (vm.count("disable-xa")) ? false : true;
1991
btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? 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"));
1832
1994
if (vm.count("data-home-dir"))
1834
innobase_data_home_dir= strdup(vm["data-home-dir"].as<string>().c_str());
1996
innobase_data_home_dir= vm["data-home-dir"].as<string>();
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());
2000
innobase_data_home_dir= getDataHome().file_string();
1855
2003
if (vm.count("file-format-check"))
2219
if (vm.count("purge-batch-size"))
2221
srv_purge_batch_size= vm["purge-batch-size"].as<unsigned long>();
2222
if (srv_purge_batch_size < 1 || srv_purge_batch_size > 5000)
2224
errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: wrong purge-batch_size.");
2225
goto mem_free_and_error;
2229
if (vm.count("n-purge-threads"))
2231
srv_n_purge_threads= vm["n-purge-threads"].as<unsigned long>();
2232
if (srv_n_purge_threads > 1)
2234
errmsg_printf(ERRMSG_LVL_ERROR, "InnoDB: wrong n-purge-threads.");
2235
goto mem_free_and_error;
2239
2228
srv_file_format = format_id;
2241
/* Given the type of innobase_file_format_name we have little
2242
choice but to cast away the constness from the returned name.
2243
innobase_file_format_name is used in the MySQL set variable
2244
interface and so can't be const. */
2246
2230
innobase_file_format_name =
2247
(char*) trx_sys_file_format_id_to_name(format_id);
2231
trx_sys_file_format_id_to_name(format_id);
2249
2233
/* Check innobase_file_format_check variable */
2250
2234
if (!innobase_file_format_check)
2417
2408
context.add(innodb_sys_foreign_cols_tool);
2419
2410
context.add(new(std::nothrow)InnodbInternalTables());
2411
context.registerVariable(new sys_var_const_string_val("data-home-dir", innobase_data_home_dir));
2412
context.registerVariable(new sys_var_const_string_val("flush-method",
2413
vm.count("flush-method") ? vm["flush-method"].as<string>() : ""));
2414
context.registerVariable(new sys_var_const_string_val("log-group-home-dir", innobase_log_group_home_dir));
2415
context.registerVariable(new sys_var_const_string_val("data-file-path", innobase_data_file_path));
2416
context.registerVariable(new sys_var_const_string_val("version", vm["version"].as<string>()));
2419
context.add(new(std::nothrow)InnodbReplicationTable());
2421
replication_logger= new(std::nothrow)ReplicationLog();
2422
context.add(replication_logger);
2424
if (vm.count("replication-log") and vm["replication-log"].as<bool>())
2426
ReplicationLog::setup(static_cast<ReplicationLog *>(replication_logger));
2429
context.registerVariable(new sys_var_bool_ptr_readonly("checksums", &innobase_use_checksums));
2430
context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite", &innobase_use_doublewrite));
2431
context.registerVariable(new sys_var_bool_ptr("file-per-table", &srv_file_per_table));
2432
context.registerVariable(new sys_var_bool_ptr_readonly("file-format-check", &innobase_file_format_check));
2433
context.registerVariable(new sys_var_bool_ptr("adaptive-flushing", &srv_adaptive_flushing));
2434
context.registerVariable(new sys_var_bool_ptr("status-file", &innobase_create_status_file));
2435
context.registerVariable(new sys_var_bool_ptr_readonly("use-sys-malloc", &srv_use_sys_malloc));
2436
context.registerVariable(new sys_var_bool_ptr_readonly("use-native-aio", &srv_use_native_aio));
2438
context.registerVariable(new sys_var_bool_ptr("support-xa", &support_xa));
2439
context.registerVariable(new sys_var_bool_ptr("strict_mode", &strict_mode));
2440
context.registerVariable(new sys_var_constrained_value<uint32_t>("lock_wait_timeout", lock_wait_timeout));
2442
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("additional_mem_pool_size",innobase_additional_mem_pool_size));
2443
context.registerVariable(new sys_var_constrained_value<uint32_t>("autoextend_increment",
2444
innodb_auto_extend_increment,
2445
auto_extend_update));
2446
context.registerVariable(new sys_var_constrained_value<uint32_t>("io_capacity",
2448
io_capacity_update));
2449
context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_batch_size",
2450
innodb_purge_batch_size,
2451
purge_batch_update));
2452
context.registerVariable(new sys_var_constrained_value<uint32_t>("purge_threads",
2453
innodb_n_purge_threads,
2454
purge_threads_update));
2455
context.registerVariable(new sys_var_constrained_value<uint16_t>("fast_shutdown", innobase_fast_shutdown));
2456
context.registerVariable(new sys_var_std_string("file_format",
2457
innobase_file_format_name,
2458
innodb_file_format_name_validate));
2459
context.registerVariable(new sys_var_std_string("file_format_max",
2460
innobase_file_format_max,
2461
innodb_file_format_max_validate));
2462
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
2463
context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
2464
context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("flush_log_at_trx_commit",
2465
innodb_flush_log_at_trx_commit));
2466
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
2467
innodb_max_dirty_pages_pct));
2468
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", innodb_max_purge_lag));
2469
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("stats_sample_pages", innodb_stats_sample_pages));
2470
context.registerVariable(new sys_var_bool_ptr("adaptive_hash_index", &btr_search_enabled, innodb_adaptive_hash_index_update));
2421
2473
/* Get the current high water mark format. */
2422
innobase_file_format_max = (char*) trx_sys_file_format_max_get();
2474
innobase_file_format_max = trx_sys_file_format_max_get();
2475
btr_search_fully_disabled = (!btr_search_enabled);
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
9196
/****************************************************************//**
9347
9197
Update the system variable innodb_old_blocks_pct using the "saved"
9348
9198
value. This function is registered as a callback with MySQL. */
9430
9280
/* 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
9282
/* "innobase_file_format_check" decides whether we would continue
9488
9283
booting the server if the file format stamped on the system
9490
9285
by the server. Can be set during server startup at command
9491
9286
line or configure file, and a read only variable after
9492
9287
server startup */
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
9289
/* If a new file format is introduced, the file format
9499
9290
name needs to be updated accordingly. Please refer to
9500
9291
file_format_name_map[] defined in trx0sys.c for the next
9501
9292
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
9294
static DRIZZLE_SYSVAR_ULONG(replication_delay, srv_replication_delay,
9565
9295
PLUGIN_VAR_RQCMDARG,
9567
9297
"innodb_thread_concurrency is reached (0 by default)",
9568
9298
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
9300
static DRIZZLE_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
9591
9301
PLUGIN_VAR_RQCMDARG,
9592
9302
"Helps in performance tuning in heavily concurrent environments.",
9669
9374
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
9670
9375
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
9377
static DRIZZLE_SYSVAR_STR(change_buffering, innobase_change_buffering,
9692
9378
PLUGIN_VAR_RQCMDARG,
9693
9379
"Buffer changes to reduce random access: "
9711
9397
context("disable-doublewrite",
9712
9398
"Disable InnoDB doublewrite buffer.");
9713
9399
context("io-capacity",
9714
po::value<unsigned long>(&srv_io_capacity)->default_value(200),
9400
po::value<io_capacity_constraint>(&innodb_io_capacity)->default_value(200),
9715
9401
"Number of IOPs the server can do. Tunes the background IO rate");
9716
9402
context("fast-shutdown",
9717
po::value<unsigned long>(&innobase_fast_shutdown)->default_value(1),
9403
po::value<trinary_constraint>(&innobase_fast_shutdown)->default_value(1),
9718
9404
"Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).");
9719
9405
context("purge-batch-size",
9720
po::value<unsigned long>(&srv_purge_batch_size)->default_value(20),
9406
po::value<purge_batch_constraint>(&innodb_purge_batch_size)->default_value(20),
9721
9407
"Number of UNDO logs to purge in one batch from the history list. "
9722
9408
"Default is 20.");
9723
9409
context("purge-threads",
9724
po::value<unsigned long>(&srv_n_purge_threads)->default_value(0),
9410
po::value<purge_threads_constraint>(&innodb_n_purge_threads)->default_value(0),
9725
9411
"Purge threads can be either 0 or 1. Defalut is 0.");
9726
9412
context("file-per-table",
9727
9413
po::value<bool>(&srv_file_per_table)->default_value(false)->zero_tokens(),
9728
9414
"Stores each InnoDB table to an .ibd file in the database dir.");
9729
9415
context("file-format",
9730
po::value<string>()->default_value("Antelope"),
9416
po::value<string>(&innobase_file_format_name)->default_value("Antelope"),
9731
9417
"File format to use for new tables in .ibd files.");
9732
9418
context("file-format-max",
9733
po::value<string>()->default_value("Antelope"),
9419
po::value<string>(&innobase_file_format_max)->default_value("Antelope"),
9734
9420
"The highest file format in the tablespace.");
9735
9421
context("file-format-check",
9736
9422
po::value<bool>(&innobase_file_format_check)->default_value(true)->zero_tokens(),
9737
9423
"Whether to perform system file format check.");
9738
9424
context("flush-log-at-trx-commit",
9739
po::value<unsigned long>(&srv_flush_log_at_trx_commit)->default_value(1),
9425
po::value<trinary_constraint>(&innodb_flush_log_at_trx_commit)->default_value(1),
9740
9426
"Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second).");
9741
9427
context("flush-method",
9742
9428
po::value<string>(),
9743
9429
"With which method to flush data.");
9744
#ifdef UNIV_LOG_ARCHIVE
9745
context("log-arch-dir",
9746
po::value<string>(),
9747
"Where full logs should be archived.");
9748
context("log-archive",
9749
po::value<bool>(&innobase_log_archive)->default_value(false)->zero_tokens(),
9750
"Set to 1 if you want to have logs archived.");
9751
#endif /* UNIV_LOG_ARCHIVE */
9752
9430
context("log-group-home-dir",
9753
9431
po::value<string>(),
9754
9432
"Path to InnoDB log files.");
9755
9433
context("max-dirty-pages-pct",
9756
po::value<unsigned long>(&srv_max_buf_pool_modified_pct)->default_value(75),
9434
po::value<max_dirty_pages_constraint>(&innodb_max_dirty_pages_pct)->default_value(75),
9757
9435
"Percentage of dirty pages allowed in bufferpool.");
9758
9436
context("disable-adaptive-flushing",
9759
9437
"Do not attempt flushing dirty pages to avoid IO bursts at checkpoints.");
9760
9438
context("max-purge-lag",
9761
po::value<unsigned long>(&srv_max_purge_lag)->default_value(0),
9439
po::value<uint64_constraint>(&innodb_max_purge_lag)->default_value(0),
9762
9440
"Desired maximum length of the purge queue (0 = no limit)");
9763
9441
context("status-file",
9764
9442
po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
9774
9452
po::value<unsigned long>(&srv_replication_delay)->default_value(0),
9775
9453
"Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
9776
9454
context("additional-mem-pool-size",
9777
po::value<long>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9455
po::value<additional_mem_pool_constraint>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9778
9456
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
9779
9457
context("autoextend-increment",
9780
po::value<uint32_t>(&srv_auto_extend_increment)->default_value(8L),
9458
po::value<autoextend_constraint>(&innodb_auto_extend_increment)->default_value(8L),
9781
9459
"Data file autoextend increment in megabytes");
9782
9460
context("buffer-pool-size",
9783
po::value<int64_t>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9461
po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9784
9462
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
9785
9463
context("buffer-pool-instances",
9786
po::value<int64_t>(&innobase_buffer_pool_instances)->default_value(1),
9464
po::value<buffer_pool_instances_constraint>(&innobase_buffer_pool_instances)->default_value(1),
9787
9465
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability");
9789
9467
context("commit-concurrency",
9847
9525
context("disable-table-locks",
9848
9526
"Disable InnoDB locking in LOCK TABLES");
9849
9527
context("strict-mode",
9850
po::value<bool>()->default_value(false)->zero_tokens(),
9528
po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9851
9529
"Use strict mode when evaluating create options.");
9530
context("replication-log",
9531
po::value<bool>()->default_value(false),
9532
"Enable internal replication log.");
9852
9533
context("lock-wait-timeout",
9853
po::value<unsigned long>()->default_value(50),
9534
po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),
9854
9535
"Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.");
9857
9538
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
9539
DRIZZLE_SYSVAR(commit_concurrency),
9864
9540
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
9541
DRIZZLE_SYSVAR(read_io_threads),
9870
9542
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
9543
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
9544
DRIZZLE_SYSVAR(log_buffer_size),
9884
DRIZZLE_SYSVAR(log_file_size),
9885
9545
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
9546
DRIZZLE_SYSVAR(mirrored_log_groups),
9891
9547
DRIZZLE_SYSVAR(old_blocks_pct),
9892
9548
DRIZZLE_SYSVAR(old_blocks_time),
9893
9549
DRIZZLE_SYSVAR(open_files),
9894
DRIZZLE_SYSVAR(stats_sample_pages),
9895
DRIZZLE_SYSVAR(adaptive_hash_index),
9896
9550
DRIZZLE_SYSVAR(replication_delay),
9897
DRIZZLE_SYSVAR(status_file),
9898
DRIZZLE_SYSVAR(strict_mode),
9899
DRIZZLE_SYSVAR(support_xa),
9900
9551
DRIZZLE_SYSVAR(sync_spin_loops),
9901
9552
DRIZZLE_SYSVAR(spin_wait_delay),
9902
DRIZZLE_SYSVAR(table_locks),
9903
9553
DRIZZLE_SYSVAR(thread_concurrency),
9904
9554
DRIZZLE_SYSVAR(thread_sleep_delay),
9905
DRIZZLE_SYSVAR(version),
9906
DRIZZLE_SYSVAR(use_sys_malloc),
9907
DRIZZLE_SYSVAR(use_native_aio),
9908
9555
DRIZZLE_SYSVAR(change_buffering),
9909
9556
DRIZZLE_SYSVAR(read_ahead_threshold),
9910
DRIZZLE_SYSVAR(io_capacity),
9911
DRIZZLE_SYSVAR(purge_threads),
9912
DRIZZLE_SYSVAR(purge_batch_size),