~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/haildb/haildb_engine.cc

  • Committer: Monty Taylor
  • Date: 2010-12-02 23:49:02 UTC
  • mto: (1975.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1976.
  • Revision ID: mordred@inaugust.com-20101202234902-jrvwwtjjbuoc3v3y
Updated memcached_stats plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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_lru_old_blocks_pct;
2833
 
static unsigned long innobase_lru_block_access_recency;
2834
 
static unsigned long innobase_read_io_threads;
2835
 
static unsigned long innobase_write_io_threads;
2836
2830
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
2837
2831
static autoextend_constraint srv_auto_extend_increment;
2838
 
static unsigned long innobase_lock_wait_timeout;
2839
 
static unsigned long srv_n_spin_wait_rounds;
2840
2832
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
2841
2833
static buffer_pool_constraint innobase_buffer_pool_size;
2842
2834
typedef constrained_check<size_t, SIZE_MAX, 512, 1024> additional_mem_pool_constraint;
2848
2840
static trinary_constraint srv_flush_log_at_trx_commit;
2849
2841
typedef constrained_check<uint16_t, 6, 0> force_recovery_constraint;
2850
2842
static force_recovery_constraint innobase_force_recovery;
 
2843
typedef constrained_check<int64_t, INT64_MAX, 1024*1024, 1024*1024> log_file_constraint;
 
2844
static log_file_constraint haildb_log_file_size;
 
2845
 
2851
2846
static io_capacity_constraint srv_io_capacity;
2852
 
 
2853
 
static long innobase_open_files;
2854
 
static long innobase_log_buffer_size;
2855
 
static char  default_haildb_data_file_path[]= "ibdata1:10M:autoextend";
2856
 
static char* haildb_data_file_path= NULL;
2857
 
 
2858
 
static int64_t haildb_log_file_size;
2859
 
static int64_t haildb_log_files_in_group;
 
2847
typedef constrained_check<unsigned int, 100, 2> log_files_in_group_constraint;
 
2848
static log_files_in_group_constraint haildb_log_files_in_group;
 
2849
typedef constrained_check<unsigned int, 1024*1024*1024, 1> lock_wait_constraint;
 
2850
static lock_wait_constraint innobase_lock_wait_timeout;
 
2851
typedef constrained_check<long, LONG_MAX, 256*1024, 1024> log_buffer_size_constraint;
 
2852
static log_buffer_size_constraint innobase_log_buffer_size;
 
2853
typedef constrained_check<unsigned int, 97, 5> lru_old_blocks_constraint;
 
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
static uint64_constraint haildb_max_purge_lag;
 
2858
static uint64_constraint haildb_sync_spin_loops;
 
2859
typedef constrained_check<uint32_t, UINT32_MAX, 10> open_files_constraint;
 
2860
static open_files_constraint haildb_open_files;
 
2861
typedef constrained_check<unsigned int, 64, 1> io_threads_constraint;
 
2862
static io_threads_constraint haildb_read_io_threads;
 
2863
static io_threads_constraint haildb_write_io_threads;
 
2864
 
 
2865
 
 
2866
static uint32_t innobase_lru_block_access_recency;
 
2867
 
 
2868
 
2860
2869
 
2861
2870
static int haildb_file_format_name_validate(Session*, set_var *var)
2862
2871
{
2876
2885
    return 1;
2877
2886
}
2878
2887
 
 
2888
static void haildb_lru_old_blocks_pct_update(Session*, sql_var_t)
 
2889
{
 
2890
  int ret= ib_cfg_set_int("lru_old_blocks_pct", static_cast<uint32_t>(innobase_lru_old_blocks_pct));
 
2891
  (void)ret;
 
2892
}
 
2893
 
 
2894
static void haildb_lru_block_access_recency_update(Session*, sql_var_t)
 
2895
{
 
2896
  int ret= ib_cfg_set_int("lru_block_access_recency", static_cast<uint32_t>(innobase_lru_block_access_recency));
 
2897
  (void)ret;
 
2898
}
 
2899
 
 
2900
static void haildb_status_file_update(Session*, sql_var_t)
 
2901
{
 
2902
  ib_err_t err;
 
2903
 
 
2904
  if (innobase_create_status_file)
 
2905
    err= ib_cfg_set_bool_on("status_file");
 
2906
  else
 
2907
    err= ib_cfg_set_bool_off("status_file");
 
2908
  (void)err;
 
2909
}
 
2910
 
 
2911
 
2879
2912
static int haildb_init(drizzled::module::Context &context)
2880
2913
{
2881
2914
  haildb_system_table_names.insert(std::string("HAILDB_SYS_TABLES"));
2896
2929
  innobase_print_verbose_log= (vm.count("disable-print-verbose-log")) ? false : true;
2897
2930
  srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
2898
2931
 
2899
 
  if (vm.count("log-file-size"))
2900
 
  {
2901
 
    if (haildb_log_file_size > INT64_MAX || haildb_log_file_size < 1*1024*1024L)
2902
 
    {
2903
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of log-file-size"));
2904
 
      return 1;
2905
 
    }
2906
 
    haildb_log_file_size/= 1024*1024L;
2907
 
    haildb_log_file_size*= 1024*1024L;
2908
 
  }
2909
 
 
2910
 
  if (vm.count("log-files-in-group"))
2911
 
  {
2912
 
    if (haildb_log_files_in_group > 100 || haildb_log_files_in_group < 2)
2913
 
    {
2914
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of log-files-in-group"));
2915
 
      return 1;
2916
 
    }
2917
 
  }
2918
 
 
2919
 
  if (vm.count("lock-wait-timeout"))
2920
 
  {
2921
 
    if (innobase_lock_wait_timeout > 1024*1024*1024 || innobase_lock_wait_timeout < 1)
2922
 
    {
2923
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of lock-wait-timeout"));
2924
 
      return 1;
2925
 
    }
2926
 
  }
2927
 
 
2928
 
  if (vm.count("log-buffer-size"))
2929
 
  {
2930
 
    if (innobase_log_buffer_size > LONG_MAX || innobase_log_buffer_size < 256*1024L)
2931
 
    {
2932
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of log-buffer-size"));
2933
 
      return 1;
2934
 
    }
2935
 
    innobase_log_buffer_size/= 1024;
2936
 
    innobase_log_buffer_size*= 1024;
2937
 
  }
2938
 
 
2939
 
  if (vm.count("lru-old-blocks-pct"))
2940
 
  {
2941
 
    if (innobase_lru_old_blocks_pct > 95 || innobase_lru_old_blocks_pct < 5)
2942
 
    {
2943
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of lru-old-blocks-pct"));
2944
 
      return 1;
2945
 
    }
2946
 
  }
2947
 
 
2948
 
  if (vm.count("lru-block-access-recency"))
2949
 
  {
2950
 
    if (innobase_lru_block_access_recency > ULONG_MAX)
2951
 
    {
2952
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of lru-block-access-recency"));
2953
 
      return 1;
2954
 
    }
2955
 
  }
2956
 
 
2957
 
  if (vm.count("max-dirty-pages-pct"))
2958
 
  {
2959
 
    if (srv_max_buf_pool_modified_pct > 99)
2960
 
    {
2961
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of max-dirty-pages-pct"));
2962
 
      return 1;
2963
 
    }
2964
 
  }
2965
 
 
2966
 
  if (vm.count("max-purge-lag"))
2967
 
  {
2968
 
    if (srv_max_purge_lag > (unsigned long)~0L)
2969
 
    {
2970
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of max-purge-lag"));
2971
 
      return 1;
2972
 
    }
2973
 
  }
2974
 
 
2975
 
  if (vm.count("open-files"))
2976
 
  {
2977
 
    if (innobase_open_files > LONG_MAX || innobase_open_files < 10L)
2978
 
    {
2979
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of open-files"));
2980
 
      return 1;
2981
 
    }
2982
 
  }
2983
 
 
2984
 
  if (vm.count("read-io-threads"))
2985
 
  {
2986
 
    if (innobase_read_io_threads > 64 || innobase_read_io_threads < 1)
2987
 
    {
2988
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of read-io-threads"));
2989
 
      return 1;
2990
 
    }
2991
 
  }
2992
 
 
2993
 
  if (vm.count("sync-spin-loops"))
2994
 
  {
2995
 
    if (srv_n_spin_wait_rounds > (unsigned long)~0L)
2996
 
    {
2997
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value of sync_spin_loops"));
2998
 
      return 1;
2999
 
    }
3000
 
  }
3001
 
 
3002
 
  if (vm.count("data-file-path"))
3003
 
  {
3004
 
    haildb_data_file_path= const_cast<char *>(vm["data-file-path"].as<string>().c_str());
3005
 
  }
3006
2932
 
3007
2933
  ib_err_t err;
3008
2934
 
3011
2937
    goto haildb_error;
3012
2938
 
3013
2939
 
3014
 
  if (vm.count("data-home-dir"))
 
2940
  if (not vm["data-home-dir"].as<string>().empty())
3015
2941
  {
3016
2942
    err= ib_cfg_set_text("data_home_dir", vm["data-home-dir"].as<string>().c_str());
3017
2943
    if (err != DB_SUCCESS)
3025
2951
      goto haildb_error;
3026
2952
  }
3027
2953
 
3028
 
  if (haildb_data_file_path == NULL)
3029
 
    haildb_data_file_path= default_haildb_data_file_path;
3030
 
 
3031
2954
  if (innobase_print_verbose_log)
3032
2955
    err= ib_cfg_set_bool_on("print_verbose_log");
3033
2956
  else
3068
2991
  if (err != DB_SUCCESS)
3069
2992
    goto haildb_error;
3070
2993
 
3071
 
  err= ib_cfg_set_int("additional_mem_pool_size", static_cast<size_t>(innobase_additional_mem_pool_size));
3072
 
  if (err != DB_SUCCESS)
3073
 
    goto haildb_error;
3074
 
 
3075
 
  err= ib_cfg_set_int("autoextend_increment", static_cast<unsigned int>(srv_auto_extend_increment));
3076
 
  if (err != DB_SUCCESS)
3077
 
    goto haildb_error;
3078
 
 
3079
 
  err= ib_cfg_set_int("buffer_pool_size", static_cast<size_t>(innobase_buffer_pool_size));
3080
 
  if (err != DB_SUCCESS)
3081
 
    goto haildb_error;
3082
 
 
3083
 
  err= ib_cfg_set_int("io_capacity", static_cast<unsigned int>(srv_io_capacity));
 
2994
  err= ib_cfg_set_int("additional_mem_pool_size", innobase_additional_mem_pool_size.get());
 
2995
  if (err != DB_SUCCESS)
 
2996
    goto haildb_error;
 
2997
 
 
2998
  err= ib_cfg_set_int("autoextend_increment", srv_auto_extend_increment.get());
 
2999
  if (err != DB_SUCCESS)
 
3000
    goto haildb_error;
 
3001
 
 
3002
  err= ib_cfg_set_int("buffer_pool_size", innobase_buffer_pool_size.get());
 
3003
  if (err != DB_SUCCESS)
 
3004
    goto haildb_error;
 
3005
 
 
3006
  err= ib_cfg_set_int("io_capacity", srv_io_capacity.get());
3084
3007
  if (err != DB_SUCCESS)
3085
3008
    goto haildb_error;
3086
3009
 
3093
3016
    goto haildb_error;
3094
3017
 
3095
3018
  err= ib_cfg_set_int("flush_log_at_trx_commit",
3096
 
                      static_cast<uint16_t>(srv_flush_log_at_trx_commit));
 
3019
                      srv_flush_log_at_trx_commit.get());
3097
3020
  if (err != DB_SUCCESS)
3098
3021
    goto haildb_error;
3099
3022
 
3106
3029
  }
3107
3030
 
3108
3031
  err= ib_cfg_set_int("force_recovery",
3109
 
                      static_cast<uint16_t>(innobase_force_recovery));
3110
 
  if (err != DB_SUCCESS)
3111
 
    goto haildb_error;
3112
 
 
3113
 
  err= ib_cfg_set_text("data_file_path", haildb_data_file_path);
3114
 
  if (err != DB_SUCCESS)
3115
 
    goto haildb_error;
3116
 
 
3117
 
  err= ib_cfg_set_int("log_file_size", haildb_log_file_size);
3118
 
  if (err != DB_SUCCESS)
3119
 
    goto haildb_error;
3120
 
 
3121
 
  err= ib_cfg_set_int("log_buffer_size", innobase_log_buffer_size);
3122
 
  if (err != DB_SUCCESS)
3123
 
    goto haildb_error;
3124
 
 
3125
 
  err= ib_cfg_set_int("log_files_in_group", haildb_log_files_in_group);
 
3032
                      innobase_force_recovery.get());
 
3033
  if (err != DB_SUCCESS)
 
3034
    goto haildb_error;
 
3035
 
 
3036
  err= ib_cfg_set_text("data_file_path", vm["data-file-path"].as<string>().c_str());
 
3037
  if (err != DB_SUCCESS)
 
3038
    goto haildb_error;
 
3039
 
 
3040
  err= ib_cfg_set_int("log_file_size", haildb_log_file_size.get());
 
3041
  if (err != DB_SUCCESS)
 
3042
    goto haildb_error;
 
3043
 
 
3044
  err= ib_cfg_set_int("log_buffer_size", innobase_log_buffer_size.get());
 
3045
  if (err != DB_SUCCESS)
 
3046
    goto haildb_error;
 
3047
 
 
3048
  err= ib_cfg_set_int("log_files_in_group", haildb_log_files_in_group.get());
3126
3049
  if (err != DB_SUCCESS)
3127
3050
    goto haildb_error;
3128
3051
 
3130
3053
  if (err != DB_SUCCESS)
3131
3054
    goto haildb_error;
3132
3055
 
3133
 
  err= ib_cfg_set_int("lock_wait_timeout", innobase_lock_wait_timeout);
3134
 
  if (err != DB_SUCCESS)
3135
 
    goto haildb_error;
3136
 
 
3137
 
  err= ib_cfg_set_int("max_dirty_pages_pct", srv_max_buf_pool_modified_pct);
3138
 
  if (err != DB_SUCCESS)
3139
 
    goto haildb_error;
3140
 
 
3141
 
  err= ib_cfg_set_int("max_purge_lag", srv_max_purge_lag);
3142
 
  if (err != DB_SUCCESS)
3143
 
    goto haildb_error;
3144
 
 
3145
 
  err= ib_cfg_set_int("open_files", innobase_open_files);
3146
 
  if (err != DB_SUCCESS)
3147
 
    goto haildb_error;
3148
 
 
3149
 
  err= ib_cfg_set_int("read_io_threads", innobase_read_io_threads);
3150
 
  if (err != DB_SUCCESS)
3151
 
    goto haildb_error;
3152
 
 
3153
 
  err= ib_cfg_set_int("write_io_threads", innobase_write_io_threads);
3154
 
  if (err != DB_SUCCESS)
3155
 
    goto haildb_error;
3156
 
 
3157
 
  err= ib_cfg_set_int("sync_spin_loops", srv_n_spin_wait_rounds);
 
3056
  err= ib_cfg_set_int("lock_wait_timeout", innobase_lock_wait_timeout.get());
 
3057
  if (err != DB_SUCCESS)
 
3058
    goto haildb_error;
 
3059
 
 
3060
  err= ib_cfg_set_int("max_dirty_pages_pct", haildb_max_dirty_pages_pct.get());
 
3061
  if (err != DB_SUCCESS)
 
3062
    goto haildb_error;
 
3063
 
 
3064
  err= ib_cfg_set_int("max_purge_lag", haildb_max_purge_lag.get());
 
3065
  if (err != DB_SUCCESS)
 
3066
    goto haildb_error;
 
3067
 
 
3068
  err= ib_cfg_set_int("open_files", haildb_open_files.get());
 
3069
  if (err != DB_SUCCESS)
 
3070
    goto haildb_error;
 
3071
 
 
3072
  err= ib_cfg_set_int("read_io_threads", haildb_read_io_threads.get());
 
3073
  if (err != DB_SUCCESS)
 
3074
    goto haildb_error;
 
3075
 
 
3076
  err= ib_cfg_set_int("write_io_threads", haildb_write_io_threads.get());
 
3077
  if (err != DB_SUCCESS)
 
3078
    goto haildb_error;
 
3079
 
 
3080
  err= ib_cfg_set_int("sync_spin_loops", haildb_sync_spin_loops.get());
3158
3081
  if (err != DB_SUCCESS)
3159
3082
    goto haildb_error;
3160
3083
 
3185
3108
                                                         &innobase_use_checksums));
3186
3109
  context.registerVariable(new sys_var_bool_ptr_readonly("doublewrite",
3187
3110
                                                         &innobase_use_doublewrite));
 
3111
  context.registerVariable(new sys_var_const_string_val("data_file_path",
 
3112
                                                vm["data-file-path"].as<string>()));
3188
3113
  context.registerVariable(new sys_var_const_string_val("data_home_dir",
3189
 
                                                vm.count("data-home-dir") ?  vm["data-home-dir"].as<string>() : ""));
 
3114
                                                vm["data-home-dir"].as<string>()));
3190
3115
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("io_capacity", srv_io_capacity));
3191
3116
  context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("fast_shutdown", innobase_fast_shutdown));
3192
3117
  context.registerVariable(new sys_var_bool_ptr_readonly("file_per_table",
3193
3118
                                                         &srv_file_per_table));
3194
 
  context.registerVariable(new sys_var_std_string("file-format",
 
3119
  context.registerVariable(new sys_var_bool_ptr_readonly("rollback_on_timeout",
 
3120
                                                         &innobase_rollback_on_timeout));
 
3121
  context.registerVariable(new sys_var_bool_ptr_readonly("print_verbose_log",
 
3122
                                                         &innobase_print_verbose_log));
 
3123
  context.registerVariable(new sys_var_bool_ptr("status_file",
 
3124
                                                &innobase_create_status_file,
 
3125
                                                haildb_status_file_update));
 
3126
  context.registerVariable(new sys_var_bool_ptr_readonly("use_sys_malloc",
 
3127
                                                         &srv_use_sys_malloc));
 
3128
  context.registerVariable(new sys_var_std_string("file_format",
3195
3129
                                                  innobase_file_format_name,
3196
3130
                                                  haildb_file_format_name_validate));
3197
3131
  context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("flush_log_at_trx_commit", srv_flush_log_at_trx_commit));
3200
3134
  context.registerVariable(new sys_var_constrained_value_readonly<uint16_t>("force_recovery", innobase_force_recovery));
3201
3135
  context.registerVariable(new sys_var_const_string_val("log_group_home_dir",
3202
3136
                                                vm.count("log-group-home-dir") ?  vm["log-group-home-dir"].as<string>() : ""));
 
3137
  context.registerVariable(new sys_var_constrained_value<int64_t>("log_file_size", haildb_log_file_size));
 
3138
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("log_files_in_group", haildb_log_files_in_group));
 
3139
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("lock_wait_timeout", innobase_lock_wait_timeout));
 
3140
  context.registerVariable(new sys_var_constrained_value_readonly<long>("log_buffer_size", innobase_log_buffer_size));
 
3141
  context.registerVariable(new sys_var_constrained_value<unsigned int>("lru_old_blocks_pct", innobase_lru_old_blocks_pct, haildb_lru_old_blocks_pct_update));
 
3142
  context.registerVariable(new sys_var_uint32_t_ptr("lru_block_access_recency",
 
3143
                                                    &innobase_lru_block_access_recency,
 
3144
                                                    haildb_lru_block_access_recency_update));
 
3145
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct", haildb_max_dirty_pages_pct));
 
3146
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("max_purge_lag", haildb_max_purge_lag));
 
3147
  context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("sync_spin_loops", haildb_sync_spin_loops));
 
3148
  context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("open_files", haildb_open_files));
 
3149
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("read_io_threads", haildb_read_io_threads));
 
3150
  context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("write_io_threads", haildb_write_io_threads));
3203
3151
 
3204
3152
  haildb_datadict_dump_func_initialize(context);
3205
3153
  config_table_function_initialize(context);
3218
3166
  ib_err_t err;
3219
3167
  ib_shutdown_t shutdown_flag= IB_SHUTDOWN_NORMAL;
3220
3168
 
3221
 
  if (static_cast<unsigned int>(innobase_fast_shutdown) == 1)
 
3169
  if (innobase_fast_shutdown.get() == 1)
3222
3170
    shutdown_flag= IB_SHUTDOWN_NO_IBUFMERGE_PURGE;
3223
 
  else if (static_cast<unsigned int>(innobase_fast_shutdown) == 2)
 
3171
  else if (innobase_fast_shutdown.get() == 2)
3224
3172
    shutdown_flag= IB_SHUTDOWN_NO_BUFPOOL_FLUSH;
3225
3173
 
3226
3174
  err= ib_shutdown(shutdown_flag);
3233
3181
}
3234
3182
 
3235
3183
 
3236
 
static void haildb_lru_old_blocks_pct_update(Session*, drizzle_sys_var*,
3237
 
                                             void *,
3238
 
                                             const void *save)
3239
 
 
3240
 
{
3241
 
  unsigned long pct;
3242
 
 
3243
 
  pct= *static_cast<const unsigned long*>(save);
3244
 
 
3245
 
  ib_err_t err= ib_cfg_set_int("lru_old_blocks_pct", pct);
3246
 
  if (err == DB_SUCCESS)
3247
 
    innobase_lru_old_blocks_pct= pct;
3248
 
}
3249
 
 
3250
 
static void haildb_lru_block_access_recency_update(Session*, drizzle_sys_var*,
3251
 
                                                   void *,
3252
 
                                                   const void *save)
3253
 
 
3254
 
{
3255
 
  unsigned long ms;
3256
 
 
3257
 
  ms= *static_cast<const unsigned long*>(save);
3258
 
 
3259
 
  ib_err_t err= ib_cfg_set_int("lru_block_access_recency", ms);
3260
 
 
3261
 
  if (err == DB_SUCCESS)
3262
 
    innobase_lru_block_access_recency= ms;
3263
 
}
3264
 
 
3265
 
static void haildb_status_file_update(Session*, drizzle_sys_var*,
3266
 
                                      void *,
3267
 
                                      const void *save)
3268
 
 
3269
 
{
3270
 
  bool status_file_enabled;
3271
 
  ib_err_t err;
3272
 
 
3273
 
  status_file_enabled= *static_cast<const bool*>(save);
3274
 
 
3275
 
 
3276
 
  if (status_file_enabled)
3277
 
    err= ib_cfg_set_bool_on("status_file");
3278
 
  else
3279
 
    err= ib_cfg_set_bool_off("status_file");
3280
 
 
3281
 
  if (err == DB_SUCCESS)
3282
 
    innobase_create_status_file= status_file_enabled;
3283
 
}
3284
 
 
3285
 
static DRIZZLE_SYSVAR_STR(data_file_path, haildb_data_file_path,
3286
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3287
 
  "Path to individual files and their sizes.",
3288
 
  NULL, NULL, NULL);
3289
 
 
3290
 
static DRIZZLE_SYSVAR_LONGLONG(log_file_size, haildb_log_file_size,
3291
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3292
 
  "Size of each log file in a log group.",
3293
 
  NULL, NULL, 20*1024*1024L, 1*1024*1024L, INT64_MAX, 1024*1024L);
3294
 
 
3295
 
static DRIZZLE_SYSVAR_LONGLONG(log_files_in_group, haildb_log_files_in_group,
3296
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3297
 
  "Number of log files in the log group. HailDB writes to the files in a circular fashion. Value 3 is recommended here.",
3298
 
  NULL, NULL, 2, 2, 100, 0);
3299
 
 
3300
 
static DRIZZLE_SYSVAR_ULONG(lock_wait_timeout, innobase_lock_wait_timeout,
3301
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3302
 
  "Timeout in seconds an HailDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.",
3303
 
  NULL, NULL, 5, 1, 1024 * 1024 * 1024, 0);
3304
 
 
3305
 
static DRIZZLE_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size,
3306
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3307
 
  "The size of the buffer which HailDB uses to write log to the log files on disk.",
3308
 
  NULL, NULL, 8*1024*1024L, 256*1024L, LONG_MAX, 1024);
3309
 
 
3310
 
static DRIZZLE_SYSVAR_ULONG(lru_old_blocks_pct, innobase_lru_old_blocks_pct,
3311
 
  PLUGIN_VAR_RQCMDARG,
3312
 
  "Sets the point in the LRU list from where all pages are classified as "
3313
 
  "old (Advanced users)",
3314
 
  NULL,
3315
 
  haildb_lru_old_blocks_pct_update, 37, 5, 95, 0);
3316
 
 
3317
 
static DRIZZLE_SYSVAR_ULONG(lru_block_access_recency, innobase_lru_block_access_recency,
3318
 
  PLUGIN_VAR_RQCMDARG,
3319
 
  "Milliseconds between accesses to a block at which it is made young. "
3320
 
  "0=disabled (Advanced users)",
3321
 
  NULL,
3322
 
  haildb_lru_block_access_recency_update, 0, 0, ULONG_MAX, 0);
3323
 
 
3324
 
 
3325
 
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
3326
 
  PLUGIN_VAR_RQCMDARG,
3327
 
  "Percentage of dirty pages allowed in bufferpool.",
3328
 
  NULL, NULL, 75, 0, 99, 0);
3329
 
 
3330
 
static DRIZZLE_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
3331
 
  PLUGIN_VAR_RQCMDARG,
3332
 
  "Desired maximum length of the purge queue (0 = no limit)",
3333
 
  NULL, NULL, 0, 0, ~0L, 0);
3334
 
 
3335
 
static DRIZZLE_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
3336
 
  PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
3337
 
  "Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
3338
 
  NULL, NULL, false);
3339
 
 
3340
 
static DRIZZLE_SYSVAR_LONG(open_files, innobase_open_files,
3341
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3342
 
  "How many files at the maximum HailDB keeps open at the same time.",
3343
 
  NULL, NULL, 300L, 10L, LONG_MAX, 0);
3344
 
 
3345
 
static DRIZZLE_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
3346
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3347
 
  "Number of background read I/O threads in HailDB.",
3348
 
  NULL, NULL, 4, 1, 64, 0);
3349
 
 
3350
 
static DRIZZLE_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
3351
 
  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
3352
 
  "Number of background write I/O threads in HailDB.",
3353
 
  NULL, NULL, 4, 1, 64, 0);
3354
 
 
3355
 
static DRIZZLE_SYSVAR_BOOL(print_verbose_log, innobase_print_verbose_log,
3356
 
  PLUGIN_VAR_NOCMDARG,
3357
 
  "Disable if you want to reduce the number of messages written to the log (default: enabled).",
3358
 
  NULL, NULL, true);
3359
 
 
3360
 
static DRIZZLE_SYSVAR_BOOL(status_file, innobase_create_status_file,
3361
 
  PLUGIN_VAR_OPCMDARG,
3362
 
  "Enable SHOW HAILDB STATUS output in the log",
3363
 
  NULL, haildb_status_file_update, false);
3364
 
 
3365
 
static DRIZZLE_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
3366
 
  PLUGIN_VAR_RQCMDARG,
3367
 
  "Count of spin-loop rounds in HailDB mutexes (30 by default)",
3368
 
  NULL, NULL, 30L, 0L, ~0L, 0);
3369
 
 
3370
 
static DRIZZLE_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
3371
 
  PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
3372
 
  "Use OS memory allocator instead of HailDB's internal memory allocator",
3373
 
  NULL, NULL, true);
3374
 
 
3375
3184
static void init_options(drizzled::module::option_context &context)
3376
3185
{
3377
3186
  context("disable-adaptive-hash-index",
3388
3197
          po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
3389
3198
          N_("The size of the memory buffer HailDB uses to cache data and indexes of its tables."));
3390
3199
  context("data-home-dir",
3391
 
          po::value<string>(),
 
3200
          po::value<string>()->default_value(""),
3392
3201
          N_("The common part for HailDB table spaces."));
3393
3202
  context("disable-checksums",
3394
3203
          N_("Disable HailDB checksums validation (enabled by default)."));
3416
3225
          po::value<force_recovery_constraint>(&innobase_force_recovery)->default_value(0),
3417
3226
          N_("Helps to save your data in case the disk image of the database becomes corrupt."));
3418
3227
  context("data-file-path",
3419
 
          po::value<string>(),
 
3228
          po::value<string>()->default_value("ibdata1:10M:autoextend"),
3420
3229
          N_("Path to individual files and their sizes."));
3421
3230
  context("log-group-home-dir",
3422
3231
          po::value<string>(),
3423
3232
          N_("Path to HailDB log files."));
3424
3233
  context("log-file-size",
3425
 
          po::value<int64_t>(&haildb_log_file_size)->default_value(20*1024*1024L),
 
3234
          po::value<log_file_constraint>(&haildb_log_file_size)->default_value(20*1024*1024L),
3426
3235
          N_("Size of each log file in a log group."));
3427
3236
  context("haildb-log-files-in-group",
3428
 
          po::value<int64_t>(&haildb_log_files_in_group)->default_value(2),
 
3237
          po::value<log_files_in_group_constraint>(&haildb_log_files_in_group)->default_value(2),
3429
3238
          N_("Number of log files in the log group. HailDB writes to the files in a circular fashion. Value 3 is recommended here."));
3430
3239
  context("lock-wait-timeout",
3431
 
          po::value<unsigned long>(&innobase_lock_wait_timeout)->default_value(5),
 
3240
          po::value<lock_wait_constraint>(&innobase_lock_wait_timeout)->default_value(5),
3432
3241
          N_("Timeout in seconds an HailDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout."));
3433
3242
  context("log-buffer-size",
3434
 
        po::value<long>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
 
3243
        po::value<log_buffer_size_constraint>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
3435
3244
        N_("The size of the buffer which HailDB uses to write log to the log files on disk."));
3436
3245
  context("lru-old-blocks-pct",
3437
 
          po::value<unsigned long>(&innobase_lru_old_blocks_pct)->default_value(37),
 
3246
          po::value<lru_old_blocks_constraint>(&innobase_lru_old_blocks_pct)->default_value(37),
3438
3247
          N_("Sets the point in the LRU list from where all pages are classified as old (Advanced users)"));
3439
3248
  context("lru-block-access-recency",
3440
 
          po::value<unsigned long>(&innobase_lru_block_access_recency)->default_value(0),
 
3249
          po::value<uint32_t>(&innobase_lru_block_access_recency)->default_value(0),
3441
3250
          N_("Milliseconds between accesses to a block at which it is made young. 0=disabled (Advanced users)"));
3442
3251
  context("max-dirty-pages-pct",
3443
 
          po::value<unsigned long>(&srv_max_buf_pool_modified_pct)->default_value(75),
 
3252
          po::value<max_dirty_pages_constraint>(&haildb_max_dirty_pages_pct)->default_value(75),
3444
3253
          N_("Percentage of dirty pages allowed in bufferpool."));
3445
3254
  context("max-purge-lag",
3446
 
          po::value<unsigned long>(&srv_max_purge_lag)->default_value(0),
 
3255
          po::value<uint64_constraint>(&haildb_max_purge_lag)->default_value(0),
3447
3256
          N_("Desired maximum length of the purge queue (0 = no limit)"));
3448
3257
  context("rollback-on-timeout",
3449
3258
          po::value<bool>(&innobase_rollback_on_timeout)->default_value(false)->zero_tokens(),
3450
3259
          N_("Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)"));
3451
3260
  context("open-files",
3452
 
          po::value<long>(&innobase_open_files)->default_value(300),
 
3261
          po::value<open_files_constraint>(&haildb_open_files)->default_value(300),
3453
3262
          N_("How many files at the maximum HailDB keeps open at the same time."));
3454
3263
  context("read-io-threads",
3455
 
          po::value<unsigned long>(&innobase_read_io_threads)->default_value(4),
 
3264
          po::value<io_threads_constraint>(&haildb_read_io_threads)->default_value(4),
3456
3265
          N_("Number of background read I/O threads in HailDB."));
3457
3266
  context("write-io-threads",
3458
 
          po::value<unsigned long>(&innobase_write_io_threads)->default_value(4),
 
3267
          po::value<io_threads_constraint>(&haildb_write_io_threads)->default_value(4),
3459
3268
          N_("Number of background write I/O threads in HailDB."));
3460
3269
  context("disable-print-verbose-log",
3461
3270
          N_("Disable if you want to reduce the number of messages written to the log (default: enabled)."));
3463
3272
          po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
3464
3273
          N_("Enable SHOW HAILDB STATUS output in the log"));
3465
3274
  context("sync-spin-loops",
3466
 
          po::value<unsigned long>(&srv_n_spin_wait_rounds)->default_value(30L),
 
3275
          po::value<uint64_constraint>(&haildb_sync_spin_loops)->default_value(30L),
3467
3276
          N_("Count of spin-loop rounds in HailDB mutexes (30 by default)"));
3468
3277
  context("use-internal-malloc",
3469
3278
          N_("Use HailDB's internal memory allocator instead of the OS memory allocator"));
3470
3279
}
3471
3280
 
3472
 
static drizzle_sys_var* innobase_system_variables[]= {
3473
 
  DRIZZLE_SYSVAR(data_file_path),
3474
 
  DRIZZLE_SYSVAR(lock_wait_timeout),
3475
 
  DRIZZLE_SYSVAR(log_file_size),
3476
 
  DRIZZLE_SYSVAR(log_files_in_group),
3477
 
  DRIZZLE_SYSVAR(log_buffer_size),
3478
 
  DRIZZLE_SYSVAR(lru_old_blocks_pct),
3479
 
  DRIZZLE_SYSVAR(lru_block_access_recency),
3480
 
  DRIZZLE_SYSVAR(max_dirty_pages_pct),
3481
 
  DRIZZLE_SYSVAR(max_purge_lag),
3482
 
  DRIZZLE_SYSVAR(open_files),
3483
 
  DRIZZLE_SYSVAR(read_io_threads),
3484
 
  DRIZZLE_SYSVAR(rollback_on_timeout),
3485
 
  DRIZZLE_SYSVAR(write_io_threads),
3486
 
  DRIZZLE_SYSVAR(print_verbose_log),
3487
 
  DRIZZLE_SYSVAR(status_file),
3488
 
  DRIZZLE_SYSVAR(sync_spin_loops),
3489
 
  DRIZZLE_SYSVAR(use_sys_malloc),
3490
 
  NULL
3491
 
};
3492
 
 
3493
3281
DRIZZLE_DECLARE_PLUGIN
3494
3282
{
3495
3283
  DRIZZLE_VERSION_ID,
3499
3287
  "Transactional Storage Engine using the HailDB Library",
3500
3288
  PLUGIN_LICENSE_GPL,
3501
3289
  haildb_init,     /* Plugin Init */
3502
 
  innobase_system_variables, /* system variables */
 
3290
  NULL, /* system variables */
3503
3291
  init_options                /* config options   */
3504
3292
}
3505
3293
DRIZZLE_DECLARE_PLUGIN_END;