19
#include <drizzled/internal/my_bit.h>
19
#include "drizzled/internal/my_bit.h"
20
20
#include "myisampack.h"
21
21
#include "ha_myisam.h"
22
22
#include "myisam_priv.h"
23
#include <drizzled/option.h>
24
#include <drizzled/internal/my_bit.h>
25
#include <drizzled/internal/m_string.h>
26
#include <drizzled/util/test.h>
27
#include <drizzled/error.h>
28
#include <drizzled/errmsg_print.h>
29
#include <drizzled/gettext.h>
30
#include <drizzled/session.h>
31
#include <drizzled/plugin.h>
32
#include <drizzled/plugin/client.h>
33
#include <drizzled/table.h>
34
#include <drizzled/memory/multi_malloc.h>
35
#include <drizzled/plugin/daemon.h>
37
#include <drizzled/plugin/storage_engine.h>
23
#include "drizzled/option.h"
24
#include "drizzled/internal/my_bit.h"
25
#include "drizzled/internal/m_string.h"
26
#include "drizzled/util/test.h"
27
#include "drizzled/error.h"
28
#include "drizzled/errmsg_print.h"
29
#include "drizzled/gettext.h"
30
#include "drizzled/session.h"
31
#include "drizzled/plugin.h"
32
#include "drizzled/plugin/client.h"
33
#include "drizzled/table.h"
34
#include "drizzled/field/timestamp.h"
35
#include "drizzled/memory/multi_malloc.h"
36
#include "drizzled/plugin/daemon.h"
39
38
#include <boost/algorithm/string.hpp>
40
39
#include <boost/scoped_ptr.hpp>
119
118
int doCreateTable(Session&,
120
119
Table& table_arg,
121
const identifier::Table &identifier,
120
const TableIdentifier &identifier,
122
121
message::Table&);
124
int doRenameTable(Session&, const identifier::Table &from, const identifier::Table &to);
123
int doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to);
126
int doDropTable(Session&, const identifier::Table &identifier);
125
int doDropTable(Session&, const TableIdentifier &identifier);
128
127
int doGetTableDefinition(Session& session,
129
const identifier::Table &identifier,
128
const TableIdentifier &identifier,
130
129
message::Table &table_message);
132
131
uint32_t max_supported_keys() const { return MI_MAX_KEY; }
142
141
HA_KEYREAD_ONLY);
144
bool doDoesTableExist(Session& session, const identifier::Table &identifier);
143
bool doDoesTableExist(Session& session, const TableIdentifier &identifier);
146
145
void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
147
const drizzled::identifier::Schema &schema_identifier,
148
drizzled::identifier::Table::vector &set_of_identifiers);
146
const drizzled::SchemaIdentifier &schema_identifier,
147
drizzled::TableIdentifiers &set_of_identifiers);
149
148
bool validateCreateTableOption(const std::string &key, const std::string &state)
161
160
void MyisamEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
162
const drizzled::identifier::Schema&,
163
drizzled::identifier::Table::vector&)
161
const drizzled::SchemaIdentifier&,
162
drizzled::TableIdentifiers&)
167
bool MyisamEngine::doDoesTableExist(Session &session, const identifier::Table &identifier)
166
bool MyisamEngine::doDoesTableExist(Session &session, const TableIdentifier &identifier)
169
168
return session.getMessageCache().doesTableMessageExist(identifier);
172
171
int MyisamEngine::doGetTableDefinition(Session &session,
173
const identifier::Table &identifier,
172
const TableIdentifier &identifier,
174
173
message::Table &table_message)
176
175
if (session.getMessageCache().getTableMessage(identifier, table_message))
296
295
record= table_arg->getInsertRecord();
298
297
recinfo_pos= recinfo;
300
while (recpos < (uint) share->sizeStoredRecord())
298
while (recpos < (uint) share->stored_rec_length)
302
300
Field **field, *found= 0;
303
301
minpos= share->getRecordLength();
534
531
Session *cur_session;
535
532
if ((cur_session= file->in_use))
537
errmsg_printf(error::ERROR, _("Got an error from thread_id=%"PRIu64", %s:%d"),
533
errmsg_printf(ERRMSG_LVL_ERROR, _("Got an error from thread_id=%"PRIu64", %s:%d"),
538
534
cur_session->thread_id,
543
errmsg_printf(error::ERROR, _("Got an error from unknown thread, %s:%d"), sfile, sline);
537
errmsg_printf(ERRMSG_LVL_ERROR, _("Got an error from unknown thread, %s:%d"), sfile, sline);
547
errmsg_printf(error::ERROR, "%s", message);
539
errmsg_printf(ERRMSG_LVL_ERROR, "%s", message);
549
540
list<Session *>::iterator it= file->s->in_use->begin();
550
541
while (it != file->s->in_use->end())
552
errmsg_printf(error::ERROR, "%s", _("Unknown thread accessing table"));
543
errmsg_printf(ERRMSG_LVL_ERROR, "%s", _("Unknown thread accessing table"));
578
569
/* Name is here without an extension */
579
int ha_myisam::doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked)
570
int ha_myisam::doOpen(const drizzled::TableIdentifier &identifier, int mode, uint32_t test_if_locked)
581
572
MI_KEYDEF *keyinfo;
582
573
MI_COLUMNDEF *recinfo= 0;
701
692
if (file->dfile == -1)
703
errmsg_printf(error::INFO, "Retrying repair of: '%s' failed. "
704
"Please try REPAIR EXTENDED or myisamchk",
705
getTable()->getShare()->getPath());
694
errmsg_printf(ERRMSG_LVL_INFO, "Retrying repair of: '%s' failed. "
695
"Please try REPAIR EXTENDED or myisamchk",
696
getTable()->getShare()->getPath());
706
697
return(HA_ADMIN_FAILED);
927
918
param.stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
928
919
if ((error= (repair(session,param,0) != HA_ADMIN_OK)) && param.retry_repair)
930
errmsg_printf(error::WARN, "Warning: Enabling keys got errno %d on %s.%s, retrying",
921
errmsg_printf(ERRMSG_LVL_WARN, "Warning: Enabling keys got errno %d on %s.%s, retrying",
931
922
errno, param.db_name, param.table_name);
932
923
/* Repairing by sort failed. Now try standard repair method. */
933
924
param.testflag&= ~(T_REP_BY_SORT | T_QUICK);
1340
1331
int MyisamEngine::doDropTable(Session &session,
1341
const identifier::Table &identifier)
1332
const TableIdentifier &identifier)
1343
1334
session.getMessageCache().removeTableMessage(identifier);
1357
1348
int MyisamEngine::doCreateTable(Session &session,
1358
1349
Table& table_arg,
1359
const identifier::Table &identifier,
1350
const TableIdentifier &identifier,
1360
1351
message::Table& create_proto)
1405
int MyisamEngine::doRenameTable(Session &session, const identifier::Table &from, const identifier::Table &to)
1396
int MyisamEngine::doRenameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
1407
1398
session.getMessageCache().renameTableMessage(from, to);
1501
1492
context.add(new MyisamEngine(engine_name));
1502
1493
context.registerVariable(new sys_var_constrained_value<size_t>("sort-buffer-size",
1504
1496
context.registerVariable(new sys_var_uint64_t_ptr("max_sort_file_size",
1505
1497
&max_sort_file_size,
1506
1498
context.getOptions()["max-sort-file-size"].as<uint64_t>()));
1514
1506
context("max-sort-file-size",
1515
1507
po::value<uint64_t>(&max_sort_file_size)->default_value(INT32_MAX),
1516
_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1508
N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1517
1509
context("sort-buffer-size",
1518
1510
po::value<sort_buffer_constraint>(&sort_buffer_size)->default_value(8192*1024),
1519
_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."));
1511
N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."));
1529
1521
"Default engine as of MySQL 3.23 with great performance",
1530
1522
PLUGIN_LICENSE_GPL,
1531
1523
myisam_init, /* Plugin Init */
1524
NULL, /* system variables */
1533
1525
init_options /* config options */
1535
1527
DRIZZLE_DECLARE_PLUGIN_END;