2827
2827
static bool innobase_create_status_file;
2828
2828
static bool srv_use_sys_malloc;
2829
2829
static string innobase_file_format_name;
2830
static unsigned long srv_max_buf_pool_modified_pct;
2831
static unsigned long srv_max_purge_lag;
2832
static unsigned long innobase_read_io_threads;
2833
static unsigned long innobase_write_io_threads;
2834
2830
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
2835
2831
static autoextend_constraint srv_auto_extend_increment;
2836
static unsigned long srv_n_spin_wait_rounds;
2837
2832
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
2838
2833
static buffer_pool_constraint innobase_buffer_pool_size;
2839
2834
typedef constrained_check<size_t, SIZE_MAX, 512, 1024> additional_mem_pool_constraint;
2857
2852
static log_buffer_size_constraint innobase_log_buffer_size;
2858
2853
typedef constrained_check<unsigned int, 97, 5> lru_old_blocks_constraint;
2859
2854
static lru_old_blocks_constraint innobase_lru_old_blocks_pct;
2855
typedef constrained_check<unsigned int, 99, 0> max_dirty_pages_constraint;
2856
static max_dirty_pages_constraint haildb_max_dirty_pages_pct;
2857
typedef constrained_check<uint64_t, UINT64_MAX, 0> uint64_constraint;
2858
static uint64_constraint haildb_max_purge_lag;
2859
static uint64_constraint haildb_sync_spin_loops;
2860
typedef constrained_check<uint32_t, UINT32_MAX, 10> open_files_constraint;
2861
static open_files_constraint haildb_open_files;
2862
typedef constrained_check<unsigned int, 64, 1> io_threads_constraint;
2863
static io_threads_constraint haildb_read_io_threads;
2864
static io_threads_constraint haildb_write_io_threads;
2860
2867
static uint32_t innobase_lru_block_access_recency;
2862
static long innobase_open_files;
2865
2871
static int haildb_file_format_name_validate(Session*, set_var *var)
2913
2931
srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
2916
if (vm.count("max-dirty-pages-pct"))
2918
if (srv_max_buf_pool_modified_pct > 99)
2920
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of max-dirty-pages-pct"));
2925
if (vm.count("max-purge-lag"))
2927
if (srv_max_purge_lag > (unsigned long)~0L)
2929
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of max-purge-lag"));
2934
if (vm.count("open-files"))
2936
if (innobase_open_files > LONG_MAX || innobase_open_files < 10L)
2938
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of open-files"));
2943
if (vm.count("read-io-threads"))
2945
if (innobase_read_io_threads > 64 || innobase_read_io_threads < 1)
2947
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of read-io-threads"));
2952
if (vm.count("sync-spin-loops"))
2954
if (srv_n_spin_wait_rounds > (unsigned long)~0L)
2956
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of sync_spin_loops"));
2963
2936
err= ib_init();
3019
2992
if (err != DB_SUCCESS)
3020
2993
goto haildb_error;
3022
err= ib_cfg_set_int("additional_mem_pool_size", static_cast<size_t>(innobase_additional_mem_pool_size));
3023
if (err != DB_SUCCESS)
3026
err= ib_cfg_set_int("autoextend_increment", static_cast<unsigned int>(srv_auto_extend_increment));
3027
if (err != DB_SUCCESS)
3030
err= ib_cfg_set_int("buffer_pool_size", static_cast<size_t>(innobase_buffer_pool_size));
3031
if (err != DB_SUCCESS)
3034
err= ib_cfg_set_int("io_capacity", static_cast<unsigned int>(srv_io_capacity));
2995
err= ib_cfg_set_int("additional_mem_pool_size", innobase_additional_mem_pool_size.get());
2996
if (err != DB_SUCCESS)
2999
err= ib_cfg_set_int("autoextend_increment", srv_auto_extend_increment.get());
3000
if (err != DB_SUCCESS)
3003
err= ib_cfg_set_int("buffer_pool_size", innobase_buffer_pool_size.get());
3004
if (err != DB_SUCCESS)
3007
err= ib_cfg_set_int("io_capacity", srv_io_capacity.get());
3035
3008
if (err != DB_SUCCESS)
3036
3009
goto haildb_error;
3081
3054
if (err != DB_SUCCESS)
3082
3055
goto haildb_error;
3084
err= ib_cfg_set_int("lock_wait_timeout", static_cast<unsigned int>(innobase_lock_wait_timeout));
3085
if (err != DB_SUCCESS)
3088
err= ib_cfg_set_int("max_dirty_pages_pct", srv_max_buf_pool_modified_pct);
3089
if (err != DB_SUCCESS)
3092
err= ib_cfg_set_int("max_purge_lag", srv_max_purge_lag);
3093
if (err != DB_SUCCESS)
3096
err= ib_cfg_set_int("open_files", innobase_open_files);
3097
if (err != DB_SUCCESS)
3100
err= ib_cfg_set_int("read_io_threads", innobase_read_io_threads);
3101
if (err != DB_SUCCESS)
3104
err= ib_cfg_set_int("write_io_threads", innobase_write_io_threads);
3105
if (err != DB_SUCCESS)
3108
err= ib_cfg_set_int("sync_spin_loops", srv_n_spin_wait_rounds);
3057
err= ib_cfg_set_int("lock_wait_timeout", innobase_lock_wait_timeout.get());
3058
if (err != DB_SUCCESS)
3061
err= ib_cfg_set_int("max_dirty_pages_pct", haildb_max_dirty_pages_pct.get());
3062
if (err != DB_SUCCESS)
3065
err= ib_cfg_set_int("max_purge_lag", haildb_max_purge_lag.get());
3066
if (err != DB_SUCCESS)
3069
err= ib_cfg_set_int("open_files", haildb_open_files.get());
3070
if (err != DB_SUCCESS)
3073
err= ib_cfg_set_int("read_io_threads", haildb_read_io_threads.get());
3074
if (err != DB_SUCCESS)
3077
err= ib_cfg_set_int("write_io_threads", haildb_write_io_threads.get());
3078
if (err != DB_SUCCESS)
3081
err= ib_cfg_set_int("sync_spin_loops", haildb_sync_spin_loops.get());
3109
3082
if (err != DB_SUCCESS)
3110
3083
goto haildb_error;
3144
3117
context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("fast_shutdown", innobase_fast_shutdown));
3145
3118
context.registerVariable(new sys_var_bool_ptr_readonly("file_per_table",
3146
3119
&srv_file_per_table));
3120
context.registerVariable(new sys_var_bool_ptr_readonly("rollback_on_timeout",
3121
&innobase_rollback_on_timeout));
3122
context.registerVariable(new sys_var_bool_ptr_readonly("print_verbose_log",
3123
&innobase_print_verbose_log));
3124
context.registerVariable(new sys_var_bool_ptr("status_file",
3125
&innobase_create_status_file,
3126
haildb_status_file_update));
3127
context.registerVariable(new sys_var_bool_ptr_readonly("use_sys_malloc",
3128
&srv_use_sys_malloc));
3147
3129
context.registerVariable(new sys_var_std_string("file_format",
3148
3130
innobase_file_format_name,
3149
3131
haildb_file_format_name_validate));
3161
3143
context.registerVariable(new sys_var_uint32_t_ptr("lru_block_access_recency",
3162
3144
&innobase_lru_block_access_recency,
3163
3145
haildb_lru_block_access_recency_update));
3146
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct", haildb_max_dirty_pages_pct));
3147
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", haildb_max_purge_lag));
3148
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("sync_spin_loops", haildb_sync_spin_loops));
3149
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("open_files", haildb_open_files));
3150
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("read_io_threads", haildb_read_io_threads));
3151
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("write_io_threads", haildb_write_io_threads));
3165
3153
haildb_datadict_dump_func_initialize(context);
3166
3154
config_table_function_initialize(context);
3197
static void haildb_status_file_update(Session*, drizzle_sys_var*,
3202
bool status_file_enabled;
3205
status_file_enabled= *static_cast<const bool*>(save);
3208
if (status_file_enabled)
3209
err= ib_cfg_set_bool_on("status_file");
3211
err= ib_cfg_set_bool_off("status_file");
3213
if (err == DB_SUCCESS)
3214
innobase_create_status_file= status_file_enabled;
3218
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
3219
PLUGIN_VAR_RQCMDARG,
3220
"Percentage of dirty pages allowed in bufferpool.",
3221
NULL, NULL, 75, 0, 99, 0);
3223
static DRIZZLE_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
3224
PLUGIN_VAR_RQCMDARG,
3225
"Desired maximum length of the purge queue (0 = no limit)",
3226
NULL, NULL, 0, 0, ~0L, 0);
3228
static DRIZZLE_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
3229
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
3230
"Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
3233
static DRIZZLE_SYSVAR_LONG(open_files, innobase_open_files,
3234
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3235
"How many files at the maximum HailDB keeps open at the same time.",
3236
NULL, NULL, 300L, 10L, LONG_MAX, 0);
3238
static DRIZZLE_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
3239
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3240
"Number of background read I/O threads in HailDB.",
3241
NULL, NULL, 4, 1, 64, 0);
3243
static DRIZZLE_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
3244
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3245
"Number of background write I/O threads in HailDB.",
3246
NULL, NULL, 4, 1, 64, 0);
3248
static DRIZZLE_SYSVAR_BOOL(print_verbose_log, innobase_print_verbose_log,
3249
PLUGIN_VAR_NOCMDARG,
3250
"Disable if you want to reduce the number of messages written to the log (default: enabled).",
3253
static DRIZZLE_SYSVAR_BOOL(status_file, innobase_create_status_file,
3254
PLUGIN_VAR_OPCMDARG,
3255
"Enable SHOW HAILDB STATUS output in the log",
3256
NULL, haildb_status_file_update, false);
3258
static DRIZZLE_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
3259
PLUGIN_VAR_RQCMDARG,
3260
"Count of spin-loop rounds in HailDB mutexes (30 by default)",
3261
NULL, NULL, 30L, 0L, ~0L, 0);
3263
static DRIZZLE_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
3264
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
3265
"Use OS memory allocator instead of HailDB's internal memory allocator",
3268
3185
static void init_options(drizzled::module::option_context &context)
3270
3187
context("disable-adaptive-hash-index",
3333
3250
po::value<uint32_t>(&innobase_lru_block_access_recency)->default_value(0),
3334
3251
N_("Milliseconds between accesses to a block at which it is made young. 0=disabled (Advanced users)"));
3335
3252
context("max-dirty-pages-pct",
3336
po::value<unsigned long>(&srv_max_buf_pool_modified_pct)->default_value(75),
3253
po::value<max_dirty_pages_constraint>(&haildb_max_dirty_pages_pct)->default_value(75),
3337
3254
N_("Percentage of dirty pages allowed in bufferpool."));
3338
3255
context("max-purge-lag",
3339
po::value<unsigned long>(&srv_max_purge_lag)->default_value(0),
3256
po::value<uint64_constraint>(&haildb_max_purge_lag)->default_value(0),
3340
3257
N_("Desired maximum length of the purge queue (0 = no limit)"));
3341
3258
context("rollback-on-timeout",
3342
3259
po::value<bool>(&innobase_rollback_on_timeout)->default_value(false)->zero_tokens(),
3343
3260
N_("Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)"));
3344
3261
context("open-files",
3345
po::value<long>(&innobase_open_files)->default_value(300),
3262
po::value<open_files_constraint>(&haildb_open_files)->default_value(300),
3346
3263
N_("How many files at the maximum HailDB keeps open at the same time."));
3347
3264
context("read-io-threads",
3348
po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
3265
po::value<io_threads_constraint>(&haildb_read_io_threads)->default_value(4),
3349
3266
N_("Number of background read I/O threads in HailDB."));
3350
3267
context("write-io-threads",
3351
po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
3268
po::value<io_threads_constraint>(&haildb_write_io_threads)->default_value(4),
3352
3269
N_("Number of background write I/O threads in HailDB."));
3353
3270
context("disable-print-verbose-log",
3354
3271
N_("Disable if you want to reduce the number of messages written to the log (default: enabled)."));
3356
3273
po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
3357
3274
N_("Enable SHOW HAILDB STATUS output in the log"));
3358
3275
context("sync-spin-loops",
3359
po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
3276
po::value<uint64_constraint>(&haildb_sync_spin_loops)->default_value(30L),
3360
3277
N_("Count of spin-loop rounds in HailDB mutexes (30 by default)"));
3361
3278
context("use-internal-malloc",
3362
3279
N_("Use HailDB's internal memory allocator instead of the OS memory allocator"));
3365
static drizzle_sys_var* innobase_system_variables[]= {
3366
DRIZZLE_SYSVAR(max_dirty_pages_pct),
3367
DRIZZLE_SYSVAR(max_purge_lag),
3368
DRIZZLE_SYSVAR(open_files),
3369
DRIZZLE_SYSVAR(read_io_threads),
3370
DRIZZLE_SYSVAR(rollback_on_timeout),
3371
DRIZZLE_SYSVAR(write_io_threads),
3372
DRIZZLE_SYSVAR(print_verbose_log),
3373
DRIZZLE_SYSVAR(status_file),
3374
DRIZZLE_SYSVAR(sync_spin_loops),
3375
DRIZZLE_SYSVAR(use_sys_malloc),
3379
3282
DRIZZLE_DECLARE_PLUGIN
3381
3284
DRIZZLE_VERSION_ID,