170
173
static plugin::TableFunction* innodb_trx_tool= NULL;
171
174
static plugin::TableFunction* innodb_locks_tool= NULL;
172
175
static plugin::TableFunction* innodb_lock_waits_tool= NULL;
173
static plugin::TableFunction* innodb_sys_tables_tool= NULL;
174
static plugin::TableFunction* innodb_sys_tablestats_tool= NULL;
176
static plugin::TableFunction* innodb_sys_indexes_tool= NULL;
177
static plugin::TableFunction* innodb_sys_columns_tool= NULL;
178
static plugin::TableFunction* innodb_sys_fields_tool= NULL;
179
static plugin::TableFunction* innodb_sys_foreign_tool= NULL;
180
static plugin::TableFunction* innodb_sys_foreign_cols_tool= NULL;
182
static ReplicationLog *replication_logger= NULL;
183
typedef constrained_check<uint32_t, UINT32_MAX, 10> open_files_constraint;
184
static open_files_constraint innobase_open_files;
185
typedef constrained_check<uint32_t, 10, 1> mirrored_log_groups_constraint;
186
static mirrored_log_groups_constraint innobase_mirrored_log_groups;
187
typedef constrained_check<uint32_t, 100, 2> log_files_in_group_constraint;
188
static log_files_in_group_constraint innobase_log_files_in_group;
189
typedef constrained_check<uint32_t, 6, 0> force_recovery_constraint;
190
force_recovery_constraint innobase_force_recovery;
191
typedef constrained_check<size_t, SIZE_MAX, 256*1024, 1024> log_buffer_constraint;
192
static log_buffer_constraint innobase_log_buffer_size;
193
typedef constrained_check<size_t, SIZE_MAX, 512*1024, 1024> additional_mem_pool_constraint;
194
static additional_mem_pool_constraint innobase_additional_mem_pool_size;
195
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
196
static autoextend_constraint innodb_auto_extend_increment;
197
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
198
static buffer_pool_constraint innobase_buffer_pool_size;
199
typedef constrained_check<uint32_t, MAX_BUFFER_POOLS, 1> buffer_pool_instances_constraint;
200
static buffer_pool_instances_constraint innobase_buffer_pool_instances;
201
typedef constrained_check<uint32_t, UINT32_MAX, 100> io_capacity_constraint;
202
static io_capacity_constraint innodb_io_capacity;
203
typedef constrained_check<uint32_t, 5000, 1> purge_batch_constraint;
204
static purge_batch_constraint innodb_purge_batch_size;
205
typedef constrained_check<uint32_t, 1, 0> purge_threads_constraint;
206
static purge_threads_constraint innodb_n_purge_threads;
207
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
208
static trinary_constraint innodb_flush_log_at_trx_commit;
209
typedef constrained_check<unsigned int, 99, 0> max_dirty_pages_constraint;
210
static max_dirty_pages_constraint innodb_max_dirty_pages_pct;
211
static uint64_constraint innodb_max_purge_lag;
212
static uint64_nonzero_constraint innodb_stats_sample_pages;
213
typedef constrained_check<uint32_t, 64, 1> io_threads_constraint;
214
static io_threads_constraint innobase_read_io_threads;
215
static io_threads_constraint innobase_write_io_threads;
217
typedef constrained_check<uint32_t, 1000, 0> concurrency_constraint;
218
static concurrency_constraint innobase_commit_concurrency;
219
static concurrency_constraint innobase_thread_concurrency;
220
static uint32_nonzero_constraint innodb_concurrency_tickets;
222
typedef constrained_check<int64_t, INT64_MAX, 1024*1024, 1024*1024> log_file_constraint;
223
static log_file_constraint innobase_log_file_size;
225
static uint64_constraint innodb_replication_delay;
227
/** Percentage of the buffer pool to reserve for 'old' blocks.
228
Connected to buf_LRU_old_ratio. */
229
typedef constrained_check<uint32_t, 95, 5> old_blocks_constraint;
230
static old_blocks_constraint innobase_old_blocks_pct;
232
static uint32_constraint innodb_sync_spin_loops;
233
static uint32_constraint innodb_spin_wait_delay;
234
static uint32_constraint innodb_thread_sleep_delay;
236
typedef constrained_check<uint32_t, 64, 0> read_ahead_threshold_constraint;
237
static read_ahead_threshold_constraint innodb_read_ahead_threshold;
177
static const long AUTOINC_OLD_STYLE_LOCKING = 0;
178
static const long AUTOINC_NEW_STYLE_LOCKING = 1;
179
static const long AUTOINC_NO_LOCKING = 2;
181
static long innobase_mirrored_log_groups, innobase_log_files_in_group,
182
innobase_log_buffer_size,
183
innobase_additional_mem_pool_size, innobase_file_io_threads,
184
innobase_force_recovery, innobase_open_files,
185
innobase_autoinc_lock_mode;
186
static ulong innobase_commit_concurrency = 0;
187
static ulong innobase_read_io_threads;
188
static ulong innobase_write_io_threads;
191
* @TODO: Turn this into size_t as soon as we have a Variable<size_t>
193
static int64_t innobase_buffer_pool_size, innobase_log_file_size;
239
195
/* The default values for the following char* start-up parameters
240
196
are determined in innobase_init below: */
242
std::string innobase_data_home_dir;
243
std::string innobase_data_file_path;
244
std::string innobase_log_group_home_dir;
245
static string innobase_file_format_name;
246
static string innobase_change_buffering;
248
/* The highest file format being used in the database. The value can be
249
set by user, however, it will be adjusted to the newer file format if
250
a table of such format is created/opened. */
251
static string innobase_file_format_max;
198
static char* innobase_data_home_dir = NULL;
199
static char* innobase_data_file_path = NULL;
200
static char* innobase_log_group_home_dir = NULL;
201
static char* innobase_file_format_name = NULL;
202
static char* innobase_change_buffering = NULL;
204
/* Note: This variable can be set to on/off and any of the supported
205
file formats in the configuration file, but can only be set to any
206
of the supported file formats during runtime. */
207
static char* innobase_file_format_check = NULL;
209
/* The following has a misleading name: starting from 4.0.5, this also
211
static char* innobase_unix_file_flush_method = NULL;
253
213
/* Below we have boolean-valued start-up parameters, and their default
256
typedef constrained_check<uint16_t, 2, 0> trinary_constraint;
257
static trinary_constraint innobase_fast_shutdown;
259
/* "innobase_file_format_check" decides whether we would continue
260
booting the server if the file format stamped on the system
261
table space exceeds the maximum file format supported
262
by the server. Can be set during server startup at command
263
line or configure file, and a read only variable after
266
/* If a new file format is introduced, the file format
267
name needs to be updated accordingly. Please refer to
268
file_format_name_map[] defined in trx0sys.c for the next
271
static my_bool innobase_file_format_check = TRUE;
216
static ulong innobase_fast_shutdown = 1;
217
#ifdef UNIV_LOG_ARCHIVE
218
static my_bool innobase_log_archive = FALSE;
219
static char* innobase_log_arch_dir = NULL;
220
#endif /* UNIV_LOG_ARCHIVE */
272
221
static my_bool innobase_use_doublewrite = TRUE;
273
222
static my_bool innobase_use_checksums = TRUE;
274
223
static my_bool innobase_rollback_on_timeout = FALSE;
275
224
static my_bool innobase_create_status_file = FALSE;
276
static bool innobase_use_replication_log;
277
static bool support_xa;
278
static bool strict_mode;
279
typedef constrained_check<uint32_t, 1024*1024*1024, 1> lock_wait_constraint;
280
static lock_wait_constraint lock_wait_timeout;
225
static my_bool innobase_stats_on_metadata = TRUE;
282
227
static char* internal_innobase_data_file_path = NULL;
229
static char* innodb_version_str = (char*) INNODB_VERSION_STR;
284
231
/* The following counter is used to convey information to InnoDB
285
232
about server activity: in selects it is not sensible to call
286
233
srv_active_wake_master_thread after each fetch or search, we only do
2987
2640
/********************************************************************//**
2988
Get the upper limit of the MySQL integral and floating-point type.
2989
@return maximum allowed value for the field */
2992
innobase_get_int_col_max_value(
2993
/*===========================*/
2994
const Field* field) /*!< in: MySQL field */
2996
uint64_t max_value = 0;
2998
switch(field->key_type()) {
3000
case HA_KEYTYPE_BINARY:
3001
max_value = 0xFFULL;
3004
case HA_KEYTYPE_ULONG_INT:
3005
max_value = 0xFFFFFFFFULL;
3007
case HA_KEYTYPE_LONG_INT:
3008
max_value = 0x7FFFFFFFULL;
3011
case HA_KEYTYPE_ULONGLONG:
3012
max_value = 0xFFFFFFFFFFFFFFFFULL;
3014
case HA_KEYTYPE_LONGLONG:
3015
max_value = 0x7FFFFFFFFFFFFFFFULL;
3017
case HA_KEYTYPE_DOUBLE:
3018
/* We use the maximum as per IEEE754-2008 standard, 2^53 */
3019
max_value = 0x20000000000000ULL;
3028
/*******************************************************************//**
3029
This function checks whether the index column information
3030
is consistent between KEY info from mysql and that from innodb index.
3031
@return TRUE if all column types match. */
3034
innobase_match_index_columns(
3035
/*=========================*/
3036
const KeyInfo* key_info, /*!< in: Index info
3038
const dict_index_t* index_info) /*!< in: Index info
3041
const KeyPartInfo* key_part;
3042
const KeyPartInfo* key_end;
3043
const dict_field_t* innodb_idx_fld;
3044
const dict_field_t* innodb_idx_fld_end;
3046
/* Check whether user defined index column count matches */
3047
if (key_info->key_parts != index_info->n_user_defined_cols) {
3051
key_part = key_info->key_part;
3052
key_end = key_part + key_info->key_parts;
3053
innodb_idx_fld = index_info->fields;
3054
innodb_idx_fld_end = index_info->fields + index_info->n_fields;
3056
/* Check each index column's datatype. We do not check
3057
column name because there exists case that index
3058
column name got modified in mysql but such change does not
3059
propagate to InnoDB.
3060
One hidden assumption here is that the index column sequences
3061
are matched up between those in mysql and Innodb. */
3062
for (; key_part != key_end; ++key_part) {
3065
ulint mtype = innodb_idx_fld->col->mtype;
3067
/* Need to translate to InnoDB column type before
3069
col_type = get_innobase_type_from_mysql_type(&is_unsigned,
3072
/* Ignore Innodb specific system columns. */
3073
while (mtype == DATA_SYS) {
3076
if (innodb_idx_fld >= innodb_idx_fld_end) {
3081
if (col_type != mtype) {
3082
/* Column Type mismatches */
3092
/*******************************************************************//**
3093
This function builds a translation table in INNOBASE_SHARE
3094
structure for fast index location with mysql array number from its
3095
table->key_info structure. This also provides the necessary translation
3096
between the key order in mysql key_info and Innodb ib_table->indexes if
3097
they are not fully matched with each other.
3098
Note we do not have any mutex protecting the translation table
3099
building based on the assumption that there is no concurrent
3100
index creation/drop and DMLs that requires index lookup. All table
3101
handle will be closed before the index creation/drop.
3102
@return TRUE if index translation table built successfully */
3105
innobase_build_index_translation(
3106
/*=============================*/
3107
const Table* table, /*!< in: table in MySQL data
3109
dict_table_t* ib_table, /*!< in: table in Innodb data
3111
INNOBASE_SHARE* share) /*!< in/out: share structure
3112
where index translation table
3113
will be constructed in. */
3115
ulint mysql_num_index;
3117
dict_index_t** index_mapping;
3120
mutex_enter(&dict_sys->mutex);
3122
mysql_num_index = table->getShare()->keys;
3123
ib_num_index = UT_LIST_GET_LEN(ib_table->indexes);
3125
index_mapping = share->idx_trans_tbl.index_mapping;
3127
/* If there exists inconsistency between MySQL and InnoDB dictionary
3128
(metadata) information, the number of index defined in MySQL
3129
could exceed that in InnoDB, do not build index translation
3130
table in such case */
3131
if (UNIV_UNLIKELY(ib_num_index < mysql_num_index)) {
3136
/* If index entry count is non-zero, nothing has
3137
changed since last update, directly return TRUE */
3138
if (share->idx_trans_tbl.index_count) {
3139
/* Index entry count should still match mysql_num_index */
3140
ut_a(share->idx_trans_tbl.index_count == mysql_num_index);
3144
/* The number of index increased, rebuild the mapping table */
3145
if (mysql_num_index > share->idx_trans_tbl.array_size) {
3146
index_mapping = (dict_index_t**) realloc(index_mapping,
3148
sizeof(*index_mapping));
3150
if (!index_mapping) {
3151
/* Report an error if index_mapping continues to be
3152
NULL and mysql_num_index is a non-zero value */
3153
errmsg_printf(ERRMSG_LVL_ERROR,
3154
"InnoDB: fail to allocate memory for "
3155
"index translation table. Number of "
3156
"Index:%lu, array size:%lu",
3158
share->idx_trans_tbl.array_size);
3163
share->idx_trans_tbl.array_size = mysql_num_index;
3166
/* For each index in the mysql key_info array, fetch its
3167
corresponding InnoDB index pointer into index_mapping
3169
for (ulint count = 0; count < mysql_num_index; count++) {
3171
/* Fetch index pointers into index_mapping according to mysql
3173
index_mapping[count] = dict_table_get_index_on_name(
3174
ib_table, table->key_info[count].name);
3176
if (!index_mapping[count]) {
3177
errmsg_printf(ERRMSG_LVL_ERROR, "Cannot find index %s in InnoDB "
3178
"index dictionary.",
3179
table->key_info[count].name);
3184
/* Double check fetched index has the same
3185
column info as those in mysql key_info. */
3186
if (!innobase_match_index_columns(&table->key_info[count],
3187
index_mapping[count])) {
3188
errmsg_printf(ERRMSG_LVL_ERROR, "Found index %s whose column info "
3189
"does not match that of MySQL.",
3190
table->key_info[count].name);
3196
/* Successfully built the translation table */
3197
share->idx_trans_tbl.index_count = mysql_num_index;
3201
/* Build translation table failed. */
3202
free(index_mapping);
3204
share->idx_trans_tbl.array_size = 0;
3205
share->idx_trans_tbl.index_count = 0;
3206
index_mapping = NULL;
3209
share->idx_trans_tbl.index_mapping = index_mapping;
3211
mutex_exit(&dict_sys->mutex);
3216
/*******************************************************************//**
3217
This function uses index translation table to quickly locate the
3218
requested index structure.
3219
Note we do not have mutex protection for the index translatoin table
3220
access, it is based on the assumption that there is no concurrent
3221
translation table rebuild (fter create/drop index) and DMLs that
3222
require index lookup.
3223
@return dict_index_t structure for requested index. NULL if
3224
fail to locate the index structure. */
3227
innobase_index_lookup(
3228
/*==================*/
3229
INNOBASE_SHARE* share, /*!< in: share structure for index
3230
translation table. */
3231
uint keynr) /*!< in: index number for the requested
3234
if (!share->idx_trans_tbl.index_mapping
3235
|| keynr >= share->idx_trans_tbl.index_count) {
3239
return(share->idx_trans_tbl.index_mapping[keynr]);
3242
/********************************************************************//**
3243
2641
Set the autoinc column max value. This should only be called once from
3244
ha_innobase::open(). Therefore there's no need for a covering lock. */
2642
ha_innobase::open(). Therefore there's no need for a covering lock.
2643
@return DB_SUCCESS or error code */
3247
2646
ha_innobase::innobase_initialize_autoinc()
3248
2647
/*======================================*/
2649
dict_index_t* index;
3250
2650
uint64_t auto_inc;
3251
const Field* field = getTable()->found_next_number_field;
3253
if (field != NULL) {
3254
auto_inc = innobase_get_int_col_max_value(field);
3256
/* We have no idea what's been passed in to us as the
3257
autoinc column. We set it to the 0, effectively disabling
3258
updates to the table. */
2651
const char* col_name;
2654
col_name = table->found_next_number_field->field_name;
2655
index = innobase_get_index(table->s->next_number_index);
2657
/* Execute SELECT MAX(col_name) FROM TABLE; */
2658
error = row_search_max_autoinc(index, col_name, &auto_inc);
2663
/* At the this stage we don't know the increment
2664
or the offset, so use default inrement of 1. */
2668
case DB_RECORD_NOT_FOUND:
3261
2669
ut_print_timestamp(stderr);
3262
fprintf(stderr, " InnoDB: Unable to determine the AUTOINC "
3266
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
3267
/* If the recovery level is set so high that writes
3268
are disabled we force the AUTOINC counter to 0
3269
value effectively disabling writes to the table.
3270
Secondly, we avoid reading the table in case the read
3271
results in failure due to a corrupted table/index.
3273
We will not return an error to the client, so that the
3274
tables can be dumped with minimal hassle. If an error
3275
were returned in this case, the first attempt to read
3276
the table would fail and subsequent SELECTs would succeed. */
3278
} else if (field == NULL) {
3279
/* This is a far more serious error, best to avoid
3280
opening the table and return failure. */
3281
my_error(ER_AUTOINC_READ_FAILED, MYF(0));
3283
dict_index_t* index;
3284
const char* col_name;
3285
uint64_t read_auto_inc;
3288
update_session(getTable()->in_use);
3289
col_name = field->field_name;
3291
ut_a(prebuilt->trx == session_to_trx(user_session));
3293
index = innobase_get_index(getTable()->getShare()->next_number_index);
3295
/* Execute SELECT MAX(col_name) FROM TABLE; */
3296
err = row_search_max_autoinc(index, col_name, &read_auto_inc);
3300
uint64_t col_max_value;
3302
col_max_value = innobase_get_int_col_max_value(field);
3304
/* At the this stage we do not know the increment
3305
nor the offset, so use a default increment of 1. */
3307
auto_inc = innobase_next_autoinc(read_auto_inc, 1, 1, col_max_value);
3311
case DB_RECORD_NOT_FOUND:
3312
ut_print_timestamp(stderr);
3313
fprintf(stderr, " InnoDB: MySQL and InnoDB data "
3314
"dictionaries are out of sync.\n"
3315
"InnoDB: Unable to find the AUTOINC column "
3316
"%s in the InnoDB table %s.\n"
3317
"InnoDB: We set the next AUTOINC column "
3319
"InnoDB: in effect disabling the AUTOINC "
3320
"next value generation.\n"
3321
"InnoDB: You can either set the next "
3322
"AUTOINC value explicitly using ALTER TABLE\n"
3323
"InnoDB: or fix the data dictionary by "
3324
"recreating the table.\n",
3325
col_name, index->table->name);
3327
/* This will disable the AUTOINC generation. */
3330
/* We want the open to succeed, so that the user can
3331
take corrective action. ie. reads should succeed but
3332
updates should fail. */
3336
/* row_search_max_autoinc() should only return
3337
one of DB_SUCCESS or DB_RECORD_NOT_FOUND. */
2670
fprintf(stderr, " InnoDB: MySQL and InnoDB data "
2671
"dictionaries are out of sync.\n"
2672
"InnoDB: Unable to find the AUTOINC column %s in the "
2673
"InnoDB table %s.\n"
2674
"InnoDB: We set the next AUTOINC column value to the "
2675
"maximum possible value,\n"
2676
"InnoDB: in effect disabling the AUTOINC next value "
2678
"InnoDB: You can either set the next AUTOINC value "
2679
"explicitly using ALTER TABLE\n"
2680
"InnoDB: or fix the data dictionary by recreating "
2682
col_name, index->table->name);
2684
auto_inc = 0xFFFFFFFFFFFFFFFFULL;
3342
2691
dict_table_autoinc_initialize(prebuilt->table, auto_inc);
3345
2696
/*****************************************************************//**
6181
#if 0 // Since we validate the options before this stage, we no longer need to do this.
6182
5638
/* Validate create options if innodb_strict_mode is set. */
6183
5639
if (! create_options_are_valid(&session, form, create_proto)) {
6184
5640
error = ER_ILLEGAL_HA_CREATE_OPTION;
6189
// We assume compact format by default
6190
iflags= DICT_TF_COMPACT;
6192
size_t num_engine_options= create_proto.engine().options_size();
6193
for (size_t x= 0; x < num_engine_options; ++x)
6195
if (boost::iequals(create_proto.engine().options(x).name(), "ROW_FORMAT"))
6197
if (boost::iequals(create_proto.engine().options(x).state(), "COMPRESSED"))
6199
iflags= DICT_TF_FORMAT_ZIP;
6201
else if (boost::iequals(create_proto.engine().options(x).state(), "COMPACT"))
6203
iflags= DICT_TF_FORMAT_ZIP;
6205
else if (boost::iequals(create_proto.engine().options(x).state(), "DYNAMIC"))
6207
iflags= DICT_TF_COMPACT;
6209
else if (boost::iequals(create_proto.engine().options(x).state(), "REDUNDANT"))
6211
iflags= DICT_TF_COMPACT;
6216
assert(0); // This should never happen since we have already validated the options.
5644
if (create_proto.options().has_key_block_size()) {
5645
/* Determine the page_zip.ssize corresponding to the
5646
requested page size (key_block_size) in kilobytes. */
5649
ulint key_block_size = create_proto.options().key_block_size();
5651
for (ssize = ksize = 1; ssize <= DICT_TF_ZSSIZE_MAX;
5652
ssize++, ksize <<= 1) {
5653
if (key_block_size == ksize) {
5654
iflags = ssize << DICT_TF_ZSSIZE_SHIFT
5656
| DICT_TF_FORMAT_ZIP
5657
<< DICT_TF_FORMAT_SHIFT;
5662
if (!srv_file_per_table) {
5663
push_warning(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
5664
ER_ILLEGAL_HA_CREATE_OPTION,
5665
"InnoDB: KEY_BLOCK_SIZE"
5666
" requires innodb_file_per_table.");
5670
if (file_format < DICT_TF_FORMAT_ZIP) {
5671
push_warning(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
5672
ER_ILLEGAL_HA_CREATE_OPTION,
5673
"InnoDB: KEY_BLOCK_SIZE"
5674
" requires innodb_file_format >"
5680
push_warning_printf(&session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
5681
ER_ILLEGAL_HA_CREATE_OPTION,
5683
" KEY_BLOCK_SIZE=%lu.",
5684
create_proto.options().key_block_size());
6220
if (iflags == DICT_TF_FORMAT_ZIP)
6223
ROW_FORMAT=COMPRESSED without KEY_BLOCK_SIZE implies half the maximum KEY_BLOCK_SIZE.
6224
@todo implement KEY_BLOCK_SIZE
6226
iflags= (DICT_TF_ZSSIZE_MAX - 1)
6227
<< DICT_TF_ZSSIZE_SHIFT
6229
| DICT_TF_FORMAT_ZIP
6230
<< DICT_TF_FORMAT_SHIFT;
5688
if (create_proto.options().has_row_type()) {
5690
/* KEY_BLOCK_SIZE was specified. */
5691
if (form.s->row_type != ROW_TYPE_COMPRESSED) {
5692
/* ROW_FORMAT other than COMPRESSED
5693
ignores KEY_BLOCK_SIZE. It does not
5694
make sense to reject conflicting
5695
KEY_BLOCK_SIZE and ROW_FORMAT, because
5696
such combinations can be obtained
5697
with ALTER TABLE anyway. */
5698
push_warning_printf(
5700
DRIZZLE_ERROR::WARN_LEVEL_WARN,
5701
ER_ILLEGAL_HA_CREATE_OPTION,
5702
"InnoDB: ignoring KEY_BLOCK_SIZE=%lu"
5703
" unless ROW_FORMAT=COMPRESSED.",
5704
create_proto.options().key_block_size());
5708
/* No KEY_BLOCK_SIZE */
5709
if (form.s->row_type == ROW_TYPE_COMPRESSED) {
5710
/* ROW_FORMAT=COMPRESSED without
5711
KEY_BLOCK_SIZE implies half the
5712
maximum KEY_BLOCK_SIZE. */
5713
iflags = (DICT_TF_ZSSIZE_MAX - 1)
5714
<< DICT_TF_ZSSIZE_SHIFT
5716
| DICT_TF_FORMAT_ZIP
5717
<< DICT_TF_FORMAT_SHIFT;
6231
5718
#if DICT_TF_ZSSIZE_MAX < 1
6232
5719
# error "DICT_TF_ZSSIZE_MAX < 1"
6237
if (! srv_file_per_table)
6239
push_warning_printf(
6241
DRIZZLE_ERROR::WARN_LEVEL_WARN,
6242
ER_ILLEGAL_HA_CREATE_OPTION,
6243
"InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table.");
6245
else if (file_format < DICT_TF_FORMAT_ZIP)
6247
push_warning_printf(
6249
DRIZZLE_ERROR::WARN_LEVEL_WARN,
6250
ER_ILLEGAL_HA_CREATE_OPTION,
6251
"InnoDB: ROW_FORMAT=compressed requires innodb_file_format > Antelope.");
5724
switch (form.s->row_type) {
5725
const char* row_format_name;
5726
case ROW_TYPE_REDUNDANT:
5728
case ROW_TYPE_COMPRESSED:
5729
case ROW_TYPE_DYNAMIC:
5731
= form.s->row_type == ROW_TYPE_COMPRESSED
5735
if (!srv_file_per_table) {
5736
push_warning_printf(
5738
DRIZZLE_ERROR::WARN_LEVEL_WARN,
5739
ER_ILLEGAL_HA_CREATE_OPTION,
5740
"InnoDB: ROW_FORMAT=%s"
5741
" requires innodb_file_per_table.",
5743
} else if (file_format < DICT_TF_FORMAT_ZIP) {
5744
push_warning_printf(
5746
DRIZZLE_ERROR::WARN_LEVEL_WARN,
5747
ER_ILLEGAL_HA_CREATE_OPTION,
5748
"InnoDB: ROW_FORMAT=%s"
5749
" requires innodb_file_format >"
5753
iflags |= DICT_TF_COMPACT
5754
| (DICT_TF_FORMAT_ZIP
5755
<< DICT_TF_FORMAT_SHIFT);
5760
case ROW_TYPE_NOT_USED:
5761
case ROW_TYPE_FIXED:
5763
error = ER_ILLEGAL_HA_CREATE_OPTION;
5765
case ROW_TYPE_DEFAULT:
5766
case ROW_TYPE_COMPACT:
5767
iflags = DICT_TF_COMPACT;
5770
} else if (!iflags) {
5771
/* No KEY_BLOCK_SIZE or ROW_FORMAT specified:
5772
use ROW_FORMAT=COMPACT by default. */
5773
iflags = DICT_TF_COMPACT;
5776
error = create_table_def(trx, &form, norm_name,
5777
lex_identified_temp_table ? name2 : NULL,
6256
5784
/* Look for a primary key */
6258
primary_key_no= (form.getShare()->hasPrimaryKey() ?
6259
(int) form.getShare()->getPrimaryKey() :
5786
primary_key_no= (form.s->primary_key != MAX_KEY ?
5787
(int) form.s->primary_key :
6262
/* Our function innobase_get_mysql_key_number_for_index assumes
6263
the primary key is always number 0, if it exists */
5790
/* Our function row_get_mysql_key_number_for_index assumes
5791
the primary key is always number 0, if it exists */
6265
5793
assert(primary_key_no == -1 || primary_key_no == 0);
6267
/* Check for name conflicts (with reserved name) for
6268
any user indices to be created. */
6269
if (innobase_index_name_is_reserved(trx, form.key_info,
6270
form.getShare()->keys)) {
6275
if (lex_identified_temp_table)
6276
iflags |= DICT_TF2_TEMPORARY << DICT_TF2_SHIFT;
6278
error= create_table_def(trx, &form, norm_name,
6279
lex_identified_temp_table ? name2 : NULL,
6282
session.setXaId(trx->id);
6288
5795
/* Create the keys */
6290
if (form.getShare()->sizeKeys() == 0 || primary_key_no == -1) {
5797
if (form.s->keys == 0 || primary_key_no == -1) {
6291
5798
/* Create an index which is used as the clustered index;
6292
order the rows by their row id which is internally generated
5799
order the rows by their row id which is internally generated
6295
error = create_clustered_index_when_no_primary(trx, iflags, norm_name);
5802
error = create_clustered_index_when_no_primary(
5803
trx, iflags, norm_name);
6301
5809
if (primary_key_no != -1) {
6302
/* In InnoDB the clustered index must always be created first */
5810
/* In InnoDB the clustered index must always be created
6303
5812
if ((error = create_index(trx, &form, iflags, norm_name,
6304
(uint) primary_key_no))) {
5813
(uint) primary_key_no))) {
6309
for (i = 0; i < form.getShare()->sizeKeys(); i++) {
5818
for (i = 0; i < form.s->keys; i++) {
6310
5820
if (i != (uint) primary_key_no) {
6312
5822
if ((error = create_index(trx, &form, iflags, norm_name,
6319
stmt = innobase_get_stmt(&session, &stmt_len);
6322
string generated_create_table;
6323
const char *query= stmt;
6325
if (session_sql_command(&session) == SQLCOM_CREATE_TABLE)
6327
message::transformTableDefinitionToSql(create_proto,
6328
generated_create_table,
6329
message::DRIZZLE, true);
6330
query= generated_create_table.c_str();
5829
if (trx->mysql_query_str) {
6333
5830
error = row_table_add_foreign_constraints(trx,
6334
query, strlen(query),
6336
lex_identified_temp_table);
5831
trx->mysql_query_str, norm_name,
5832
lex_identified_temp_table);
6338
5834
error = convert_error_code_to_mysql(error, iflags, NULL);
9185
8278
/************************************************************//**
8279
Validate the file format check value, is it one of "on" or "off",
8280
as a side effect it sets the srv_check_file_format_at_startup variable.
8281
@return true if config value one of "on" or "off" */
8284
innobase_file_format_check_on_off(
8285
/*==============================*/
8286
const char* format_check) /*!< in: parameter value */
8290
if (!innobase_strcasecmp(format_check, "off")) {
8292
/* Set the value to disable checking. */
8293
srv_check_file_format_at_startup = DICT_TF_FORMAT_MAX + 1;
8295
} else if (!innobase_strcasecmp(format_check, "on")) {
8297
/* Set the value to the lowest supported format. */
8298
srv_check_file_format_at_startup = DICT_TF_FORMAT_51;
8306
/************************************************************//**
9186
8307
Validate the file format check config parameters, as a side effect it
9187
sets the srv_max_file_format_at_startup variable.
9188
@return the format_id if valid config value, otherwise, return -1 */
8308
sets the srv_check_file_format_at_startup variable.
8309
@return true if valid config value */
9191
innobase_file_format_validate_and_set(
8312
innobase_file_format_check_validate(
9192
8313
/*================================*/
9193
const char* format_max) /*!< in: parameter value */
8314
const char* format_check) /*!< in: parameter value */
9195
8316
uint format_id;
9197
format_id = innobase_file_format_name_lookup(format_max);
8319
format_id = innobase_file_format_name_lookup(format_check);
9199
8321
if (format_id < DICT_TF_FORMAT_MAX + 1) {
9200
srv_max_file_format_at_startup = format_id;
9201
return((int) format_id);
9209
static void init_options(drizzled::module::option_context &context)
9211
context("disable-checksums",
9212
"Disable InnoDB checksums validation.");
9213
context("data-home-dir",
9214
po::value<string>(),
9215
"The common part for InnoDB table spaces.");
9216
context("disable-doublewrite",
9217
"Disable InnoDB doublewrite buffer.");
9218
context("io-capacity",
9219
po::value<io_capacity_constraint>(&innodb_io_capacity)->default_value(200),
9220
"Number of IOPs the server can do. Tunes the background IO rate");
9221
context("fast-shutdown",
9222
po::value<trinary_constraint>(&innobase_fast_shutdown)->default_value(1),
9223
"Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).");
9224
context("purge-batch-size",
9225
po::value<purge_batch_constraint>(&innodb_purge_batch_size)->default_value(20),
9226
"Number of UNDO logs to purge in one batch from the history list. "
9228
context("purge-threads",
9229
po::value<purge_threads_constraint>(&innodb_n_purge_threads)->default_value(0),
9230
"Purge threads can be either 0 or 1. Defalut is 0.");
9231
context("file-per-table",
9232
po::value<bool>(&srv_file_per_table)->default_value(false)->zero_tokens(),
9233
"Stores each InnoDB table to an .ibd file in the database dir.");
9234
context("file-format",
9235
po::value<string>(&innobase_file_format_name)->default_value("Antelope"),
9236
"File format to use for new tables in .ibd files.");
9237
context("file-format-max",
9238
po::value<string>(&innobase_file_format_max)->default_value("Antelope"),
9239
"The highest file format in the tablespace.");
9240
context("file-format-check",
9241
po::value<bool>(&innobase_file_format_check)->default_value(true)->zero_tokens(),
9242
"Whether to perform system file format check.");
9243
context("flush-log-at-trx-commit",
9244
po::value<trinary_constraint>(&innodb_flush_log_at_trx_commit)->default_value(1),
9245
"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).");
9246
context("flush-method",
9247
po::value<string>(),
9248
"With which method to flush data.");
9249
context("log-group-home-dir",
9250
po::value<string>(),
9251
"Path to InnoDB log files.");
9252
context("max-dirty-pages-pct",
9253
po::value<max_dirty_pages_constraint>(&innodb_max_dirty_pages_pct)->default_value(75),
9254
"Percentage of dirty pages allowed in bufferpool.");
9255
context("disable-adaptive-flushing",
9256
"Do not attempt flushing dirty pages to avoid IO bursts at checkpoints.");
9257
context("max-purge-lag",
9258
po::value<uint64_constraint>(&innodb_max_purge_lag)->default_value(0),
9259
"Desired maximum length of the purge queue (0 = no limit)");
9260
context("status-file",
9261
po::value<bool>(&innobase_create_status_file)->default_value(false)->zero_tokens(),
9262
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file");
9263
context("disable-stats-on-metadata",
9264
"Disable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)");
9265
context("stats-sample-pages",
9266
po::value<uint64_nonzero_constraint>(&innodb_stats_sample_pages)->default_value(8),
9267
"The number of index pages to sample when calculating statistics (default 8)");
9268
context("disable-adaptive-hash-index",
9269
"Enable InnoDB adaptive hash index (enabled by default)");
9270
context("replication-delay",
9271
po::value<uint64_constraint>(&innodb_replication_delay)->default_value(0),
9272
"Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)");
9273
context("additional-mem-pool-size",
9274
po::value<additional_mem_pool_constraint>(&innobase_additional_mem_pool_size)->default_value(8*1024*1024L),
9275
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.");
9276
context("autoextend-increment",
9277
po::value<autoextend_constraint>(&innodb_auto_extend_increment)->default_value(8L),
9278
"Data file autoextend increment in megabytes");
9279
context("buffer-pool-size",
9280
po::value<buffer_pool_constraint>(&innobase_buffer_pool_size)->default_value(128*1024*1024L),
9281
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.");
9282
context("buffer-pool-instances",
9283
po::value<buffer_pool_instances_constraint>(&innobase_buffer_pool_instances)->default_value(1),
9284
"Number of buffer pool instances, set to higher value on high-end machines to increase scalability");
9286
context("commit-concurrency",
9287
po::value<concurrency_constraint>(&innobase_commit_concurrency)->default_value(0),
9288
"Helps in performance tuning in heavily concurrent environments.");
9289
context("concurrency-tickets",
9290
po::value<uint32_nonzero_constraint>(&innodb_concurrency_tickets)->default_value(500L),
9291
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket");
9292
context("read-io-threads",
9293
po::value<io_threads_constraint>(&innobase_read_io_threads)->default_value(4),
9294
"Number of background read I/O threads in InnoDB.");
9295
context("write-io-threads",
9296
po::value<io_threads_constraint>(&innobase_write_io_threads)->default_value(4),
9297
"Number of background write I/O threads in InnoDB.");
9298
context("force-recovery",
9299
po::value<force_recovery_constraint>(&innobase_force_recovery)->default_value(0),
9300
"Helps to save your data in case the disk image of the database becomes corrupt.");
9301
context("log-buffer-size",
9302
po::value<log_buffer_constraint>(&innobase_log_buffer_size)->default_value(8*1024*1024L),
9303
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9304
context("log-file-size",
9305
po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
9306
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9307
context("log-files-in-group",
9308
po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
9309
"Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
9310
context("mirrored-log-groups",
9311
po::value<mirrored_log_groups_constraint>(&innobase_mirrored_log_groups)->default_value(1),
9312
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.");
9313
context("open-files",
9314
po::value<open_files_constraint>(&innobase_open_files)->default_value(300L),
9315
"How many files at the maximum InnoDB keeps open at the same time.");
9316
context("sync-spin-loops",
9317
po::value<uint32_constraint>(&innodb_sync_spin_loops)->default_value(30L),
9318
"Count of spin-loop rounds in InnoDB mutexes (30 by default)");
9319
context("spin-wait-delay",
9320
po::value<uint32_constraint>(&innodb_spin_wait_delay)->default_value(6L),
9321
"Maximum delay between polling for a spin lock (6 by default)");
9322
context("thread-concurrency",
9323
po::value<concurrency_constraint>(&innobase_thread_concurrency)->default_value(0),
9324
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.");
9325
context("thread-sleep-delay",
9326
po::value<uint32_constraint>(&innodb_thread_sleep_delay)->default_value(10000L),
9327
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep");
9328
context("data-file-path",
9329
po::value<string>(),
9330
"Path to individual files and their sizes.");
9332
po::value<string>()->default_value(INNODB_VERSION_STR),
9334
context("use-internal-malloc",
9335
"Use InnoDB's internal memory allocator instal of the OS memory allocator.");
9336
context("change-buffering",
9337
po::value<string>(&innobase_change_buffering),
9338
"Buffer changes to reduce random access: OFF, ON, inserting, deleting, changing, or purging.");
9339
context("read-ahead-threshold",
9340
po::value<read_ahead_threshold_constraint>(&innodb_read_ahead_threshold)->default_value(56),
9341
"Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9342
context("disable-xa",
9343
"Disable InnoDB support for the XA two-phase commit");
9344
context("disable-table-locks",
9345
"Disable InnoDB locking in LOCK TABLES");
9346
context("strict-mode",
9347
po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9348
"Use strict mode when evaluating create options.");
9349
context("replication-log",
9350
po::value<bool>(&innobase_use_replication_log)->default_value(false),
9351
_("Enable internal replication log."));
9352
context("lock-wait-timeout",
9353
po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),
9354
_("Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout."));
9355
context("old-blocks-pct",
9356
po::value<old_blocks_constraint>(&innobase_old_blocks_pct)->default_value(100 * 3 / 8),
9357
_("Percentage of the buffer pool to reserve for 'old' blocks."));
9358
context("old-blocks-time",
9359
po::value<uint32_t>(&buf_LRU_old_threshold_ms)->default_value(0),
9360
_("ove blocks to the 'new' end of the buffer pool if the first access"
9361
" was at least this many milliseconds ago."
9362
" The timeout is disabled if 0 (the default)."));
8322
srv_check_file_format_at_startup = format_id;
8330
/*************************************************************//**
8331
Check if it is a valid file format. This function is registered as
8332
a callback with MySQL.
8333
@return 0 for valid file format */
8336
innodb_file_format_name_validate(
8337
/*=============================*/
8338
Session* , /*!< in: thread handle */
8339
drizzle_sys_var* , /*!< in: pointer to system
8341
void* save, /*!< out: immediate result
8342
for update function */
8343
drizzle_value* value) /*!< in: incoming string */
8345
const char* file_format_input;
8346
char buff[STRING_BUFFER_USUAL_SIZE];
8347
int len = sizeof(buff);
8350
ut_a(value != NULL);
8352
file_format_input = value->val_str(value, buff, &len);
8354
if (file_format_input != NULL) {
8357
format_id = innobase_file_format_name_lookup(
8360
if (format_id <= DICT_TF_FORMAT_MAX) {
8362
*static_cast<const char**>(save) = file_format_input;
8367
*static_cast<const char**>(save) = NULL;
8371
/****************************************************************//**
8372
Update the system variable innodb_file_format using the "saved"
8373
value. This function is registered as a callback with MySQL. */
8376
innodb_file_format_name_update(
8377
/*===========================*/
8378
Session* , /*!< in: thread handle */
8379
drizzle_sys_var* , /*!< in: pointer to
8381
void* var_ptr, /*!< out: where the
8382
formal string goes */
8383
const void* save) /*!< in: immediate result
8384
from check function */
8386
const char* format_name;
8388
ut_a(var_ptr != NULL);
8391
format_name = *static_cast<const char*const*>(save);
8396
format_id = innobase_file_format_name_lookup(format_name);
8398
if (format_id <= DICT_TF_FORMAT_MAX) {
8399
srv_file_format = format_id;
8403
*static_cast<const char**>(var_ptr)
8404
= trx_sys_file_format_id_to_name(srv_file_format);
8407
/*************************************************************//**
8408
Check if valid argument to innodb_file_format_check. This
8409
function is registered as a callback with MySQL.
8410
@return 0 for valid file format */
8413
innodb_file_format_check_validate(
8414
/*==============================*/
8415
Session* , /*!< in: thread handle */
8416
drizzle_sys_var* , /*!< in: pointer to system
8418
void* save, /*!< out: immediate result
8419
for update function */
8420
drizzle_value* value) /*!< in: incoming string */
8422
const char* file_format_input;
8423
char buff[STRING_BUFFER_USUAL_SIZE];
8424
int len = sizeof(buff);
8427
ut_a(value != NULL);
8429
file_format_input = value->val_str(value, buff, &len);
8431
if (file_format_input != NULL) {
8433
/* Check if user set on/off, we want to print a suitable
8434
message if they did so. */
8436
if (innobase_file_format_check_on_off(file_format_input)) {
8437
errmsg_printf(ERRMSG_LVL_WARN,
8438
"InnoDB: invalid innodb_file_format_check "
8439
"value; on/off can only be set at startup or "
8440
"in the configuration file");
8441
} else if (innobase_file_format_check_validate(
8442
file_format_input)) {
8444
*static_cast<const char**>(save) = file_format_input;
8449
errmsg_printf(ERRMSG_LVL_WARN,
8450
"InnoDB: invalid innodb_file_format_check "
8451
"value; can be any format up to %s "
8452
"or its equivalent numeric id",
8453
trx_sys_file_format_id_to_name(
8454
DICT_TF_FORMAT_MAX));
8458
*static_cast<const char**>(save) = NULL;
8462
/****************************************************************//**
8463
Update the system variable innodb_file_format_check using the "saved"
8464
value. This function is registered as a callback with MySQL. */
8467
innodb_file_format_check_update(
8468
/*============================*/
8469
Session* session, /*!< in: thread handle */
8470
drizzle_sys_var* , /*!< in: pointer to
8472
void* var_ptr, /*!< out: where the
8473
formal string goes */
8474
const void* save) /*!< in: immediate result
8475
from check function */
8477
const char* format_name_in;
8478
const char** format_name_out;
8482
ut_a(var_ptr != NULL);
8484
format_name_in = *static_cast<const char*const*>(save);
8486
if (!format_name_in) {
8491
format_id = innobase_file_format_name_lookup(format_name_in);
8493
if (format_id > DICT_TF_FORMAT_MAX) {
8494
/* DEFAULT is "on", which is invalid at runtime. */
8495
push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
8497
"Ignoring SET innodb_file_format=%s",
8502
format_name_out = static_cast<const char**>(var_ptr);
8504
/* Update the max format id in the system tablespace. */
8505
if (trx_sys_file_format_max_set(format_id, format_name_out)) {
8506
ut_print_timestamp(stderr);
8508
" [Info] InnoDB: the file format in the system "
8509
"tablespace is now set to %s.\n", *format_name_out);
8513
/****************************************************************//**
8514
Update the system variable innodb_adaptive_hash_index using the "saved"
8515
value. This function is registered as a callback with MySQL. */
8518
innodb_adaptive_hash_index_update(
8519
/*==============================*/
8520
Session* , /*!< in: thread handle */
8521
drizzle_sys_var* , /*!< in: pointer to
8523
void* , /*!< out: where the
8524
formal string goes */
8525
const void* save) /*!< in: immediate result
8526
from check function */
8528
if (*(bool*) save) {
8529
btr_search_enable();
8531
btr_search_disable();
8535
/*************************************************************//**
8536
Check if it is a valid value of innodb_change_buffering. This function is
8537
registered as a callback with MySQL.
8538
@return 0 for valid innodb_change_buffering */
8541
innodb_change_buffering_validate(
8542
/*=============================*/
8543
Session* , /*!< in: thread handle */
8544
drizzle_sys_var* , /*!< in: pointer to system
8546
void* save, /*!< out: immediate result
8547
for update function */
8548
drizzle_value* value) /*!< in: incoming string */
8550
const char* change_buffering_input;
8551
char buff[STRING_BUFFER_USUAL_SIZE];
8552
int len = sizeof(buff);
8555
ut_a(value != NULL);
8557
change_buffering_input = value->val_str(value, buff, &len);
8559
if (change_buffering_input != NULL) {
8562
for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
8564
if (!innobase_strcasecmp(
8565
change_buffering_input,
8566
innobase_change_buffering_values[use])) {
8567
*(ibuf_use_t*) save = (ibuf_use_t) use;
8576
/****************************************************************//**
8577
Update the system variable innodb_change_buffering using the "saved"
8578
value. This function is registered as a callback with MySQL. */
8581
innodb_change_buffering_update(
8582
/*===========================*/
8583
Session* , /*!< in: thread handle */
8584
drizzle_sys_var* , /*!< in: pointer to
8586
void* var_ptr, /*!< out: where the
8587
formal string goes */
8588
const void* save) /*!< in: immediate result
8589
from check function */
8591
ut_a(var_ptr != NULL);
8593
ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
8595
ibuf_use = *(const ibuf_use_t*) save;
8597
*(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
8600
/* plugin options */
8601
static DRIZZLE_SYSVAR_BOOL(checksums, innobase_use_checksums,
8602
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
8603
"Enable InnoDB checksums validation (enabled by default). "
8604
"Disable with --skip-innodb-checksums.",
8607
static DRIZZLE_SYSVAR_STR(data_home_dir, innobase_data_home_dir,
8608
PLUGIN_VAR_READONLY,
8609
"The common part for InnoDB table spaces.",
8612
static DRIZZLE_SYSVAR_BOOL(doublewrite, innobase_use_doublewrite,
8613
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
8614
"Enable InnoDB doublewrite buffer (enabled by default). "
8615
"Disable with --skip-innodb-doublewrite.",
8618
static DRIZZLE_SYSVAR_ULONG(io_capacity, srv_io_capacity,
8619
PLUGIN_VAR_RQCMDARG,
8620
"Number of IOPs the server can do. Tunes the background IO rate",
8621
NULL, NULL, 200, 100, ~0L, 0);
8623
static DRIZZLE_SYSVAR_ULONG(fast_shutdown, innobase_fast_shutdown,
8624
PLUGIN_VAR_OPCMDARG,
8625
"Speeds up the shutdown process of the InnoDB storage engine. Possible "
8626
"values are 0, 1 (faster)"
8627
" or 2 (fastest - crash-like)"
8629
NULL, NULL, 1, 0, 2, 0);
8631
static DRIZZLE_SYSVAR_BOOL(file_per_table, srv_file_per_table,
8632
PLUGIN_VAR_NOCMDARG,
8633
"Stores each InnoDB table to an .ibd file in the database dir.",
8636
static DRIZZLE_SYSVAR_STR(file_format, innobase_file_format_name,
8637
PLUGIN_VAR_RQCMDARG,
8638
"File format to use for new tables in .ibd files.",
8639
innodb_file_format_name_validate,
8640
innodb_file_format_name_update, "Antelope");
8642
static DRIZZLE_SYSVAR_STR(file_format_check, innobase_file_format_check,
8643
PLUGIN_VAR_OPCMDARG,
8644
"The highest file format in the tablespace.",
8645
innodb_file_format_check_validate,
8646
innodb_file_format_check_update,
8649
static DRIZZLE_SYSVAR_ULONG(flush_log_at_trx_commit, srv_flush_log_at_trx_commit,
8650
PLUGIN_VAR_OPCMDARG,
8651
"Set to 0 (write and flush once per second),"
8652
" 1 (write and flush at each commit)"
8653
" or 2 (write at commit, flush once per second).",
8654
NULL, NULL, 1, 0, 2, 0);
8656
static DRIZZLE_SYSVAR_STR(flush_method, innobase_unix_file_flush_method,
8657
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8658
"With which method to flush data.", NULL, NULL, NULL);
8660
#ifdef UNIV_LOG_ARCHIVE
8661
static DRIZZLE_SYSVAR_STR(log_arch_dir, innobase_log_arch_dir,
8662
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8663
"Where full logs should be archived.", NULL, NULL, NULL);
8665
static DRIZZLE_SYSVAR_BOOL(log_archive, innobase_log_archive,
8666
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
8667
"Set to 1 if you want to have logs archived.", NULL, NULL, FALSE);
8668
#endif /* UNIV_LOG_ARCHIVE */
8670
static DRIZZLE_SYSVAR_STR(log_group_home_dir, innobase_log_group_home_dir,
8671
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8672
"Path to InnoDB log files.", NULL, NULL, NULL);
8674
static DRIZZLE_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
8675
PLUGIN_VAR_RQCMDARG,
8676
"Percentage of dirty pages allowed in bufferpool.",
8677
NULL, NULL, 75, 0, 99, 0);
8679
static DRIZZLE_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
8680
PLUGIN_VAR_NOCMDARG,
8681
"Attempt flushing dirty pages to avoid IO bursts at checkpoints.",
8684
static DRIZZLE_SYSVAR_ULONG(max_purge_lag, srv_max_purge_lag,
8685
PLUGIN_VAR_RQCMDARG,
8686
"Desired maximum length of the purge queue (0 = no limit)",
8687
NULL, NULL, 0, 0, ~0L, 0);
8689
static DRIZZLE_SYSVAR_BOOL(rollback_on_timeout, innobase_rollback_on_timeout,
8690
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
8691
"Roll back the complete transaction on lock wait timeout, for 4.x compatibility (disabled by default)",
8694
static DRIZZLE_SYSVAR_BOOL(status_file, innobase_create_status_file,
8695
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_NOSYSVAR,
8696
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
8699
static DRIZZLE_SYSVAR_BOOL(stats_on_metadata, innobase_stats_on_metadata,
8700
PLUGIN_VAR_OPCMDARG,
8701
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
8704
static DRIZZLE_SYSVAR_ULONGLONG(stats_sample_pages, srv_stats_sample_pages,
8705
PLUGIN_VAR_RQCMDARG,
8706
"The number of index pages to sample when calculating statistics (default 8)",
8707
NULL, NULL, 8, 1, ~0ULL, 0);
8709
static DRIZZLE_SYSVAR_BOOL(adaptive_hash_index, btr_search_enabled,
8710
PLUGIN_VAR_OPCMDARG,
8711
"Enable InnoDB adaptive hash index (enabled by default). "
8712
"Disable with --skip-innodb-adaptive-hash-index.",
8713
NULL, innodb_adaptive_hash_index_update, TRUE);
8715
static DRIZZLE_SYSVAR_ULONG(replication_delay, srv_replication_delay,
8716
PLUGIN_VAR_RQCMDARG,
8717
"Replication thread delay (ms) on the slave server if "
8718
"innodb_thread_concurrency is reached (0 by default)",
8719
NULL, NULL, 0, 0, ~0UL, 0);
8721
static DRIZZLE_SYSVAR_LONG(additional_mem_pool_size, innobase_additional_mem_pool_size,
8722
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8723
"Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.",
8724
NULL, NULL, 8*1024*1024L, 512*1024L, LONG_MAX, 1024);
8726
static DRIZZLE_SYSVAR_UINT(autoextend_increment, srv_auto_extend_increment,
8727
PLUGIN_VAR_RQCMDARG,
8728
"Data file autoextend increment in megabytes",
8729
NULL, NULL, 8L, 1L, 1000L, 0);
8731
static DRIZZLE_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
8732
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8733
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
8734
NULL, NULL, 128*1024*1024L, 5*1024*1024L, INT64_MAX, 1024*1024L);
8736
static DRIZZLE_SYSVAR_ULONG(commit_concurrency, innobase_commit_concurrency,
8737
PLUGIN_VAR_RQCMDARG,
8738
"Helps in performance tuning in heavily concurrent environments.",
8739
innobase_commit_concurrency_validate, NULL, 0, 0, 1000, 0);
8741
static DRIZZLE_SYSVAR_ULONG(concurrency_tickets, srv_n_free_tickets_to_enter,
8742
PLUGIN_VAR_RQCMDARG,
8743
"Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket",
8744
NULL, NULL, 500L, 1L, ~0L, 0);
8746
static DRIZZLE_SYSVAR_LONG(file_io_threads, innobase_file_io_threads,
8747
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8748
"Number of file I/O threads in InnoDB.",
8749
NULL, NULL, 4, 4, 64, 0);
8751
static DRIZZLE_SYSVAR_ULONG(read_io_threads, innobase_read_io_threads,
8752
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8753
"Number of background read I/O threads in InnoDB.",
8754
NULL, NULL, 4, 1, 64, 0);
8756
static DRIZZLE_SYSVAR_ULONG(write_io_threads, innobase_write_io_threads,
8757
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8758
"Number of background write I/O threads in InnoDB.",
8759
NULL, NULL, 4, 1, 64, 0);
8761
static DRIZZLE_SYSVAR_LONG(force_recovery, innobase_force_recovery,
8762
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8763
"Helps to save your data in case the disk image of the database becomes corrupt.",
8764
NULL, NULL, 0, 0, 6, 0);
8766
static DRIZZLE_SYSVAR_LONG(log_buffer_size, innobase_log_buffer_size,
8767
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8768
"The size of the buffer which InnoDB uses to write log to the log files on disk.",
8769
NULL, NULL, 8*1024*1024L, 256*1024L, LONG_MAX, 1024);
8771
static DRIZZLE_SYSVAR_LONGLONG(log_file_size, innobase_log_file_size,
8772
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8773
"Size of each log file in a log group.",
8774
NULL, NULL, 5*1024*1024L, 1*1024*1024L, INT64_MAX, 1024*1024L);
8776
static DRIZZLE_SYSVAR_LONG(log_files_in_group, innobase_log_files_in_group,
8777
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8778
"Number of log files in the log group. InnoDB writes to the files in a circular fashion. Value 3 is recommended here.",
8779
NULL, NULL, 2, 2, 100, 0);
8781
static DRIZZLE_SYSVAR_LONG(mirrored_log_groups, innobase_mirrored_log_groups,
8782
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8783
"Number of identical copies of log groups we keep for the database. Currently this should be set to 1.",
8784
NULL, NULL, 1, 1, 10, 0);
8786
static DRIZZLE_SYSVAR_LONG(open_files, innobase_open_files,
8787
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8788
"How many files at the maximum InnoDB keeps open at the same time.",
8789
NULL, NULL, 300L, 10L, LONG_MAX, 0);
8791
static DRIZZLE_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
8792
PLUGIN_VAR_RQCMDARG,
8793
"Count of spin-loop rounds in InnoDB mutexes (30 by default)",
8794
NULL, NULL, 30L, 0L, ~0L, 0);
8796
static DRIZZLE_SYSVAR_ULONG(spin_wait_delay, srv_spin_wait_delay,
8797
PLUGIN_VAR_OPCMDARG,
8798
"Maximum delay between polling for a spin lock (6 by default)",
8799
NULL, NULL, 6L, 0L, ~0L, 0);
8801
static DRIZZLE_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
8802
PLUGIN_VAR_RQCMDARG,
8803
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
8804
NULL, NULL, 0, 0, 1000, 0);
8806
static DRIZZLE_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay,
8807
PLUGIN_VAR_RQCMDARG,
8808
"Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep",
8809
NULL, NULL, 10000L, 0L, ~0L, 0);
8811
static DRIZZLE_SYSVAR_STR(data_file_path, innobase_data_file_path,
8812
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8813
"Path to individual files and their sizes.",
8816
static DRIZZLE_SYSVAR_LONG(autoinc_lock_mode, innobase_autoinc_lock_mode,
8817
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
8818
"The AUTOINC lock modes supported by InnoDB: "
8819
"0 => Old style AUTOINC locking (for backward"
8821
"1 => New style AUTOINC locking "
8822
"2 => No AUTOINC locking (unsafe for SBR)",
8824
AUTOINC_NO_LOCKING, /* Default setting */
8825
AUTOINC_OLD_STYLE_LOCKING, /* Minimum value */
8826
AUTOINC_NO_LOCKING, 0); /* Maximum value */
8828
static DRIZZLE_SYSVAR_STR(version, innodb_version_str,
8829
PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_READONLY,
8830
"InnoDB version", NULL, NULL, INNODB_VERSION_STR);
8832
static DRIZZLE_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc,
8833
PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY,
8834
"Use OS memory allocator instead of InnoDB's internal memory allocator",
8837
static DRIZZLE_SYSVAR_STR(change_buffering, innobase_change_buffering,
8838
PLUGIN_VAR_RQCMDARG,
8839
"Buffer changes to reduce random access: "
8840
"OFF, ON, inserting, deleting, changing, or purging.",
8841
innodb_change_buffering_validate,
8842
innodb_change_buffering_update, NULL);
8844
static DRIZZLE_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
8845
PLUGIN_VAR_RQCMDARG,
8846
"Number of pages that must be accessed sequentially for InnoDB to"
8847
"trigger a readahead.",
8848
NULL, NULL, 56, 0, 64, 0);
8850
static drizzle_sys_var* innobase_system_variables[]= {
8851
DRIZZLE_SYSVAR(additional_mem_pool_size),
8852
DRIZZLE_SYSVAR(autoextend_increment),
8853
DRIZZLE_SYSVAR(buffer_pool_size),
8854
DRIZZLE_SYSVAR(checksums),
8855
DRIZZLE_SYSVAR(commit_concurrency),
8856
DRIZZLE_SYSVAR(concurrency_tickets),
8857
DRIZZLE_SYSVAR(data_file_path),
8858
DRIZZLE_SYSVAR(data_home_dir),
8859
DRIZZLE_SYSVAR(doublewrite),
8860
DRIZZLE_SYSVAR(fast_shutdown),
8861
DRIZZLE_SYSVAR(file_io_threads),
8862
DRIZZLE_SYSVAR(read_io_threads),
8863
DRIZZLE_SYSVAR(write_io_threads),
8864
DRIZZLE_SYSVAR(file_per_table),
8865
DRIZZLE_SYSVAR(file_format),
8866
DRIZZLE_SYSVAR(file_format_check),
8867
DRIZZLE_SYSVAR(flush_log_at_trx_commit),
8868
DRIZZLE_SYSVAR(flush_method),
8869
DRIZZLE_SYSVAR(force_recovery),
8870
DRIZZLE_SYSVAR(lock_wait_timeout),
8871
#ifdef UNIV_LOG_ARCHIVE
8872
DRIZZLE_SYSVAR(log_arch_dir),
8873
DRIZZLE_SYSVAR(log_archive),
8874
#endif /* UNIV_LOG_ARCHIVE */
8875
DRIZZLE_SYSVAR(log_buffer_size),
8876
DRIZZLE_SYSVAR(log_file_size),
8877
DRIZZLE_SYSVAR(log_files_in_group),
8878
DRIZZLE_SYSVAR(log_group_home_dir),
8879
DRIZZLE_SYSVAR(max_dirty_pages_pct),
8880
DRIZZLE_SYSVAR(max_purge_lag),
8881
DRIZZLE_SYSVAR(adaptive_flushing),
8882
DRIZZLE_SYSVAR(mirrored_log_groups),
8883
DRIZZLE_SYSVAR(open_files),
8884
DRIZZLE_SYSVAR(rollback_on_timeout),
8885
DRIZZLE_SYSVAR(stats_on_metadata),
8886
DRIZZLE_SYSVAR(stats_sample_pages),
8887
DRIZZLE_SYSVAR(adaptive_hash_index),
8888
DRIZZLE_SYSVAR(replication_delay),
8889
DRIZZLE_SYSVAR(status_file),
8890
DRIZZLE_SYSVAR(strict_mode),
8891
DRIZZLE_SYSVAR(support_xa),
8892
DRIZZLE_SYSVAR(sync_spin_loops),
8893
DRIZZLE_SYSVAR(spin_wait_delay),
8894
DRIZZLE_SYSVAR(table_locks),
8895
DRIZZLE_SYSVAR(thread_concurrency),
8896
DRIZZLE_SYSVAR(thread_sleep_delay),
8897
DRIZZLE_SYSVAR(autoinc_lock_mode),
8898
DRIZZLE_SYSVAR(version),
8899
DRIZZLE_SYSVAR(use_sys_malloc),
8900
DRIZZLE_SYSVAR(change_buffering),
8901
DRIZZLE_SYSVAR(read_ahead_threshold),
8902
DRIZZLE_SYSVAR(io_capacity),
9367
8906
DRIZZLE_DECLARE_PLUGIN