193
193
/* The default values for the following char* start-up parameters
194
194
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;
196
std::string innobase_data_home_dir;
197
std::string innobase_data_file_path;
198
std::string innobase_log_group_home_dir;
199
static char* innobase_file_format_name= NULL;
200
static char* innobase_change_buffering= NULL;
202
202
/* The highest file format being used in the database. The value can be
203
203
set by user, however, it will be adjusted to the newer file format if
204
204
a table of such format is created/opened. */
205
static char* innobase_file_format_max = NULL;
205
static char* innobase_file_format_max= NULL;
207
static char* innobase_file_flush_method = NULL;
207
std::string innobase_log_arch_dir;
209
209
/* Below we have boolean-valued start-up parameters, and their default
212
212
static ulong innobase_fast_shutdown = 1;
213
213
static my_bool innobase_file_format_check = TRUE;
214
214
#ifdef UNIV_LOG_ARCHIVE
215
static my_bool innobase_log_archive = FALSE;
216
static char* innobase_log_arch_dir = NULL;
215
static my_bool innobase_log_archive= FALSE;
217
216
#endif /* UNIV_LOG_ARCHIVE */
218
217
static my_bool innobase_use_doublewrite = TRUE;
219
218
static my_bool innobase_use_checksums = TRUE;
223
222
static char* internal_innobase_data_file_path = NULL;
225
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
227
224
/* The following counter is used to convey information to InnoDB
228
225
about server activity: in selects it is not sensible to call
229
226
srv_active_wake_master_thread after each fetch or search, we only do
1848
1843
if (vm.count("data-home-dir"))
1850
innobase_data_home_dir= strdup(vm["data-home-dir"].as<string>().c_str());
1845
innobase_data_home_dir= vm["data-home-dir"].as<string>();
1854
innobase_data_home_dir= strdup(getDataHome().file_string().c_str());
1849
innobase_data_home_dir= getDataHome().file_string();
1857
1852
if (vm.count("fast-shutdown"))
1885
if (vm.count("flush-method"))
1887
innobase_file_flush_method= const_cast<char *>(vm["flush-method"].as<string>().c_str());
1891
innobase_file_flush_method= NULL;
1894
1881
#ifdef UNIV_LOG_ARCHIVE
1895
1882
if (vm.count("log-arch-dir"))
1897
innobase_log_arch_dir= const_cast<char *>(vm["log-arch-dir"].as<string>().c_str());
1884
innobase_log_arch_dir= vm["log-arch-dir"].as<string>());
1902
innobase_log_arch_dir= NULL;
1904
1887
#endif /* UNIV_LOG_ARCHIVE */
1906
1889
if (vm.count("max-dirty-pages-pct"))
2067
2050
if (vm.count("data-file-path"))
2069
innobase_data_file_path= const_cast<char *>(vm["data-file-path"].as<string>().c_str());
2073
innobase_data_file_path= NULL;
2076
if (vm.count("version"))
2078
innodb_version_str= const_cast<char *>(vm["version"].as<string>().c_str());
2052
innobase_data_file_path= vm["data-file-path"].as<string>();
2081
2055
if (vm.count("read-ahead-threshold"))
2155
2129
/* The default dir for data files is the datadir of MySQL */
2157
srv_data_home = (char *)innobase_data_home_dir;
2131
srv_data_home = (char *)innobase_data_home_dir.c_str();
2159
2133
/* Set default InnoDB data file size to 10 MB and let it be
2160
2134
auto-extending. Thus users can use InnoDB in >= 4.0 without having
2161
2135
to specify any startup options. */
2163
if (!innobase_data_file_path) {
2164
innobase_data_file_path = (char*) "ibdata1:10M:autoextend";
2137
if (innobase_data_file_path.empty())
2139
innobase_data_file_path= std::string("ibdata1:10M:autoextend");
2167
2142
/* Since InnoDB edits the argument in the next call, we make another
2170
internal_innobase_data_file_path = strdup(innobase_data_file_path);
2145
internal_innobase_data_file_path = strdup(innobase_data_file_path.c_str());
2172
2147
ret = (bool) srv_parse_data_file_paths_and_sizes(
2173
2148
internal_innobase_data_file_path);
2188
2163
if (vm.count("log-group-home-dir"))
2190
innobase_log_group_home_dir= strdup(vm["log-group-home-dir"].as<string>().c_str());
2165
innobase_log_group_home_dir= vm["log-group-home-dir"].as<string>();
2194
innobase_log_group_home_dir = strdup(getDataHome().file_string().c_str());
2169
innobase_log_group_home_dir= getDataHome().file_string();
2197
2172
#ifdef UNIV_LOG_ARCHIVE
2199
2174
starting from 4.0.6 we always set it the same as
2200
2175
innodb_log_group_home_dir: */
2202
innobase_log_arch_dir = innobase_log_group_home_dir;
2177
innobase_log_arch_dir = (char *)innobase_log_group_home_dir.c_str();
2204
srv_arch_dir = innobase_log_arch_dir;
2179
srv_arch_dir = (char *)innobase_log_arch_dir.c_str();
2205
2180
#endif /* UNIG_LOG_ARCHIVE */
2208
srv_parse_log_group_home_dirs(innobase_log_group_home_dir);
2183
srv_parse_log_group_home_dirs((char *)innobase_log_group_home_dir.c_str());
2210
2185
if (ret == FALSE || innobase_mirrored_log_groups != 1) {
2211
2186
errmsg_printf(ERRMSG_LVL_ERROR, "syntax error in innodb_log_group_home_dir, or a "
2315
2290
/* --------------------------------------------------*/
2317
srv_file_flush_method_str = innobase_file_flush_method;
2292
if (vm.count("flush-method") != 0)
2294
srv_file_flush_method_str = (char *)vm["flush-method"].as<string>().c_str();
2319
2297
srv_n_log_groups = (ulint) innobase_mirrored_log_groups;
2320
2298
srv_n_log_files = (ulint) innobase_log_files_in_group;
2433
2411
context.add(innodb_sys_foreign_cols_tool);
2435
2413
context.add(new(std::nothrow)InnodbInternalTables());
2414
context.registerVariable(new sys_var_const_string_val("data-home-dir", innobase_data_home_dir));
2415
context.registerVariable(new sys_var_const_string_val("flush-method",
2416
vm.count("flush-method") ? vm["flush-method"].as<string>() : ""));
2417
context.registerVariable(new sys_var_const_string_val("log-group-home-dir", innobase_log_group_home_dir));
2418
context.registerVariable(new sys_var_const_string_val("data-file-path", innobase_data_file_path));
2419
context.registerVariable(new sys_var_const_string_val("version", vm["version"].as<string>()));
2421
#ifdef UNIV_LOG_ARCHIVE
2422
context.registerVariable(new sys_var_const_string_val("log-arch-dir", innobase_log_arch_dir));
2423
context.registerVariable(new sys_var_bool_ptr_readonly("log-archive", &innobase_log_archive));
2424
#endif /* UNIV_LOG_ARCHIVE */
2437
2426
context.registerVariable(new sys_var_bool_ptr_readonly("checksums", &innobase_use_checksums));
2438
2427
context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite", &innobase_use_doublewrite));
2439
context.registerVariable(new sys_var_bool_ptr("file_per_table", &srv_file_per_table));
2440
context.registerVariable(new sys_var_bool_ptr_readonly("file_format_check", &innobase_file_format_check));
2441
context.registerVariable(new sys_var_bool_ptr("adaptive_flushing", &srv_adaptive_flushing));
2442
context.registerVariable(new sys_var_bool_ptr("status_file", &innobase_create_status_file));
2443
context.registerVariable(new sys_var_bool_ptr_readonly("use_sys_malloc", &srv_use_sys_malloc));
2444
context.registerVariable(new sys_var_bool_ptr_readonly("use_native_aio", &srv_use_native_aio));
2428
context.registerVariable(new sys_var_bool_ptr("file-per-table", &srv_file_per_table));
2429
context.registerVariable(new sys_var_bool_ptr_readonly("file-format-check", &innobase_file_format_check));
2430
context.registerVariable(new sys_var_bool_ptr("adaptive-flushing", &srv_adaptive_flushing));
2431
context.registerVariable(new sys_var_bool_ptr("status-file", &innobase_create_status_file));
2432
context.registerVariable(new sys_var_bool_ptr_readonly("use-sys-malloc", &srv_use_sys_malloc));
2433
context.registerVariable(new sys_var_bool_ptr_readonly("use-native-aio", &srv_use_native_aio));
2447
2436
/* Get the current high water mark format. */
9454
9443
/* plugin options */
9456
static DRIZZLE_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
9457
PLUGIN_VAR_READONLY,
9458
"The common part for InnoDB table spaces.",
9461
9445
static DRIZZLE_SYSVAR_ULONG(io_capacity, srv_io_capacity,
9462
9446
PLUGIN_VAR_RQCMDARG,
9463
9447
"Number of IOPs the server can do. Tunes the background IO rate",
9519
9503
" or 2 (write at commit, flush once per second).",
9520
9504
NULL, NULL, 1, 0, 2, 0);
9522
static DRIZZLE_SYSVAR_STR(flush_method, innobase_file_flush_method,
9523
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9524
"With which method to flush data.", NULL, NULL, NULL);
9526
#ifdef UNIV_LOG_ARCHIVE
9527
static DRIZZLE_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
9528
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9529
"Where full logs should be archived.", NULL, NULL, NULL);
9531
context.registerVariable(new sys_var_bool_ptr_readonly("log_archive", &innobase_log_archive);
9532
#endif /* UNIV_LOG_ARCHIVE */
9534
static DRIZZLE_SYSVAR_STR(log_group_home_dir, innobase_log_group_home_dir,
9535
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9536
"Path to InnoDB log files.", NULL, NULL, NULL);
9538
9506
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
9539
9507
PLUGIN_VAR_RQCMDARG,
9540
9508
"Percentage of dirty pages allowed in bufferpool.",
9663
9631
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
9664
9632
NULL, NULL, 10000L, 0L, ~0L, 0);
9666
static DRIZZLE_SYSVAR_STR(data_file_path, innobase_data_file_path,
9667
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
9668
"Path to individual files and their sizes.",
9671
static DRIZZLE_SYSVAR_STR(version, innodb_version_str,
9672
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
9673
"InnoDB version", NULL, NULL, INNODB_VERSION_STR);
9675
9634
static DRIZZLE_SYSVAR_STR(change_buffering, innobase_change_buffering,
9676
9635
PLUGIN_VAR_RQCMDARG,
9677
9636
"Buffer changes to reduce random access: "
9845
9804
DRIZZLE_SYSVAR(buffer_pool_instances),
9846
9805
DRIZZLE_SYSVAR(commit_concurrency),
9847
9806
DRIZZLE_SYSVAR(concurrency_tickets),
9848
DRIZZLE_SYSVAR(data_file_path),
9849
DRIZZLE_SYSVAR(data_home_dir),
9850
9807
DRIZZLE_SYSVAR(fast_shutdown),
9851
9808
DRIZZLE_SYSVAR(read_io_threads),
9852
9809
DRIZZLE_SYSVAR(write_io_threads),
9853
9810
DRIZZLE_SYSVAR(file_format),
9854
9811
DRIZZLE_SYSVAR(file_format_max),
9855
9812
DRIZZLE_SYSVAR(flush_log_at_trx_commit),
9856
DRIZZLE_SYSVAR(flush_method),
9857
9813
DRIZZLE_SYSVAR(force_recovery),
9858
9814
DRIZZLE_SYSVAR(lock_wait_timeout),
9859
9815
#ifdef UNIV_LOG_ARCHIVE
9860
DRIZZLE_SYSVAR(log_arch_dir),
9861
9816
DRIZZLE_SYSVAR(log_archive),
9862
9817
#endif /* UNIV_LOG_ARCHIVE */
9863
9818
DRIZZLE_SYSVAR(log_buffer_size),
9864
9819
DRIZZLE_SYSVAR(log_file_size),
9865
9820
DRIZZLE_SYSVAR(log_files_in_group),
9866
DRIZZLE_SYSVAR(log_group_home_dir),
9867
9821
DRIZZLE_SYSVAR(max_dirty_pages_pct),
9868
9822
DRIZZLE_SYSVAR(max_purge_lag),
9869
9823
DRIZZLE_SYSVAR(mirrored_log_groups),
9880
9834
DRIZZLE_SYSVAR(table_locks),
9881
9835
DRIZZLE_SYSVAR(thread_concurrency),
9882
9836
DRIZZLE_SYSVAR(thread_sleep_delay),
9883
DRIZZLE_SYSVAR(version),
9884
9837
DRIZZLE_SYSVAR(change_buffering),
9885
9838
DRIZZLE_SYSVAR(read_ahead_threshold),
9886
9839
DRIZZLE_SYSVAR(io_capacity),