43
43
#include <limits.h>
46
#include "drizzled/error.h"
47
#include "drizzled/errmsg_print.h"
48
#include "drizzled/charset_info.h"
49
#include "drizzled/internal/m_string.h"
50
#include "drizzled/internal/my_sys.h"
51
#include "drizzled/my_hash.h"
52
#include "drizzled/plugin.h"
53
#include "drizzled/show.h"
54
#include "drizzled/data_home.h"
55
#include "drizzled/error.h"
56
#include "drizzled/field.h"
57
#include "drizzled/charset.h"
58
#include "drizzled/session.h"
59
#include "drizzled/current_session.h"
60
#include "drizzled/table.h"
61
#include "drizzled/field/blob.h"
62
#include "drizzled/field/varstring.h"
63
#include "drizzled/plugin/xa_storage_engine.h"
64
#include "drizzled/plugin/daemon.h"
65
#include "drizzled/memory/multi_malloc.h"
66
#include "drizzled/pthread_globals.h"
67
#include "drizzled/named_savepoint.h"
46
#include <drizzled/error.h>
47
#include <drizzled/errmsg_print.h>
48
#include <drizzled/internal/m_string.h>
49
#include <drizzled/internal/my_sys.h>
50
#include <drizzled/plugin.h>
51
#include <drizzled/show.h>
52
#include <drizzled/data_home.h>
53
#include <drizzled/error.h>
54
#include <drizzled/field.h>
55
#include <drizzled/charset.h>
56
#include <drizzled/session.h>
57
#include <drizzled/current_session.h>
58
#include <drizzled/table.h>
59
#include <drizzled/field/blob.h>
60
#include <drizzled/field/varstring.h>
61
#include <drizzled/plugin/xa_storage_engine.h>
62
#include <drizzled/plugin/daemon.h>
63
#include <drizzled/memory/multi_malloc.h>
64
#include <drizzled/pthread_globals.h>
65
#include <drizzled/named_savepoint.h>
66
#include <drizzled/session/table_messages.h>
69
67
#include <drizzled/transaction_services.h>
70
#include "drizzled/message/statement_transform.h"
68
#include <drizzled/message/statement_transform.h>
69
#include <drizzled/cached_directory.h>
70
#include <drizzled/statistics_variables.h>
71
#include <drizzled/system_variables.h>
72
#include <drizzled/session/times.h>
73
#include <drizzled/session/transactions.h>
74
#include <drizzled/typelib.h>
72
76
#include <boost/algorithm/string.hpp>
73
77
#include <boost/program_options.hpp>
175
179
static additional_mem_pool_constraint innobase_additional_mem_pool_size;
176
180
typedef constrained_check<unsigned int, 1000, 1> autoextend_constraint;
177
181
static autoextend_constraint innodb_auto_extend_increment;
178
typedef constrained_check<size_t, SIZE_MAX, 5242880, 1048576> buffer_pool_constraint;
182
typedef constrained_check<size_t, SIZE_MAX, 33554432, 1048576> buffer_pool_constraint;
179
183
static buffer_pool_constraint innobase_buffer_pool_size;
180
184
typedef constrained_check<uint32_t, MAX_BUFFER_POOLS, 1> buffer_pool_instances_constraint;
181
185
static buffer_pool_instances_constraint innobase_buffer_pool_instances;
186
typedef constrained_check<uint32_t,
187
(1 << UNIV_PAGE_SIZE_SHIFT_MAX),
188
(1 << 12)> page_size_constraint;
189
static page_size_constraint innobase_page_size;
190
typedef constrained_check<uint32_t,
191
(1 << UNIV_PAGE_SIZE_SHIFT_MAX),
192
(1 << 9)> log_block_size_constraint;
193
static log_block_size_constraint innobase_log_block_size;
182
194
typedef constrained_check<uint32_t, UINT32_MAX, 100> io_capacity_constraint;
183
195
static io_capacity_constraint innodb_io_capacity;
184
196
typedef constrained_check<uint32_t, 5000, 1> purge_batch_constraint;
217
231
typedef constrained_check<uint32_t, 64, 0> read_ahead_threshold_constraint;
218
232
static read_ahead_threshold_constraint innodb_read_ahead_threshold;
234
static uint64_constraint ibuf_max_size;
236
typedef constrained_check<uint32_t, 1, 0> binary_constraint;
237
static binary_constraint ibuf_active_contract;
239
typedef constrained_check<uint32_t, 999999999, 100> ibuf_accel_rate_constraint;
240
static ibuf_accel_rate_constraint ibuf_accel_rate;
241
static uint32_constraint checkpoint_age_target;
242
static binary_constraint flush_neighbor_pages;
220
244
/* The default values for the following char* start-up parameters
221
245
are determined in innobase_init below: */
226
250
static string innobase_file_format_name;
227
251
static string innobase_change_buffering;
253
static string read_ahead;
254
static string adaptive_flushing_method;
229
256
/* The highest file format being used in the database. The value can be
230
257
set by user, however, it will be adjusted to the newer file format if
231
258
a table of such format is created/opened. */
286
312
"all" /* IBUF_USE_ALL */
315
/** Allowed values of read_ahead */
316
static const char* read_ahead_names[] = {
321
/* For compatibility with the older Percona patch */
322
"0", /* 4 ("none" + 4) */
325
"3", /* 7 ("both" + 4) */
329
static TYPELIB read_ahead_typelib = {
330
array_elements(read_ahead_names) - 1, "read_ahead_typelib",
331
read_ahead_names, NULL
334
/** Allowed values of adaptive_flushing_method */
335
static const char* adaptive_flushing_method_names[] = {
338
"keep_average", /* 2 */
339
/* For compatibility with the older Percona patch */
340
"0", /* 3 ("native" + 3) */
341
"1", /* 4 ("estimate" + 3) */
342
"2", /* 5 ("keep_average" + 3) */
346
static TYPELIB adaptive_flushing_method_typelib = {
347
array_elements(adaptive_flushing_method_names) - 1,
348
"adaptive_flushing_method_typelib",
349
adaptive_flushing_method_names, NULL
289
352
/* "GEN_CLUST_INDEX" is the name reserved for Innodb default
290
353
system primary index. */
291
354
static const char innobase_index_reserve_name[]= "GEN_CLUST_INDEX";
322
385
virtual ~InnobaseEngine()
325
387
if (innodb_inited) {
326
388
srv_fast_shutdown = (ulint) innobase_fast_shutdown;
327
389
innodb_inited = 0;
328
390
hash_table_free(innobase_open_tables);
329
391
innobase_open_tables = NULL;
330
392
if (innobase_shutdown_for_mysql() != DB_SUCCESS) {
333
395
srv_free_paths_and_sizes();
334
if (internal_innobase_data_file_path)
335
free(internal_innobase_data_file_path);
396
free(internal_innobase_data_file_path);
338
399
/* These get strdup'd from vm variables */
491
552
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
492
553
const drizzled::identifier::Schema &schema_identifier,
493
drizzled::identifier::Table::vector &set_of_identifiers);
554
drizzled::identifier::table::vector &set_of_identifiers);
494
555
bool validateCreateTableOption(const std::string &key, const std::string &state);
495
556
void dropTemporarySchema();
964
1025
uint64_t end_timestamp= message.transaction_context().end_timestamp();
965
1026
bool is_end_segment= message.end_segment();
966
1027
trx->log_commit_id= TRUE;
1029
string server_uuid= session.getServerUUID();
1030
string originating_server_uuid= session.getOriginatingServerUUID();
1031
uint64_t originating_commit_id= session.getOriginatingCommitID();
1032
bool use_originating_server_uuid= session.isOriginatingServerUUIDSet();
967
1034
ulint error= insert_replication_message(data, message.ByteSize(), trx, trx_id,
968
end_timestamp, is_end_segment, seg_id);
1035
end_timestamp, is_end_segment, seg_id, server_uuid.c_str(),
1036
use_originating_server_uuid, originating_server_uuid.c_str(),
1037
originating_commit_id);
1175
1245
uint ) /*!< in: max query length to print, or 0 to
1176
1246
use the default max length */
1178
drizzled::identifier::User::const_shared_ptr user_identifier(in_session->user());
1248
drizzled::identifier::user::ptr user_identifier(in_session->user());
1181
1251
"Drizzle thread %"PRIu64", query id %"PRIu64", %s, %s, %s ",
1182
1252
static_cast<uint64_t>(in_session->getSessionId()),
1183
1253
static_cast<uint64_t>(in_session->getQueryId()),
1254
getServerHostname().c_str(),
1185
1255
user_identifier->address().c_str(),
1186
1256
user_identifier->username().c_str()
1866
1936
srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
1939
static void auto_lru_dump_update(Session *, sql_var_t)
1941
srv_auto_lru_dump= buffer_pool_restore_at_startup.get();
1944
static void ibuf_active_contract_update(Session *, sql_var_t)
1946
srv_ibuf_active_contract= ibuf_active_contract.get();
1949
static void ibuf_accel_rate_update(Session *, sql_var_t)
1951
srv_ibuf_accel_rate= ibuf_accel_rate.get();
1954
static void checkpoint_age_target_update(Session *, sql_var_t)
1956
srv_checkpoint_age_target= checkpoint_age_target.get();
1959
static void flush_neighbor_pages_update(Session *, sql_var_t)
1961
srv_flush_neighbor_pages= flush_neighbor_pages.get();
1870
1964
static int innodb_commit_concurrency_validate(Session *session, set_var *var)
2100
/*********************************************************************//**
2101
Check if argument is a valid value for srv_read_ahead and set it. This
2102
function is registered as a callback with MySQL.
2103
@return 0 for valid read_ahead value */
2106
read_ahead_validate(
2107
/*================*/
2108
Session*, /*!< in: thread handle */
2111
const char *read_ahead_input = var->value->str_value.ptr();
2112
int res = read_ahead_typelib.find_type(read_ahead_input, TYPELIB::e_none); // e_none is wrong
2115
srv_read_ahead = res - 1;
2122
/*********************************************************************//**
2123
Check if argument is a valid value for srv_adaptive_flushing_method and
2124
set it. This function is registered as a callback with MySQL.
2125
@return 0 for valid read_ahead value */
2128
adaptive_flushing_method_validate(
2129
/*==============================*/
2130
Session*, /*!< in: thread handle */
2133
const char *adaptive_flushing_method_input = var->value->str_value.ptr();
2134
int res = adaptive_flushing_method_typelib.find_type(adaptive_flushing_method_input, TYPELIB::e_none); // e_none is wrong
2137
srv_adaptive_flushing_method = res - 1;
2007
2144
/*********************************************************************//**
2008
2145
Opens an InnoDB database.
2034
2171
srv_spin_wait_delay= innodb_spin_wait_delay.get();
2035
2172
srv_thread_sleep_delay= innodb_thread_sleep_delay.get();
2036
2173
srv_read_ahead_threshold= innodb_read_ahead_threshold.get();
2174
srv_auto_lru_dump= buffer_pool_restore_at_startup.get();
2175
srv_ibuf_max_size= ibuf_max_size.get();
2176
srv_ibuf_active_contract= ibuf_active_contract.get();
2177
srv_ibuf_accel_rate= ibuf_accel_rate.get();
2178
srv_checkpoint_age_target= checkpoint_age_target.get();
2179
srv_flush_neighbor_pages= flush_neighbor_pages.get();
2181
srv_read_ahead = read_ahead_typelib.find_type_or_exit(vm["read-ahead"].as<string>().c_str(),
2182
"read_ahead_typelib") + 1;
2184
srv_adaptive_flushing_method = adaptive_flushing_method_typelib.find_type_or_exit(vm["adaptive-flushing-method"].as<string>().c_str(),
2185
"adaptive_flushing_method_typelib") + 1;
2038
2187
/* Inverted Booleans */
2040
innobase_use_checksums= (vm.count("disable-checksums")) ? false : true;
2041
innobase_use_doublewrite= (vm.count("disable-doublewrite")) ? false : true;
2042
srv_adaptive_flushing= (vm.count("disable-adaptive-flushing")) ? false : true;
2043
srv_use_sys_malloc= (vm.count("use-internal-malloc")) ? false : true;
2044
srv_use_native_aio= (vm.count("disable-native-aio")) ? false : true;
2045
support_xa= (vm.count("disable-xa")) ? false : true;
2046
btr_search_enabled= (vm.count("disable-adaptive-hash-index")) ? false : true;
2189
innobase_use_checksums= not vm.count("disable-checksums");
2190
innobase_use_doublewrite= not vm.count("disable-doublewrite");
2191
srv_adaptive_flushing= not vm.count("disable-adaptive-flushing");
2192
srv_use_sys_malloc= not vm.count("use-internal-malloc");
2193
srv_use_native_aio= not vm.count("disable-native-aio");
2194
support_xa= not vm.count("disable-xa");
2195
btr_search_enabled= not vm.count("disable-adaptive-hash-index");
2049
2197
/* Hafta do this here because we need to late-bind the default value */
2050
if (vm.count("data-home-dir"))
2052
innobase_data_home_dir= vm["data-home-dir"].as<string>();
2056
innobase_data_home_dir= getDataHome().file_string();
2198
innobase_data_home_dir= vm.count("data-home-dir") ? vm["data-home-dir"].as<string>() : getDataHome().file_string();
2060
2200
if (vm.count("data-file-path"))
2087
2227
#endif /* UNIV_DEBUG */
2230
srv_page_size_shift = 0;
2232
uint32_t page_size = innobase_page_size.get();
2233
uint32_t log_block_size = innobase_log_block_size.get();
2235
if (innobase_page_size != (1 << 14)) {
2238
errmsg_printf(error::WARN,
2239
"InnoDB: Warning: innodb_page_size has been changed from default value 16384. (###EXPERIMENTAL### operation)\n");
2240
for (n_shift = 12; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) {
2241
if (innobase_page_size == (1UL << n_shift)) {
2242
srv_page_size_shift = n_shift;
2243
srv_page_size = (1 << srv_page_size_shift);
2244
errmsg_printf(error::WARN,
2245
"InnoDB: The universal page size of the database is set to %lu.\n",
2251
srv_page_size_shift = 14;
2252
srv_page_size = (1 << srv_page_size_shift);
2255
if (!srv_page_size_shift) {
2256
errmsg_printf(error::ERROR,
2257
"InnoDB: Error: %"PRIu32" is not a valid value for innodb_page_size.\n"
2258
"InnoDB: Error: Valid values are 4096, 8192, and 16384 (default=16384).\n",
2263
srv_log_block_size = 0;
2264
if (log_block_size != (1 << 9)) { /*!=512*/
2267
errmsg_printf(error::WARN,
2268
"InnoDB: Warning: innodb_log_block_size has been changed from default value 512. (###EXPERIMENTAL### operation)\n");
2269
for (n_shift = 9; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) {
2270
if (log_block_size == (1UL << n_shift)) {
2271
srv_log_block_size = (1 << n_shift);
2272
errmsg_printf(error::WARN, "InnoDB: The log block size is set to %"PRIu32".\n",
2273
srv_log_block_size);
2278
srv_log_block_size = 512;
2281
if (!srv_log_block_size) {
2282
errmsg_printf(error::ERROR,
2283
"InnoDB: Error: %"PRIu32" is not a valid value for innodb_log_block_size.\n"
2284
"InnoDB: Error: A valid value for innodb_log_block_size is\n"
2285
"InnoDB: Error: a power of 2 from 512 to 16384.\n",
2089
2290
os_innodb_umask = (ulint)internal::my_umask;
2289
2492
actuall_engine_ptr->dropTemporarySchema();
2291
2494
context.add(new InnodbStatusTool);
2293
2495
context.add(innodb_engine_ptr);
2295
context.add(new(std::nothrow)CmpTool(false));
2297
context.add(new(std::nothrow)CmpTool(true));
2299
context.add(new(std::nothrow)CmpmemTool(false));
2301
context.add(new(std::nothrow)CmpmemTool(true));
2303
context.add(new(std::nothrow)InnodbTrxTool("INNODB_TRX"));
2305
context.add(new(std::nothrow)InnodbTrxTool("INNODB_LOCKS"));
2307
context.add(new(std::nothrow)InnodbTrxTool("INNODB_LOCK_WAITS"));
2309
context.add(new(std::nothrow)InnodbSysTablesTool());
2311
context.add(new(std::nothrow)InnodbSysTableStatsTool());
2313
context.add(new(std::nothrow)InnodbSysIndexesTool());
2315
context.add(new(std::nothrow)InnodbSysColumnsTool());
2317
context.add(new(std::nothrow)InnodbSysFieldsTool());
2319
context.add(new(std::nothrow)InnodbSysForeignTool());
2321
context.add(new(std::nothrow)InnodbSysForeignColsTool());
2323
context.add(new(std::nothrow)InnodbInternalTables());
2324
context.add(new(std::nothrow)InnodbReplicationTable());
2496
context.add(new CmpTool(false));
2497
context.add(new CmpTool(true));
2498
context.add(new CmpmemTool(false));
2499
context.add(new CmpmemTool(true));
2500
context.add(new InnodbTrxTool("INNODB_TRX"));
2501
context.add(new InnodbTrxTool("INNODB_LOCKS"));
2502
context.add(new InnodbTrxTool("INNODB_LOCK_WAITS"));
2503
context.add(new InnodbSysTablesTool());
2504
context.add(new InnodbSysTableStatsTool());
2505
context.add(new InnodbSysIndexesTool());
2506
context.add(new InnodbSysColumnsTool());
2507
context.add(new InnodbSysFieldsTool());
2508
context.add(new InnodbSysForeignTool());
2509
context.add(new InnodbSysForeignColsTool());
2510
context.add(new InnodbInternalTables());
2511
context.add(new InnodbReplicationTable());
2326
2513
if (innobase_use_replication_log)
2328
ReplicationLog *replication_logger= new(std::nothrow)ReplicationLog();
2515
ReplicationLog *replication_logger= new ReplicationLog();
2329
2516
context.add(replication_logger);
2330
2517
ReplicationLog::setup(replication_logger);
2377
2564
innodb_file_format_max_validate));
2378
2565
context.registerVariable(new sys_var_constrained_value_readonly<size_t>("buffer_pool_size", innobase_buffer_pool_size));
2379
2566
context.registerVariable(new sys_var_constrained_value_readonly<int64_t>("log_file_size", innobase_log_file_size));
2567
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("page_size", innobase_page_size));
2568
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("log_block_size", innobase_log_block_size));
2380
2569
context.registerVariable(new sys_var_constrained_value_readonly<uint32_t>("flush_log_at_trx_commit",
2381
2570
innodb_flush_log_at_trx_commit));
2382
2571
context.registerVariable(new sys_var_constrained_value_readonly<unsigned int>("max_dirty_pages_pct",
2411
2600
context.registerVariable(new sys_var_constrained_value<uint32_t>("read_ahead_threshold",
2412
2601
innodb_read_ahead_threshold,
2413
2602
innodb_read_ahead_threshold_update));
2603
context.registerVariable(new sys_var_constrained_value<uint32_t>("auto_lru_dump",
2604
buffer_pool_restore_at_startup,
2605
auto_lru_dump_update));
2606
context.registerVariable(new sys_var_constrained_value_readonly<uint64_t>("ibuf_max_size",
2608
context.registerVariable(new sys_var_constrained_value<uint32_t>("ibuf_active_contract",
2609
ibuf_active_contract,
2610
ibuf_active_contract_update));
2611
context.registerVariable(new sys_var_constrained_value<uint32_t>("ibuf_accel_rate",
2613
ibuf_accel_rate_update));
2614
context.registerVariable(new sys_var_constrained_value<uint32_t>("checkpoint_age_target",
2615
checkpoint_age_target,
2616
checkpoint_age_target_update));
2617
context.registerVariable(new sys_var_constrained_value<uint32_t>("flush_neighbor_pages",
2618
flush_neighbor_pages,
2619
flush_neighbor_pages_update));
2620
context.registerVariable(new sys_var_std_string("read_ahead",
2622
read_ahead_validate));
2623
context.registerVariable(new sys_var_std_string("adaptive_flushing_method",
2624
adaptive_flushing_method,
2625
adaptive_flushing_method_validate));
2414
2626
/* Get the current high water mark format. */
2415
2627
innobase_file_format_max = trx_sys_file_format_max_get();
2416
2628
btr_search_fully_disabled = (!btr_search_enabled);
6022
6232
InnobaseEngine::doCreateTable(
6023
/*================*/
6024
Session &session, /*!< in: Session */
6025
Table& form, /*!< in: information on table columns and indexes */
6026
const identifier::Table &identifier,
6027
message::Table& create_proto)
6233
/*================*/
6234
Session &session, /*!< in: Session */
6235
Table& form, /*!< in: information on table columns and indexes */
6236
const identifier::Table &identifier,
6237
const message::Table& create_proto)
6030
6240
dict_table_t* innobase_table;
7641
7852
ha_innobase::get_foreign_key_list(Session *session, List<ForeignKeyInfo> *f_key_list)
7643
dict_foreign_t* foreign;
7645
7854
ut_a(prebuilt != NULL);
7646
7855
update_session(getTable()->in_use);
7647
prebuilt->trx->op_info = (char*)"getting list of foreign keys";
7856
prebuilt->trx->op_info = "getting list of foreign keys";
7648
7857
trx_search_latch_release_if_reserved(prebuilt->trx);
7649
7858
mutex_enter(&(dict_sys->mutex));
7650
foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
7859
dict_foreign_t* foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
7652
7861
while (foreign != NULL) {
7655
LEX_STRING *name = 0;
7657
7864
char uname[NAME_LEN + 1]; /* Unencoded name */
7658
7865
char db_name[NAME_LEN + 1];
7678
7885
db_name[i] = 0;
7679
7886
ulen= identifier::Table::filename_to_tablename(db_name, uname, sizeof(uname));
7680
LEX_STRING *tmp_referenced_db = session->make_lex_string(NULL, uname, ulen, true);
7887
lex_string_t *tmp_referenced_db = session->make_lex_string(NULL, str_ref(uname, ulen));
7682
7889
/* Table name */
7683
7890
tmp_buff += i + 1;
7684
7891
ulen= identifier::Table::filename_to_tablename(tmp_buff, uname, sizeof(uname));
7685
LEX_STRING *tmp_referenced_table = session->make_lex_string(NULL, uname, ulen, true);
7892
lex_string_t *tmp_referenced_table = session->make_lex_string(NULL, str_ref(uname, ulen));
7687
7894
/** Foreign Fields **/
7688
List<LEX_STRING> tmp_foreign_fields;
7689
List<LEX_STRING> tmp_referenced_fields;
7691
tmp_buff= foreign->foreign_col_names[i];
7692
name = session->make_lex_string(name, tmp_buff, strlen(tmp_buff), true);
7693
tmp_foreign_fields.push_back(name);
7694
tmp_buff= foreign->referenced_col_names[i];
7695
name = session->make_lex_string(name, tmp_buff, strlen(tmp_buff), true);
7696
tmp_referenced_fields.push_back(name);
7895
List<lex_string_t> tmp_foreign_fields;
7896
List<lex_string_t> tmp_referenced_fields;
7899
tmp_foreign_fields.push_back(session->make_lex_string(NULL, str_ref(foreign->foreign_col_names[i])));
7900
tmp_referenced_fields.push_back(session->make_lex_string(NULL, str_ref(foreign->referenced_col_names[i])));
7697
7901
if (++i >= foreign->n_fields)
7743
7947
tmp_buff= "RESTRICT";
7745
LEX_STRING *tmp_update_method = session->make_lex_string(NULL, tmp_buff, length, true);
7747
LEX_STRING *tmp_referenced_key_name = NULL;
7749
if (foreign->referenced_index &&
7750
foreign->referenced_index->name)
7949
lex_string_t *tmp_update_method = session->make_lex_string(NULL, str_ref(tmp_buff, length));
7951
lex_string_t *tmp_referenced_key_name = NULL;
7953
if (foreign->referenced_index && foreign->referenced_index->name)
7752
tmp_referenced_key_name = session->make_lex_string(NULL,
7753
foreign->referenced_index->name, strlen(foreign->referenced_index->name), true);
7955
tmp_referenced_key_name = session->make_lex_string(NULL, str_ref(foreign->referenced_index->name));
7756
7958
ForeignKeyInfo f_key_info(
7758
7960
tmp_update_method, tmp_delete_method, tmp_referenced_key_name,
7759
7961
tmp_foreign_fields, tmp_referenced_fields);
7761
ForeignKeyInfo *pf_key_info = (ForeignKeyInfo *)
7762
session->getMemRoot()->duplicate(&f_key_info, sizeof(ForeignKeyInfo));
7763
f_key_list->push_back(pf_key_info);
7963
f_key_list->push_back((ForeignKeyInfo*)session->mem.memdup(&f_key_info, sizeof(ForeignKeyInfo)));
7764
7964
foreign = UT_LIST_GET_NEXT(foreign_list, foreign);
7766
7966
mutex_exit(&(dict_sys->mutex));
7767
prebuilt->trx->op_info = (char*)"";
7967
prebuilt->trx->op_info = "";
8787
8984
finds charset information and returns length of prefix_len characters in the
8788
8985
index field in bytes.
8789
8986
@return number of bytes occupied by the first n characters */
8792
innobase_get_at_most_n_mbchars(
8793
/*===========================*/
8794
ulint charset_id, /*!< in: character set id */
8795
ulint prefix_len, /*!< in: prefix length in bytes of the index
8796
(this has to be divided by mbmaxlen to get the
8797
number of CHARACTERS n in the prefix) */
8798
ulint data_len, /*!< in: length of the string in bytes */
8799
const char* str); /*!< in: character string */
8802
8989
innobase_get_at_most_n_mbchars(
9144
9331
"Number of UNDO logs to purge in one batch from the history list. "
9145
9332
"Default is 20.");
9146
9333
context("purge-threads",
9147
po::value<purge_threads_constraint>(&innodb_n_purge_threads)->default_value(0),
9148
"Purge threads can be either 0 or 1. Defalut is 0.");
9334
po::value<purge_threads_constraint>(&innodb_n_purge_threads)->default_value(1),
9335
"Purge threads can be either 0 or 1. Default is 1.");
9149
9336
context("file-per-table",
9150
9337
po::value<bool>(&srv_file_per_table)->default_value(false)->zero_tokens(),
9151
9338
"Stores each InnoDB table to an .ibd file in the database dir.");
9222
9409
context("log-file-size",
9223
9410
po::value<log_file_constraint>(&innobase_log_file_size)->default_value(20*1024*1024L),
9224
9411
"The size of the buffer which InnoDB uses to write log to the log files on disk.");
9412
context("page-size",
9413
po::value<page_size_constraint>(&innobase_page_size)->default_value(1 << 14),
9414
"###EXPERIMENTAL###: The universal page size of the database. Changing for created database is not supported. Use on your own risk!");
9415
context("log-block-size",
9416
po::value<log_block_size_constraint>(&innobase_log_block_size)->default_value(1 << 9),
9417
"###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!");
9225
9418
context("log-files-in-group",
9226
9419
po::value<log_files_in_group_constraint>(&innobase_log_files_in_group)->default_value(2),
9227
9420
"Number of log files in the log group. InnoDB writes to the files in a circular fashion.");
9259
9452
context("read-ahead-threshold",
9260
9453
po::value<read_ahead_threshold_constraint>(&innodb_read_ahead_threshold)->default_value(56),
9261
9454
"Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.");
9455
context("auto-lru-dump",
9456
po::value<uint32_constraint>(&buffer_pool_restore_at_startup)->default_value(0),
9457
"Time in seconds between automatic buffer pool dumps. "
9458
"0 (the default) disables automatic dumps.");
9459
context("ibuf-max-size",
9460
po::value<uint64_constraint>(&ibuf_max_size)->default_value(UINT64_MAX),
9461
"The maximum size of the insert buffer (in bytes).");
9462
context("ibuf-active-contract",
9463
po::value<binary_constraint>(&ibuf_active_contract)->default_value(1),
9464
"Enable/Disable active_contract of insert buffer. 0:disable 1:enable");
9465
context("ibuf-accel-rate",
9466
po::value<ibuf_accel_rate_constraint>(&ibuf_accel_rate)->default_value(100),
9467
"Tunes amount of insert buffer processing of background, in addition to innodb_io_capacity. (in percentage)");
9468
context("checkpoint-age-target",
9469
po::value<uint32_constraint>(&checkpoint_age_target)->default_value(0),
9470
"Control soft limit of checkpoint age. (0 : not control)");
9471
context("flush-neighbor-pages",
9472
po::value<binary_constraint>(&flush_neighbor_pages)->default_value(1),
9473
"Enable/Disable flushing also neighbor pages. 0:disable 1:enable");
9474
context("read-ahead",
9475
po::value<string>(&read_ahead)->default_value("linear"),
9476
"Control read ahead activity (none, random, [linear], both). [from 1.0.5: random read ahead is ignored]");
9477
context("adaptive-flushing-method",
9478
po::value<string>(&adaptive_flushing_method)->default_value("estimate"),
9479
"Choose method of innodb_adaptive_flushing. (native, [estimate], keep_average)");
9262
9480
context("disable-xa",
9263
9481
"Disable InnoDB support for the XA two-phase commit");
9264
9482
context("disable-table-locks",
9267
9485
po::value<bool>(&strict_mode)->default_value(false)->zero_tokens(),
9268
9486
"Use strict mode when evaluating create options.");
9269
9487
context("replication-log",
9270
po::value<bool>(&innobase_use_replication_log)->default_value(false),
9488
po::value<bool>(&innobase_use_replication_log)->default_value(false)->zero_tokens(),
9271
9489
_("Enable internal replication log."));
9272
9490
context("lock-wait-timeout",
9273
9491
po::value<lock_wait_constraint>(&lock_wait_timeout)->default_value(50),