60
58
static uint32_t myisam_key_cache_division_limit;
61
59
static uint32_t myisam_key_cache_age_threshold;
62
60
static uint64_t max_sort_file_size;
63
typedef constrained_check<size_t, SIZE_MAX, 1024, 1024> sort_buffer_constraint;
64
static sort_buffer_constraint sort_buffer_size;
61
static uint64_t sort_buffer_size;
66
63
void st_mi_isam_share::setKeyCache()
145
142
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
146
143
const drizzled::SchemaIdentifier &schema_identifier,
147
drizzled::TableIdentifier::vector &set_of_identifiers);
144
drizzled::TableIdentifiers &set_of_identifiers);
148
145
bool validateCreateTableOption(const std::string &key, const std::string &state)
160
157
void MyisamEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
161
158
const drizzled::SchemaIdentifier&,
162
drizzled::TableIdentifier::vector&)
159
drizzled::TableIdentifiers&)
166
163
bool MyisamEngine::doDoesTableExist(Session &session, const TableIdentifier &identifier)
168
return session.getMessageCache().doesTableMessageExist(identifier);
165
return session.doesTableMessageExist(identifier);
171
168
int MyisamEngine::doGetTableDefinition(Session &session,
172
169
const TableIdentifier &identifier,
173
170
message::Table &table_message)
175
if (session.getMessageCache().getTableMessage(identifier, table_message))
172
if (session.getTableMessage(identifier, table_message))
479
476
volatile int *killed_ptr(MI_CHECK *param)
481
478
/* In theory Unsafe conversion, but should be ok for now */
482
return (int*) (((Session *)(param->session))->getKilledPtr());
479
return (int*) &(((Session *)(param->session))->killed);
485
482
void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
905
902
else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
907
904
Session *session= getTable()->in_use;
908
boost::scoped_ptr<MI_CHECK> param_ap(new MI_CHECK);
909
MI_CHECK ¶m= *param_ap.get();
910
906
const char *save_proc_info= session->get_proc_info();
911
907
session->set_proc_info("Creating index");
912
908
myisamchk_init(¶m);
914
910
param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
915
911
T_CREATE_MISSING_KEYS);
916
912
param.myf_rw&= ~MY_WAIT_IF_FULL;
917
param.sort_buffer_length= static_cast<size_t>(sort_buffer_size);
913
param.sort_buffer_length= (size_t)sort_buffer_size;
918
914
param.stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
919
915
if ((error= (repair(session,param,0) != HA_ADMIN_OK)) && param.retry_repair)
1396
1392
int MyisamEngine::doRenameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
1398
session.getMessageCache().renameTableMessage(from, to);
1394
session.renameTableMessage(from, to);
1400
1396
return mi_rename(from.getPath().c_str(), to.getPath().c_str());
1487
1483
return (uint)file->state->checksum;
1486
static MyisamEngine *engine= NULL;
1490
1488
static int myisam_init(module::Context &context)
1492
context.add(new MyisamEngine(engine_name));
1493
context.registerVariable(new sys_var_constrained_value<size_t>("sort-buffer-size",
1495
context.registerVariable(new sys_var_uint64_t_ptr("max_sort_file_size",
1496
&max_sort_file_size,
1497
context.getOptions()["max-sort-file-size"].as<uint64_t>()));
1490
const module::option_map &vm= context.getOptions();
1492
if (vm.count("max-sort-file-size"))
1494
if (max_sort_file_size > UINT64_MAX)
1496
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for max-sort-file-size\n"));
1501
if (vm.count("sort-buffer-size"))
1503
if (sort_buffer_size < 1024 || sort_buffer_size > SIZE_MAX)
1505
errmsg_printf(ERRMSG_LVL_ERROR, _("Invalid value for sort-buffer-size\n"));
1510
engine= new MyisamEngine(engine_name);
1511
context.add(engine);
1517
static DRIZZLE_SYSVAR_ULONGLONG(max_sort_file_size, max_sort_file_size,
1518
PLUGIN_VAR_RQCMDARG,
1519
N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."),
1520
NULL, NULL, INT32_MAX, 0, UINT64_MAX, 0);
1522
static DRIZZLE_SYSVAR_ULONGLONG(sort_buffer_size, sort_buffer_size,
1523
PLUGIN_VAR_RQCMDARG,
1524
N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."),
1525
NULL, NULL, 8192*1024, 1024, SIZE_MAX, 0);
1503
1527
static void init_options(drizzled::module::option_context &context)
1505
1529
context("max-sort-file-size",
1506
1530
po::value<uint64_t>(&max_sort_file_size)->default_value(INT32_MAX),
1507
1531
N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1508
1532
context("sort-buffer-size",
1509
po::value<sort_buffer_constraint>(&sort_buffer_size)->default_value(8192*1024),
1533
po::value<uint64_t>(&sort_buffer_size)->default_value(8192*1024),
1510
1534
N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."));
1537
static drizzle_sys_var* sys_variables[]= {
1538
DRIZZLE_SYSVAR(max_sort_file_size),
1539
DRIZZLE_SYSVAR(sort_buffer_size),
1514
1544
DRIZZLE_DECLARE_PLUGIN
1520
1550
"Default engine as of MySQL 3.23 with great performance",
1521
1551
PLUGIN_LICENSE_GPL,
1522
1552
myisam_init, /* Plugin Init */
1523
NULL, /* system variables */
1553
sys_variables, /* system variables */
1524
1554
init_options /* config options */
1526
1556
DRIZZLE_DECLARE_PLUGIN_END;