~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.cc

  • Committer: Patrick Crews
  • Date: 2010-12-07 20:02:50 UTC
  • Revision ID: gleebix@gmail.com-20101207200250-6a27jgqalgw5bsb5
Added disabled.def file to disable drizzleslap due to Bug#684269.  Need to skip for tarball release this round

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "drizzled/plugin.h"
32
32
#include "drizzled/plugin/client.h"
33
33
#include "drizzled/table.h"
 
34
#include "drizzled/field/timestamp.h"
34
35
#include "drizzled/memory/multi_malloc.h"
35
36
#include "drizzled/plugin/daemon.h"
36
37
 
37
 
#include <drizzled/plugin/storage_engine.h>
38
 
 
39
38
#include <boost/algorithm/string.hpp>
40
39
#include <boost/scoped_ptr.hpp>
41
40
 
118
117
 
119
118
  int doCreateTable(Session&,
120
119
                    Table& table_arg,
121
 
                    const identifier::Table &identifier,
 
120
                    const TableIdentifier &identifier,
122
121
                    message::Table&);
123
122
 
124
 
  int doRenameTable(Session&, const identifier::Table &from, const identifier::Table &to);
 
123
  int doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to);
125
124
 
126
 
  int doDropTable(Session&, const identifier::Table &identifier);
 
125
  int doDropTable(Session&, const TableIdentifier &identifier);
127
126
 
128
127
  int doGetTableDefinition(Session& session,
129
 
                           const identifier::Table &identifier,
 
128
                           const TableIdentifier &identifier,
130
129
                           message::Table &table_message);
131
130
 
132
131
  uint32_t max_supported_keys()          const { return MI_MAX_KEY; }
141
140
            HA_READ_ORDER |
142
141
            HA_KEYREAD_ONLY);
143
142
  }
144
 
  bool doDoesTableExist(Session& session, const identifier::Table &identifier);
 
143
  bool doDoesTableExist(Session& session, const TableIdentifier &identifier);
145
144
 
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::TableIdentifier::vector &set_of_identifiers);
149
148
  bool validateCreateTableOption(const std::string &key, const std::string &state)
150
149
  {
151
150
    (void)state;
159
158
};
160
159
 
161
160
void MyisamEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
162
 
                                         const drizzled::identifier::Schema&,
163
 
                                         drizzled::identifier::Table::vector&)
 
161
                                         const drizzled::SchemaIdentifier&,
 
162
                                         drizzled::TableIdentifier::vector&)
164
163
{
165
164
}
166
165
 
167
 
bool MyisamEngine::doDoesTableExist(Session &session, const identifier::Table &identifier)
 
166
bool MyisamEngine::doDoesTableExist(Session &session, const TableIdentifier &identifier)
168
167
{
169
168
  return session.getMessageCache().doesTableMessageExist(identifier);
170
169
}
171
170
 
172
171
int MyisamEngine::doGetTableDefinition(Session &session,
173
 
                                       const identifier::Table &identifier,
 
172
                                       const TableIdentifier &identifier,
174
173
                                       message::Table &table_message)
175
174
{
176
175
  if (session.getMessageCache().getTableMessage(identifier, table_message))
286
285
        keydef[i].seg[j].flag|= HA_BLOB_PART;
287
286
        /* save number of bytes used to pack length */
288
287
        keydef[i].seg[j].bit_start= (uint) (field->pack_length() -
289
 
                                            share->sizeBlobPtr());
 
288
                                            share->blob_ptr_size);
290
289
      }
291
290
    }
292
291
    keyseg+= pos->key_parts;
296
295
  record= table_arg->getInsertRecord();
297
296
  recpos= 0;
298
297
  recinfo_pos= recinfo;
299
 
 
300
 
  while (recpos < (uint) share->sizeStoredRecord())
 
298
  while (recpos < (uint) share->stored_rec_length)
301
299
  {
302
300
    Field **field, *found= 0;
303
301
    minpos= share->getRecordLength();
311
309
        /* skip null fields */
312
310
        if (!(temp_length= (*field)->pack_length_in_rec()))
313
311
          continue; /* Skip null-fields */
314
 
 
315
312
        if (! found || fieldpos < minpos ||
316
313
            (fieldpos == minpos && temp_length < length))
317
314
        {
533
530
{
534
531
  Session *cur_session;
535
532
  if ((cur_session= file->in_use))
536
 
  {
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,
539
535
                    sfile, sline);
540
 
  }
541
536
  else
542
 
  {
543
 
    errmsg_printf(error::ERROR, _("Got an error from unknown thread, %s:%d"), sfile, sline);
544
 
  }
545
 
 
 
537
    errmsg_printf(ERRMSG_LVL_ERROR, _("Got an error from unknown thread, %s:%d"), sfile, sline);
546
538
  if (message)
547
 
    errmsg_printf(error::ERROR, "%s", message);
548
 
 
 
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())
551
542
  {
552
 
    errmsg_printf(error::ERROR, "%s", _("Unknown thread accessing table"));
 
543
    errmsg_printf(ERRMSG_LVL_ERROR, "%s", _("Unknown thread accessing table"));
553
544
    ++it;
554
545
  }
555
546
}
576
567
}
577
568
 
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)
580
571
{
581
572
  MI_KEYDEF *keyinfo;
582
573
  MI_COLUMNDEF *recinfo= 0;
700
691
  */
701
692
  if (file->dfile == -1)
702
693
  {
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);
707
698
  }
708
699
 
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)
929
920
    {
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);
937
928
        might have been set by the first repair. They can still be seen
938
929
        with SHOW WARNINGS then.
939
930
      */
940
 
      if (not error)
 
931
      if (! error)
941
932
        session->clear_error();
942
933
    }
943
934
    info(HA_STATUS_CONST);
1338
1329
}
1339
1330
 
1340
1331
int MyisamEngine::doDropTable(Session &session,
1341
 
                              const identifier::Table &identifier)
 
1332
                              const TableIdentifier &identifier)
1342
1333
{
1343
1334
  session.getMessageCache().removeTableMessage(identifier);
1344
1335
 
1356
1347
 
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)
1361
1352
{
1362
1353
  int error;
1402
1393
}
1403
1394
 
1404
1395
 
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)
1406
1397
{
1407
1398
  session.getMessageCache().renameTableMessage(from, to);
1408
1399
 
1513
1504
{
1514
1505
  context("max-sort-file-size",
1515
1506
          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."));
 
1507
          N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1517
1508
  context("sort-buffer-size",
1518
1509
          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."));
 
1510
          N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."));
1520
1511
}
1521
1512
 
1522
1513
 
1529
1520
  "Default engine as of MySQL 3.23 with great performance",
1530
1521
  PLUGIN_LICENSE_GPL,
1531
1522
  myisam_init, /* Plugin Init */
1532
 
  NULL,           /* depends */
 
1523
  NULL,           /* system variables */
1533
1524
  init_options                        /* config options                  */
1534
1525
}
1535
1526
DRIZZLE_DECLARE_PLUGIN_END;