~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/ha_myisam.cc

  • Committer: Brian Aker
  • Date: 2010-03-19 01:45:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1362.
  • Revision ID: brian@gaz-20100319014539-jv38vkd8h9a4axzr
Another pass through the interface...

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
17
 
20
20
#include "myisampack.h"
21
21
#include "ha_myisam.h"
22
22
#include "myisam_priv.h"
23
 
#include "drizzled/option.h"
 
23
#include "drizzled/my_getopt.h"
24
24
#include "drizzled/internal/my_bit.h"
25
25
#include "drizzled/internal/m_string.h"
26
26
#include "drizzled/util/test.h"
28
28
#include "drizzled/errmsg_print.h"
29
29
#include "drizzled/gettext.h"
30
30
#include "drizzled/session.h"
31
 
#include "drizzled/plugin.h"
 
31
#include "drizzled/set_var.h"
 
32
#include <drizzled/plugin.h>
32
33
#include "drizzled/plugin/client.h"
33
34
#include "drizzled/table.h"
34
35
#include "drizzled/field/timestamp.h"
35
36
#include "drizzled/memory/multi_malloc.h"
36
 
#include "drizzled/plugin/daemon.h"
37
 
 
38
 
#include <boost/algorithm/string.hpp>
39
 
#include <boost/scoped_ptr.hpp>
40
37
 
41
38
#include <string>
42
39
#include <sstream>
43
40
#include <map>
44
41
#include <algorithm>
45
 
#include <memory>
46
 
#include <boost/program_options.hpp>
47
 
#include <drizzled/module/option_map.h>
48
 
 
49
 
namespace po= boost::program_options;
50
42
 
51
43
using namespace std;
52
44
using namespace drizzled;
53
45
 
 
46
extern pthread_mutex_t LOCK_global_system_variables;
54
47
static const string engine_name("MyISAM");
55
48
 
56
 
boost::mutex THR_LOCK_myisam;
 
49
pthread_mutex_t THR_LOCK_myisam= PTHREAD_MUTEX_INITIALIZER;
57
50
 
58
 
static uint32_t myisam_key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
 
51
static uint32_t repair_threads;
 
52
static uint32_t myisam_key_cache_block_size;
59
53
static uint32_t myisam_key_cache_size;
60
54
static uint32_t myisam_key_cache_division_limit;
61
55
static uint32_t myisam_key_cache_age_threshold;
62
56
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;
65
 
 
66
 
void st_mi_isam_share::setKeyCache()
67
 
{
68
 
  (void)init_key_cache(&key_cache,
69
 
                       myisam_key_cache_block_size,
70
 
                       myisam_key_cache_size,
71
 
                       myisam_key_cache_division_limit, 
72
 
                       myisam_key_cache_age_threshold);
73
 
}
 
57
static uint64_t sort_buffer_size;
74
58
 
75
59
/*****************************************************************************
76
60
** MyISAM tables
84
68
 
85
69
class MyisamEngine : public plugin::StorageEngine
86
70
{
87
 
  MyisamEngine();
88
 
  MyisamEngine(const MyisamEngine&);
89
 
  MyisamEngine& operator=(const MyisamEngine&);
90
71
public:
91
 
  explicit MyisamEngine(string name_arg) :
92
 
    plugin::StorageEngine(name_arg,
93
 
                          HTON_CAN_INDEX_BLOBS |
94
 
                          HTON_STATS_RECORDS_IS_EXACT |
95
 
                          HTON_TEMPORARY_ONLY |
96
 
                          HTON_NULL_IN_KEY |
97
 
                          HTON_HAS_RECORDS |
98
 
                          HTON_DUPLICATE_POS |
99
 
                          HTON_AUTO_PART_KEY |
100
 
                          HTON_SKIP_STORE_LOCK)
101
 
  {
102
 
  }
103
 
 
104
 
  virtual ~MyisamEngine()
105
 
  { 
106
 
    mi_panic(HA_PANIC_CLOSE);
107
 
  }
108
 
 
109
 
  virtual Cursor *create(Table &table)
110
 
  {
111
 
    return new ha_myisam(*this, table);
 
72
  MyisamEngine(string name_arg)
 
73
    : plugin::StorageEngine(name_arg,
 
74
                            HTON_HAS_DATA_DICTIONARY |
 
75
                            HTON_CAN_INDEX_BLOBS |
 
76
                            HTON_STATS_RECORDS_IS_EXACT |
 
77
                            HTON_TEMPORARY_ONLY |
 
78
                            HTON_NULL_IN_KEY |
 
79
                            HTON_HAS_RECORDS |
 
80
                            HTON_DUPLICATE_POS |
 
81
                            HTON_AUTO_PART_KEY |
 
82
                            HTON_SKIP_STORE_LOCK |
 
83
                            HTON_FILE_BASED ) {}
 
84
 
 
85
  ~MyisamEngine()
 
86
  { }
 
87
 
 
88
  virtual Cursor *create(TableShare &table,
 
89
                         memory::Root *mem_root)
 
90
  {
 
91
    return new (mem_root) ha_myisam(*this, table);
112
92
  }
113
93
 
114
94
  const char **bas_ext() const {
115
95
    return ha_myisam_exts;
116
96
  }
117
97
 
118
 
  int doCreateTable(Session&,
 
98
  int doCreateTable(Session *,
119
99
                    Table& table_arg,
120
 
                    const TableIdentifier &identifier,
 
100
                    drizzled::TableIdentifier &identifier,
121
101
                    message::Table&);
122
102
 
123
 
  int doRenameTable(Session&, const TableIdentifier &from, const TableIdentifier &to);
 
103
  int doRenameTable(Session*, const char *from, const char *to);
124
104
 
125
 
  int doDropTable(Session&, const TableIdentifier &identifier);
 
105
  int doDropTable(Session&, drizzled::TableIdentifier &identifier);
126
106
 
127
107
  int doGetTableDefinition(Session& session,
128
 
                           const TableIdentifier &identifier,
 
108
                           drizzled::TableIdentifier &identifier,
129
109
                           message::Table &table_message);
130
110
 
 
111
  /* Temp only engine, so do not return values. */
 
112
  void doGetTableNames(CachedDirectory &, string& , set<string>&) { };
 
113
 
131
114
  uint32_t max_supported_keys()          const { return MI_MAX_KEY; }
132
115
  uint32_t max_supported_key_length()    const { return MI_MAX_KEY_LENGTH; }
133
116
  uint32_t max_supported_key_part_length() const { return MI_MAX_KEY_LENGTH; }
140
123
            HA_READ_ORDER |
141
124
            HA_KEYREAD_ONLY);
142
125
  }
143
 
  bool doDoesTableExist(Session& session, const TableIdentifier &identifier);
144
 
 
145
 
  void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
146
 
                             const drizzled::SchemaIdentifier &schema_identifier,
147
 
                             drizzled::TableIdentifier::vector &set_of_identifiers);
148
 
  bool validateCreateTableOption(const std::string &key, const std::string &state)
149
 
  {
150
 
    (void)state;
151
 
    if (boost::iequals(key, "ROW_FORMAT"))
152
 
    {
153
 
      return true;
154
 
    }
155
 
 
156
 
    return false;
157
 
  }
 
126
  bool doDoesTableExist(Session& session, TableIdentifier &identifier);
158
127
};
159
128
 
160
 
void MyisamEngine::doGetTableIdentifiers(drizzled::CachedDirectory&,
161
 
                                         const drizzled::SchemaIdentifier&,
162
 
                                         drizzled::TableIdentifier::vector&)
163
 
{
164
 
}
165
 
 
166
 
bool MyisamEngine::doDoesTableExist(Session &session, const TableIdentifier &identifier)
167
 
{
168
 
  return session.getMessageCache().doesTableMessageExist(identifier);
169
 
}
170
 
 
171
 
int MyisamEngine::doGetTableDefinition(Session &session,
172
 
                                       const TableIdentifier &identifier,
173
 
                                       message::Table &table_message)
174
 
{
175
 
  if (session.getMessageCache().getTableMessage(identifier, table_message))
176
 
    return EEXIST;
177
 
  return ENOENT;
 
129
bool MyisamEngine::doDoesTableExist(Session&, TableIdentifier &identifier)
 
130
{
 
131
  ProtoCache::iterator iter;
 
132
 
 
133
  pthread_mutex_lock(&proto_cache_mutex);
 
134
  iter= proto_cache.find(identifier.getPath());
 
135
 
 
136
  if (iter != proto_cache.end())
 
137
  {
 
138
    return true;
 
139
  }
 
140
  pthread_mutex_unlock(&proto_cache_mutex);
 
141
 
 
142
  return false;
 
143
}
 
144
 
 
145
int MyisamEngine::doGetTableDefinition(Session&,
 
146
                                       drizzled::TableIdentifier &identifier,
 
147
                                       message::Table &table_proto)
 
148
{
 
149
  int error= ENOENT;
 
150
  ProtoCache::iterator iter;
 
151
 
 
152
  pthread_mutex_lock(&proto_cache_mutex);
 
153
  iter= proto_cache.find(identifier.getPath());
 
154
 
 
155
  if (iter != proto_cache.end())
 
156
  {
 
157
    table_proto.CopyFrom(((*iter).second));
 
158
    error= EEXIST;
 
159
  }
 
160
  pthread_mutex_unlock(&proto_cache_mutex);
 
161
 
 
162
  return error;
178
163
}
179
164
 
180
165
/* 
217
202
  uint32_t i, j, recpos, minpos, fieldpos, temp_length, length;
218
203
  enum ha_base_keytype type= HA_KEYTYPE_BINARY;
219
204
  unsigned char *record;
 
205
  KEY *pos;
220
206
  MI_KEYDEF *keydef;
221
207
  MI_COLUMNDEF *recinfo, *recinfo_pos;
222
208
  HA_KEYSEG *keyseg;
223
 
  TableShare *share= table_arg->getMutableShare();
 
209
  TableShare *share= table_arg->s;
224
210
  uint32_t options= share->db_options_in_use;
225
211
  if (!(memory::multi_malloc(false,
226
 
          recinfo_out, (share->sizeFields() * 2 + 2) * sizeof(MI_COLUMNDEF),
227
 
          keydef_out, share->sizeKeys() * sizeof(MI_KEYDEF),
228
 
          &keyseg, (share->key_parts + share->sizeKeys()) * sizeof(HA_KEYSEG),
 
212
          recinfo_out, (share->fields * 2 + 2) * sizeof(MI_COLUMNDEF),
 
213
          keydef_out, share->keys * sizeof(MI_KEYDEF),
 
214
          &keyseg, (share->key_parts + share->keys) * sizeof(HA_KEYSEG),
229
215
          NULL)))
230
216
    return(HA_ERR_OUT_OF_MEM);
231
217
  keydef= *keydef_out;
232
218
  recinfo= *recinfo_out;
233
 
  for (i= 0; i < share->sizeKeys(); i++)
 
219
  pos= table_arg->key_info;
 
220
  for (i= 0; i < share->keys; i++, pos++)
234
221
  {
235
 
    KeyInfo *pos= &table_arg->key_info[i];
236
222
    keydef[i].flag= ((uint16_t) pos->flags & (HA_NOSAME));
237
223
    keydef[i].key_alg= HA_KEY_ALG_BTREE;
238
224
    keydef[i].block_length= pos->block_size;
273
259
      {
274
260
        keydef[i].seg[j].null_bit= field->null_bit;
275
261
        keydef[i].seg[j].null_pos= (uint) (field->null_ptr-
276
 
                                           (unsigned char*) table_arg->getInsertRecord());
 
262
                                           (unsigned char*) table_arg->record[0]);
277
263
      }
278
264
      else
279
265
      {
292
278
  }
293
279
  if (table_arg->found_next_number_field)
294
280
    keydef[share->next_number_index].flag|= HA_AUTO_KEY;
295
 
  record= table_arg->getInsertRecord();
 
281
  record= table_arg->record[0];
296
282
  recpos= 0;
297
283
  recinfo_pos= recinfo;
298
284
  while (recpos < (uint) share->stored_rec_length)
299
285
  {
300
286
    Field **field, *found= 0;
301
 
    minpos= share->getRecordLength();
 
287
    minpos= share->reclength;
302
288
    length= 0;
303
289
 
304
 
    for (field= table_arg->getFields(); *field; field++)
 
290
    for (field= table_arg->field; *field; field++)
305
291
    {
306
292
      if ((fieldpos= (*field)->offset(record)) >= recpos &&
307
293
          fieldpos <= minpos)
341
327
    {
342
328
      recinfo_pos->null_bit= found->null_bit;
343
329
      recinfo_pos->null_pos= (uint) (found->null_ptr -
344
 
                                     (unsigned char*) table_arg->getInsertRecord());
 
330
                                     (unsigned char*) table_arg->record[0]);
345
331
    }
346
332
    else
347
333
    {
479
465
volatile int *killed_ptr(MI_CHECK *param)
480
466
{
481
467
  /* In theory Unsafe conversion, but should be ok for now */
482
 
  return (int*) (((Session *)(param->session))->getKilledPtr());
 
468
  return (int*) &(((Session *)(param->session))->killed);
483
469
}
484
470
 
485
471
void mi_check_print_error(MI_CHECK *param, const char *fmt,...)
529
515
                        const char *sfile, uint32_t sline)
530
516
{
531
517
  Session *cur_session;
 
518
  pthread_mutex_lock(&file->s->intern_lock);
532
519
  if ((cur_session= file->in_use))
533
520
    errmsg_printf(ERRMSG_LVL_ERROR, _("Got an error from thread_id=%"PRIu64", %s:%d"),
534
521
                    cur_session->thread_id,
543
530
    errmsg_printf(ERRMSG_LVL_ERROR, "%s", _("Unknown thread accessing table"));
544
531
    ++it;
545
532
  }
 
533
  pthread_mutex_unlock(&file->s->intern_lock);
546
534
}
547
535
 
548
536
ha_myisam::ha_myisam(plugin::StorageEngine &engine_arg,
549
 
                     Table &table_arg)
 
537
                     TableShare &table_arg)
550
538
  : Cursor(engine_arg, table_arg),
551
539
  file(0),
552
540
  can_enable_indexes(true),
567
555
}
568
556
 
569
557
/* Name is here without an extension */
570
 
int ha_myisam::doOpen(const drizzled::TableIdentifier &identifier, int mode, uint32_t test_if_locked)
 
558
int ha_myisam::open(const char *name, int mode, uint32_t test_if_locked)
571
559
{
572
560
  MI_KEYDEF *keyinfo;
573
561
  MI_COLUMNDEF *recinfo= 0;
589
577
    open of a table that is in use by other threads already (if the
590
578
    MyISAM share exists already).
591
579
  */
592
 
  if (!(file= mi_open(identifier, mode, test_if_locked)))
 
580
  if (!(file=mi_open(name, mode, test_if_locked)))
593
581
    return (errno ? errno : -1);
594
582
 
595
 
  if (!getTable()->getShare()->getType()) /* No need to perform a check for tmp table */
 
583
  if (!table->s->tmp_table) /* No need to perform a check for tmp table */
596
584
  {
597
 
    if ((errno= table2myisam(getTable(), &keyinfo, &recinfo, &recs)))
 
585
    if ((errno= table2myisam(table, &keyinfo, &recinfo, &recs)))
598
586
    {
599
587
      goto err;
600
588
    }
601
 
    if (check_definition(keyinfo, recinfo, getTable()->getShare()->sizeKeys(), recs,
 
589
    if (check_definition(keyinfo, recinfo, table->s->keys, recs,
602
590
                         file->s->keyinfo, file->s->rec,
603
591
                         file->s->base.keys, file->s->base.fields, true))
604
592
    {
607
595
    }
608
596
  }
609
597
 
610
 
  assert(test_if_locked);
611
598
  if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
612
599
    mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0);
613
600
 
614
601
  info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
615
602
  if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
616
603
    mi_extra(file, HA_EXTRA_WAIT_LOCK, 0);
617
 
  if (!getTable()->getShare()->db_record_offset)
 
604
  if (!table->s->db_record_offset)
618
605
    is_ordered= false;
619
606
 
620
607
 
621
608
  keys_with_parts.reset();
622
 
  for (i= 0; i < getTable()->getShare()->sizeKeys(); i++)
 
609
  for (i= 0; i < table->s->keys; i++)
623
610
  {
624
 
    getTable()->key_info[i].block_size= file->s->keyinfo[i].block_length;
 
611
    table->key_info[i].block_size= file->s->keyinfo[i].block_length;
625
612
 
626
 
    KeyPartInfo *kp= getTable()->key_info[i].key_part;
627
 
    KeyPartInfo *kp_end= kp + getTable()->key_info[i].key_parts;
 
613
    KEY_PART_INFO *kp= table->key_info[i].key_part;
 
614
    KEY_PART_INFO *kp_end= kp + table->key_info[i].key_parts;
628
615
    for (; kp != kp_end; kp++)
629
616
    {
630
617
      if (!kp->field->part_of_key.test(i))
655
642
  return mi_close(tmp);
656
643
}
657
644
 
658
 
int ha_myisam::doInsertRecord(unsigned char *buf)
 
645
int ha_myisam::write_row(unsigned char *buf)
659
646
{
 
647
  ha_statistic_increment(&system_status_var::ha_write_count);
 
648
 
660
649
  /*
661
650
    If we have an auto_increment column and we are writing a changed row
662
651
    or a new row, then update the auto_increment value in the record.
663
652
  */
664
 
  if (getTable()->next_number_field && buf == getTable()->getInsertRecord())
 
653
  if (table->next_number_field && buf == table->record[0])
665
654
  {
666
655
    int error;
667
656
    if ((error= update_auto_increment()))
693
682
  {
694
683
    errmsg_printf(ERRMSG_LVL_INFO, "Retrying repair of: '%s' failed. "
695
684
                          "Please try REPAIR EXTENDED or myisamchk",
696
 
                          getTable()->getShare()->getPath());
 
685
                          table->s->path.str);
697
686
    return(HA_ADMIN_FAILED);
698
687
  }
699
688
 
700
 
  param.db_name=    getTable()->getShare()->getSchemaName();
701
 
  param.table_name= getTable()->getAlias();
 
689
  param.db_name=    table->s->getSchemaName();
 
690
  param.table_name= table->alias;
702
691
  param.tmpfile_createflag = O_RDWR | O_TRUNC;
703
692
  param.using_global_keycache = 1;
704
693
  param.session= session;
705
694
  param.out_flag= 0;
706
 
  param.sort_buffer_length= static_cast<size_t>(sort_buffer_size);
 
695
  param.sort_buffer_length= (size_t)sort_buffer_size;
707
696
  strcpy(fixed_name,file->filename);
708
697
 
709
698
  // Don't lock tables if we have used LOCK Table
710
 
  if (mi_lock_database(file, getTable()->getShare()->getType() ? F_EXTRA_LCK : F_WRLCK))
 
699
  if (mi_lock_database(file, table->s->tmp_table ? F_EXTRA_LCK : F_WRLCK))
711
700
  {
712
701
    mi_check_print_error(&param,ER(ER_CANT_LOCK),errno);
713
702
    return(HA_ADMIN_FAILED);
728
717
      local_testflag|= T_STATISTICS;
729
718
      param.testflag|= T_STATISTICS;            // We get this for free
730
719
      statistics_done=1;
 
720
      if (repair_threads > 1)
 
721
      {
 
722
        char buf[40];
 
723
        /* TODO: respect myisam_repair_threads variable */
 
724
        snprintf(buf, 40, "Repair with %d threads", internal::my_count_bits(key_map));
 
725
        session->set_proc_info(buf);
 
726
        error = mi_repair_parallel(&param, file, fixed_name,
 
727
            param.testflag & T_QUICK);
 
728
        session->set_proc_info("Repair done"); // to reset proc_info, as
 
729
                                      // it was pointing to local buffer
 
730
      }
 
731
      else
731
732
      {
732
733
        session->set_proc_info("Repair by sorting");
733
734
        error = mi_repair_by_sort(&param, file, fixed_name,
904
905
  }
905
906
  else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
906
907
  {
907
 
    Session *session= getTable()->in_use;
908
 
    boost::scoped_ptr<MI_CHECK> param_ap(new MI_CHECK);
909
 
    MI_CHECK &param= *param_ap.get();
 
908
    Session *session=current_session;
 
909
    MI_CHECK param;
910
910
    const char *save_proc_info= session->get_proc_info();
911
911
    session->set_proc_info("Creating index");
912
912
    myisamchk_init(&param);
914
914
    param.testflag= (T_SILENT | T_REP_BY_SORT | T_QUICK |
915
915
                     T_CREATE_MISSING_KEYS);
916
916
    param.myf_rw&= ~MY_WAIT_IF_FULL;
917
 
    param.sort_buffer_length=  static_cast<size_t>(sort_buffer_size);
 
917
    param.sort_buffer_length=  (size_t)sort_buffer_size;
918
918
    param.stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
919
919
    if ((error= (repair(session,param,0) != HA_ADMIN_OK)) && param.retry_repair)
920
920
    {
981
981
 
982
982
void ha_myisam::start_bulk_insert(ha_rows rows)
983
983
{
984
 
  Session *session= getTable()->in_use;
 
984
  Session *session= current_session;
985
985
  ulong size= session->variables.read_buff_size;
986
986
 
987
987
  /* don't enable row cache if too few rows */
1033
1033
 
1034
1034
 
1035
1035
 
1036
 
int ha_myisam::doUpdateRecord(const unsigned char *old_data, unsigned char *new_data)
 
1036
int ha_myisam::update_row(const unsigned char *old_data, unsigned char *new_data)
1037
1037
{
 
1038
  ha_statistic_increment(&system_status_var::ha_update_count);
 
1039
  if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
 
1040
    table->timestamp_field->set_time();
1038
1041
  return mi_update(file,old_data,new_data);
1039
1042
}
1040
1043
 
1041
 
int ha_myisam::doDeleteRecord(const unsigned char *buf)
 
1044
int ha_myisam::delete_row(const unsigned char *buf)
1042
1045
{
 
1046
  ha_statistic_increment(&system_status_var::ha_delete_count);
1043
1047
  return mi_delete(file,buf);
1044
1048
}
1045
1049
 
1046
1050
 
1047
 
int ha_myisam::doStartIndexScan(uint32_t idx, bool )
 
1051
int ha_myisam::index_init(uint32_t idx, bool )
1048
1052
{
1049
1053
  active_index=idx;
1050
1054
  //in_range_read= false;
1052
1056
}
1053
1057
 
1054
1058
 
1055
 
int ha_myisam::doEndIndexScan()
 
1059
int ha_myisam::index_end()
1056
1060
{
1057
1061
  active_index=MAX_KEY;
1058
1062
  return 0;
1066
1070
  assert(inited==INDEX);
1067
1071
  ha_statistic_increment(&system_status_var::ha_read_key_count);
1068
1072
  int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
1069
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1073
  table->status=error ? STATUS_NOT_FOUND: 0;
1070
1074
  return error;
1071
1075
}
1072
1076
 
1076
1080
{
1077
1081
  ha_statistic_increment(&system_status_var::ha_read_key_count);
1078
1082
  int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
1079
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1083
  table->status=error ? STATUS_NOT_FOUND: 0;
1080
1084
  return error;
1081
1085
}
1082
1086
 
1087
1091
  ha_statistic_increment(&system_status_var::ha_read_key_count);
1088
1092
  int error=mi_rkey(file, buf, active_index, key, keypart_map,
1089
1093
                    HA_READ_PREFIX_LAST);
1090
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1094
  table->status=error ? STATUS_NOT_FOUND: 0;
1091
1095
  return(error);
1092
1096
}
1093
1097
 
1096
1100
  assert(inited==INDEX);
1097
1101
  ha_statistic_increment(&system_status_var::ha_read_next_count);
1098
1102
  int error=mi_rnext(file,buf,active_index);
1099
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1103
  table->status=error ? STATUS_NOT_FOUND: 0;
1100
1104
  return error;
1101
1105
}
1102
1106
 
1105
1109
  assert(inited==INDEX);
1106
1110
  ha_statistic_increment(&system_status_var::ha_read_prev_count);
1107
1111
  int error=mi_rprev(file,buf, active_index);
1108
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1112
  table->status=error ? STATUS_NOT_FOUND: 0;
1109
1113
  return error;
1110
1114
}
1111
1115
 
1114
1118
  assert(inited==INDEX);
1115
1119
  ha_statistic_increment(&system_status_var::ha_read_first_count);
1116
1120
  int error=mi_rfirst(file, buf, active_index);
1117
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1121
  table->status=error ? STATUS_NOT_FOUND: 0;
1118
1122
  return error;
1119
1123
}
1120
1124
 
1123
1127
  assert(inited==INDEX);
1124
1128
  ha_statistic_increment(&system_status_var::ha_read_last_count);
1125
1129
  int error=mi_rlast(file, buf, active_index);
1126
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1130
  table->status=error ? STATUS_NOT_FOUND: 0;
1127
1131
  return error;
1128
1132
}
1129
1133
 
1138
1142
  {
1139
1143
    error= mi_rnext_same(file,buf);
1140
1144
  } while (error == HA_ERR_RECORD_DELETED);
1141
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1145
  table->status=error ? STATUS_NOT_FOUND: 0;
1142
1146
  return error;
1143
1147
}
1144
1148
 
1168
1172
}
1169
1173
 
1170
1174
 
1171
 
int ha_myisam::doStartTableScan(bool scan)
 
1175
int ha_myisam::rnd_init(bool scan)
1172
1176
{
1173
1177
  if (scan)
1174
1178
    return mi_scan_init(file);
1179
1183
{
1180
1184
  ha_statistic_increment(&system_status_var::ha_read_rnd_next_count);
1181
1185
  int error=mi_scan(file, buf);
1182
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1186
  table->status=error ? STATUS_NOT_FOUND: 0;
1183
1187
  return error;
1184
1188
}
1185
1189
 
 
1190
int ha_myisam::restart_rnd_next(unsigned char *buf, unsigned char *pos)
 
1191
{
 
1192
  return rnd_pos(buf,pos);
 
1193
}
 
1194
 
1186
1195
int ha_myisam::rnd_pos(unsigned char *buf, unsigned char *pos)
1187
1196
{
1188
1197
  ha_statistic_increment(&system_status_var::ha_read_rnd_count);
1189
1198
  int error=mi_rrnd(file, buf, internal::my_get_ptr(pos,ref_length));
1190
 
  getTable()->status=error ? STATUS_NOT_FOUND: 0;
 
1199
  table->status=error ? STATUS_NOT_FOUND: 0;
1191
1200
  return error;
1192
1201
}
1193
1202
 
1216
1225
  }
1217
1226
  if (flag & HA_STATUS_CONST)
1218
1227
  {
1219
 
    TableShare *share= getTable()->getMutableShare();
 
1228
    TableShare *share= table->s;
1220
1229
    stats.max_data_file_length=  misam_info.max_data_file_length;
1221
1230
    stats.max_index_file_length= misam_info.max_index_file_length;
1222
1231
    stats.create_time= misam_info.create_time;
1224
1233
    share->db_options_in_use= misam_info.options;
1225
1234
    stats.block_size= myisam_key_cache_block_size;        /* record block size */
1226
1235
 
1227
 
    set_prefix(share->keys_in_use, share->sizeKeys());
 
1236
    /* Update share */
 
1237
    if (share->tmp_table == STANDARD_TABLE)
 
1238
      pthread_mutex_lock(&share->mutex);
 
1239
    set_prefix(share->keys_in_use, share->keys);
1228
1240
    /*
1229
1241
     * Due to bug 394932 (32-bit solaris build failure), we need
1230
1242
     * to convert the uint64_t key_map member of the misam_info
1273
1285
    share->keys_for_keyread&= share->keys_in_use;
1274
1286
    share->db_record_offset= misam_info.record_offset;
1275
1287
    if (share->key_parts)
1276
 
      memcpy(getTable()->key_info[0].rec_per_key,
 
1288
      memcpy(table->key_info[0].rec_per_key,
1277
1289
             misam_info.rec_per_key,
1278
 
             sizeof(getTable()->key_info[0].rec_per_key)*share->key_parts);
1279
 
    assert(share->getType() != message::Table::STANDARD);
 
1290
             sizeof(table->key_info[0].rec_per_key)*share->key_parts);
 
1291
    if (share->tmp_table == STANDARD_TABLE)
 
1292
      pthread_mutex_unlock(&share->mutex);
1280
1293
 
1281
1294
   /*
1282
1295
     Set data_file_name and index_file_name to point at the symlink value
1328
1341
  return mi_delete_all_rows(file);
1329
1342
}
1330
1343
 
1331
 
int MyisamEngine::doDropTable(Session &session,
1332
 
                              const TableIdentifier &identifier)
 
1344
int MyisamEngine::doDropTable(Session&,
 
1345
                              drizzled::TableIdentifier &identifier)
1333
1346
{
1334
 
  session.getMessageCache().removeTableMessage(identifier);
1335
 
 
1336
 
  return mi_delete_table(identifier.getPath().c_str());
 
1347
  ProtoCache::iterator iter;
 
1348
 
 
1349
  pthread_mutex_lock(&proto_cache_mutex);
 
1350
  iter= proto_cache.find(identifier.getPath());
 
1351
 
 
1352
  if (iter!= proto_cache.end())
 
1353
    proto_cache.erase(iter);
 
1354
 
 
1355
  pthread_mutex_unlock(&proto_cache_mutex);
 
1356
 
 
1357
  return mi_delete_table(identifier.getPath());
1337
1358
}
1338
1359
 
1339
1360
 
1340
1361
int ha_myisam::external_lock(Session *session, int lock_type)
1341
1362
{
1342
1363
  file->in_use= session;
1343
 
  return mi_lock_database(file, !getTable()->getShare()->getType() ?
 
1364
  return mi_lock_database(file, !table->s->tmp_table ?
1344
1365
                          lock_type : ((lock_type == F_UNLCK) ?
1345
1366
                                       F_UNLCK : F_EXTRA_LCK));
1346
1367
}
1347
1368
 
1348
 
int MyisamEngine::doCreateTable(Session &session,
 
1369
int MyisamEngine::doCreateTable(Session *,
1349
1370
                                Table& table_arg,
1350
 
                                const TableIdentifier &identifier,
 
1371
                                drizzled::TableIdentifier &identifier,
1351
1372
                                message::Table& create_proto)
1352
1373
{
1353
1374
  int error;
1356
1377
  MI_KEYDEF *keydef;
1357
1378
  MI_COLUMNDEF *recinfo;
1358
1379
  MI_CREATE_INFO create_info;
1359
 
  TableShare *share= table_arg.getMutableShare();
 
1380
  TableShare *share= table_arg.s;
1360
1381
  uint32_t options= share->db_options_in_use;
1361
1382
  if ((error= table2myisam(&table_arg, &keydef, &recinfo, &create_records)))
1362
1383
    return(error);
1379
1400
    create_flags|= HA_PACK_RECORD;
1380
1401
 
1381
1402
  /* TODO: Check that the following internal::fn_format is really needed */
1382
 
  error= mi_create(internal::fn_format(buff, identifier.getPath().c_str(), "", "",
1383
 
                                       MY_UNPACK_FILENAME|MY_APPEND_EXT),
1384
 
                   share->sizeKeys(), keydef,
 
1403
  error= mi_create(internal::fn_format(buff, identifier.getPath(), "", "",
 
1404
                             MY_UNPACK_FILENAME|MY_APPEND_EXT),
 
1405
                   share->keys, keydef,
1385
1406
                   create_records, recinfo,
1386
1407
                   0, (MI_UNIQUEDEF*) 0,
1387
1408
                   &create_info, create_flags);
1388
1409
  free((unsigned char*) recinfo);
1389
1410
 
1390
 
  session.getMessageCache().storeTableMessage(identifier, create_proto);
 
1411
  pthread_mutex_lock(&proto_cache_mutex);
 
1412
  proto_cache.insert(make_pair(identifier.getPath(), create_proto));
 
1413
  pthread_mutex_unlock(&proto_cache_mutex);
1391
1414
 
1392
1415
  return error;
1393
1416
}
1394
1417
 
1395
1418
 
1396
 
int MyisamEngine::doRenameTable(Session &session, const TableIdentifier &from, const TableIdentifier &to)
 
1419
int MyisamEngine::doRenameTable(Session*,
 
1420
                                const char *from, const char *to)
1397
1421
{
1398
 
  session.getMessageCache().renameTableMessage(from, to);
1399
 
 
1400
 
  return mi_rename(from.getPath().c_str(), to.getPath().c_str());
 
1422
  return mi_rename(from,to);
1401
1423
}
1402
1424
 
1403
1425
 
1411
1433
  int error;
1412
1434
  unsigned char key[MI_MAX_KEY_LENGTH];
1413
1435
 
1414
 
  if (!getTable()->getShare()->next_number_key_offset)
 
1436
  if (!table->s->next_number_key_offset)
1415
1437
  {                                             // Autoincrement at key-start
1416
1438
    ha_myisam::info(HA_STATUS_AUTO);
1417
1439
    *first_value= stats.auto_increment_value;
1421
1443
  }
1422
1444
 
1423
1445
  /* it's safe to call the following if bulk_insert isn't on */
1424
 
  mi_flush_bulk_insert(file, getTable()->getShare()->next_number_index);
 
1446
  mi_flush_bulk_insert(file, table->s->next_number_index);
1425
1447
 
1426
1448
  (void) extra(HA_EXTRA_KEYREAD);
1427
 
  key_copy(key, getTable()->getInsertRecord(),
1428
 
           &getTable()->key_info[getTable()->getShare()->next_number_index],
1429
 
           getTable()->getShare()->next_number_key_offset);
1430
 
  error= mi_rkey(file, getTable()->getUpdateRecord(), (int) getTable()->getShare()->next_number_index,
1431
 
                 key, make_prev_keypart_map(getTable()->getShare()->next_number_keypart),
 
1449
  key_copy(key, table->record[0],
 
1450
           table->key_info + table->s->next_number_index,
 
1451
           table->s->next_number_key_offset);
 
1452
  error= mi_rkey(file, table->record[1], (int) table->s->next_number_index,
 
1453
                 key, make_prev_keypart_map(table->s->next_number_keypart),
1432
1454
                 HA_READ_PREFIX_LAST);
1433
1455
  if (error)
1434
1456
    nr= 1;
1435
1457
  else
1436
1458
  {
1437
 
    /* Get data from getUpdateRecord() */
1438
 
    nr= ((uint64_t) getTable()->next_number_field->
1439
 
         val_int_offset(getTable()->getShare()->rec_buff_length)+1);
 
1459
    /* Get data from record[1] */
 
1460
    nr= ((uint64_t) table->next_number_field->
 
1461
         val_int_offset(table->s->rec_buff_length)+1);
1440
1462
  }
1441
1463
  extra(HA_EXTRA_NO_KEYREAD);
1442
1464
  *first_value= nr;
1487
1509
  return (uint)file->state->checksum;
1488
1510
}
1489
1511
 
1490
 
static int myisam_init(module::Context &context)
1491
 
1492
 
  context.add(new MyisamEngine(engine_name));
1493
 
  context.registerVariable(new sys_var_constrained_value<size_t>("sort-buffer-size",
1494
 
                                                                 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>()));
 
1512
static MyisamEngine *engine= NULL;
 
1513
 
 
1514
static int myisam_init(plugin::Registry &registry)
 
1515
{
 
1516
  int error;
 
1517
  engine= new MyisamEngine(engine_name);
 
1518
  registry.add(engine);
 
1519
 
 
1520
  pthread_mutex_init(&THR_LOCK_myisam,MY_MUTEX_INIT_FAST);
 
1521
 
 
1522
  /* call ha_init_key_cache() on all key caches to init them */
 
1523
  error= init_key_cache(dflt_key_cache,
 
1524
                        myisam_key_cache_block_size,
 
1525
                        myisam_key_cache_size,
 
1526
                        myisam_key_cache_division_limit, 
 
1527
                        myisam_key_cache_age_threshold);
 
1528
 
 
1529
  if (error == 0)
 
1530
    exit(1); /* Memory Allocation Failure */
1498
1531
 
1499
1532
  return 0;
1500
1533
}
1501
1534
 
1502
 
 
1503
 
static void init_options(drizzled::module::option_context &context)
1504
 
{
1505
 
  context("max-sort-file-size",
1506
 
          po::value<uint64_t>(&max_sort_file_size)->default_value(INT32_MAX),
1507
 
          N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."));
1508
 
  context("sort-buffer-size",
1509
 
          po::value<sort_buffer_constraint>(&sort_buffer_size)->default_value(8192*1024),
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."));
1511
 
}
 
1535
static int myisam_deinit(plugin::Registry &registry)
 
1536
{
 
1537
  registry.remove(engine);
 
1538
  delete engine;
 
1539
 
 
1540
  pthread_mutex_destroy(&THR_LOCK_myisam);
 
1541
  end_key_cache(dflt_key_cache, 1);             // Can never fail
 
1542
 
 
1543
  return mi_panic(HA_PANIC_CLOSE);
 
1544
}
 
1545
 
 
1546
static void sys_var_key_cache_size_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1547
{
 
1548
  uint32_t tmp= *static_cast<const uint32_t *>(save);
 
1549
  bool error= 0;
 
1550
 
 
1551
        struct my_option option_limits;
 
1552
  plugin_opt_set_limits(&option_limits, var);
 
1553
        option_limits.name= "myisam_key_cache_size";
 
1554
 
 
1555
  if (dflt_key_cache->in_init)
 
1556
    return;
 
1557
 
 
1558
  myisam_key_cache_size= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
 
1559
 
 
1560
  /* If key cache didn't existed initialize it, else resize it */
 
1561
  dflt_key_cache->in_init= 1;
 
1562
 
 
1563
  error= ! resize_key_cache(dflt_key_cache,
 
1564
                                                                                                                myisam_key_cache_block_size,
 
1565
                            myisam_key_cache_size,
 
1566
                            myisam_key_cache_division_limit,
 
1567
                                                                                                          myisam_key_cache_age_threshold);
 
1568
  dflt_key_cache->in_init= 0;
 
1569
}
 
1570
 
 
1571
static void sys_var_key_cache_block_size_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1572
{
 
1573
  uint32_t tmp= *static_cast<const uint32_t *>(save);
 
1574
  bool error= 0;
 
1575
 
 
1576
        struct my_option option_limits;
 
1577
  plugin_opt_set_limits(&option_limits, var);
 
1578
        option_limits.name= "myisam_key_cache_block_size";
 
1579
 
 
1580
  if (dflt_key_cache->in_init)
 
1581
    return;
 
1582
 
 
1583
  myisam_key_cache_block_size= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
 
1584
 
 
1585
  dflt_key_cache->in_init= 1;
 
1586
 
 
1587
  error= ! resize_key_cache(dflt_key_cache,
 
1588
                                                                                                                myisam_key_cache_block_size,
 
1589
                            myisam_key_cache_size,
 
1590
                            myisam_key_cache_division_limit,
 
1591
                                                                                                          myisam_key_cache_age_threshold);
 
1592
 
 
1593
  dflt_key_cache->in_init= 0;
 
1594
}
 
1595
 
 
1596
static void sys_var_key_cache_division_limit_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1597
{
 
1598
  uint32_t tmp= *static_cast<const uint32_t *>(save);
 
1599
  bool error= 0;
 
1600
 
 
1601
        struct my_option option_limits;
 
1602
  plugin_opt_set_limits(&option_limits, var);
 
1603
        option_limits.name= "myisam_key_cache_division_limit";
 
1604
 
 
1605
  if (dflt_key_cache->in_init)
 
1606
    return;
 
1607
 
 
1608
  myisam_key_cache_division_limit= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
 
1609
 
 
1610
  dflt_key_cache->in_init= 1;
 
1611
 
 
1612
  error= ! resize_key_cache(dflt_key_cache,
 
1613
                                                                                                                myisam_key_cache_block_size,
 
1614
                            myisam_key_cache_size,
 
1615
                            myisam_key_cache_division_limit,
 
1616
                                                                                                          myisam_key_cache_age_threshold);
 
1617
 
 
1618
  dflt_key_cache->in_init= 0;
 
1619
}
 
1620
 
 
1621
static void sys_var_key_cache_age_threshold_update(Session *session, drizzle_sys_var *var, void *, const void *save)
 
1622
{
 
1623
  uint32_t tmp= *static_cast<const uint32_t *>(save);
 
1624
  bool error= 0;
 
1625
 
 
1626
        struct my_option option_limits;
 
1627
  plugin_opt_set_limits(&option_limits, var);
 
1628
        option_limits.name= "myisam_key_cache_age_threshold";
 
1629
 
 
1630
  if (dflt_key_cache->in_init)
 
1631
    return;
 
1632
 
 
1633
  myisam_key_cache_age_threshold= static_cast<uint32_t>(fix_unsigned(session, static_cast<uint64_t>(tmp), &option_limits));
 
1634
 
 
1635
  dflt_key_cache->in_init= 1;
 
1636
 
 
1637
  error= ! resize_key_cache(dflt_key_cache,
 
1638
                                                                                                                myisam_key_cache_block_size,
 
1639
                            myisam_key_cache_size,
 
1640
                            myisam_key_cache_division_limit,
 
1641
                                                                                                          myisam_key_cache_age_threshold);
 
1642
 
 
1643
  dflt_key_cache->in_init= 0;
 
1644
}
 
1645
 
 
1646
static DRIZZLE_SYSVAR_UINT(key_cache_block_size,
 
1647
                            myisam_key_cache_block_size,
 
1648
                            PLUGIN_VAR_RQCMDARG,
 
1649
                            N_("Block size to be used for MyISAM index pages."),
 
1650
                            NULL,
 
1651
                            sys_var_key_cache_block_size_update,
 
1652
                            KEY_CACHE_BLOCK_SIZE,
 
1653
                            512, 
 
1654
                            16 * 1024,
 
1655
                            0);
 
1656
 
 
1657
static DRIZZLE_SYSVAR_UINT(key_cache_age_threshold, myisam_key_cache_age_threshold,
 
1658
                            PLUGIN_VAR_RQCMDARG,
 
1659
                            N_("This characterizes the number of hits a hot block has to be untouched "
 
1660
                            "until it is considered aged enough to be downgraded to a warm block. "
 
1661
                            "This specifies the percentage ratio of that number of hits to the "
 
1662
                            "total number of blocks in key cache"),
 
1663
                            NULL,
 
1664
                            sys_var_key_cache_age_threshold_update,
 
1665
                            300,
 
1666
                            100, 
 
1667
                            UINT32_MAX,
 
1668
                            0);
 
1669
 
 
1670
static DRIZZLE_SYSVAR_UINT(key_cache_division_limit, myisam_key_cache_division_limit,
 
1671
                            PLUGIN_VAR_RQCMDARG,
 
1672
                            N_("The minimum percentage of warm blocks in key cache"),
 
1673
                            NULL,
 
1674
                            sys_var_key_cache_division_limit_update,
 
1675
                            100,
 
1676
                            1, 
 
1677
                            100,
 
1678
                            0);
 
1679
 
 
1680
static DRIZZLE_SYSVAR_UINT(key_cache_size,
 
1681
                            myisam_key_cache_size,
 
1682
                            PLUGIN_VAR_RQCMDARG,
 
1683
                            N_("The size of the buffer used for index blocks for MyISAM tables. "
 
1684
                            "Increase this to get better index handling (for all reads and multiple "
 
1685
                            "writes) to as much as you can afford;"),
 
1686
                            NULL,
 
1687
                            sys_var_key_cache_size_update,
 
1688
                            KEY_CACHE_SIZE,
 
1689
                            1 * 1024 * 1024, 
 
1690
                            UINT32_MAX,
 
1691
                            IO_SIZE);
 
1692
 
 
1693
static DRIZZLE_SYSVAR_UINT(repair_threads, repair_threads,
 
1694
                            PLUGIN_VAR_RQCMDARG,
 
1695
                            N_("Number of threads to use when repairing MyISAM tables. The value of "
 
1696
                            "1 disables parallel repair."),
 
1697
                            NULL, NULL, 1, 1, UINT32_MAX, 0);
 
1698
 
 
1699
static DRIZZLE_SYSVAR_ULONGLONG(max_sort_file_size, max_sort_file_size,
 
1700
                                PLUGIN_VAR_RQCMDARG,
 
1701
                                N_("Don't use the fast sort index method to created index if the temporary file would get bigger than this."),
 
1702
                                NULL, NULL, INT32_MAX, 0, UINT64_MAX, 0);
 
1703
 
 
1704
static DRIZZLE_SYSVAR_ULONGLONG(sort_buffer_size, sort_buffer_size,
 
1705
                                PLUGIN_VAR_RQCMDARG,
 
1706
                                N_("The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE."),
 
1707
                                NULL, NULL, 8192*1024, 1024, SIZE_MAX, 0);
 
1708
 
 
1709
extern uint32_t data_pointer_size;
 
1710
static DRIZZLE_SYSVAR_UINT(data_pointer_size, data_pointer_size,
 
1711
                            PLUGIN_VAR_RQCMDARG,
 
1712
                            N_("Default pointer size to be used for MyISAM tables."),
 
1713
                            NULL, NULL, 6, 2, 7, 0);
 
1714
 
 
1715
static drizzle_sys_var* sys_variables[]= {
 
1716
  DRIZZLE_SYSVAR(key_cache_block_size),
 
1717
  DRIZZLE_SYSVAR(key_cache_size),
 
1718
  DRIZZLE_SYSVAR(key_cache_division_limit),
 
1719
  DRIZZLE_SYSVAR(key_cache_age_threshold),
 
1720
  DRIZZLE_SYSVAR(repair_threads),
 
1721
  DRIZZLE_SYSVAR(max_sort_file_size),
 
1722
  DRIZZLE_SYSVAR(sort_buffer_size),
 
1723
  DRIZZLE_SYSVAR(data_pointer_size),
 
1724
  NULL
 
1725
};
1512
1726
 
1513
1727
 
1514
1728
DRIZZLE_DECLARE_PLUGIN
1515
1729
{
1516
1730
  DRIZZLE_VERSION_ID,
1517
1731
  "MyISAM",
1518
 
  "2.0",
 
1732
  "1.0",
1519
1733
  "MySQL AB",
1520
1734
  "Default engine as of MySQL 3.23 with great performance",
1521
1735
  PLUGIN_LICENSE_GPL,
1522
1736
  myisam_init, /* Plugin Init */
1523
 
  NULL,           /* system variables */
1524
 
  init_options                        /* config options                  */
 
1737
  myisam_deinit, /* Plugin Deinit */
 
1738
  sys_variables,           /* system variables */
 
1739
  NULL                        /* config options                  */
1525
1740
}
1526
1741
DRIZZLE_DECLARE_PLUGIN_END;