~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
/*
  Copyright (C) 2010 Stewart Smith

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#include <config.h>
#include <drizzled/table.h>
#include <drizzled/error.h>
#include <drizzled/plugin/transactional_storage_engine.h>
#include <drizzled/session.h> // for mark_transaction_to_rollback
#include <string>
#include <map>
#include <iostream>
#include <fstream>
#include <drizzled/message/table.pb.h>
#include <drizzled/internal/m_string.h>

#include <drizzled/charset.h>

#include <boost/unordered_map.hpp>

#include "engine_state_history.h"

using namespace std;
using namespace drizzled;

string engine_state;

typedef multimap<string, string> state_multimap;
typedef multimap<string, string>::value_type state_pair;
typedef multimap<string, string>::iterator state_multimap_iter;
state_multimap engine_state_transitions;
state_multimap cursor_state_transitions;

void load_engine_state_transitions(state_multimap &states);
void load_cursor_state_transitions(state_multimap &states);

uint64_t next_cursor_id;

plugin::TransactionalStorageEngine *realEngine;

/* ERROR INJECTION For SEAPITESTER
   -------------------------------

   IF you add a new error injection, document it here!
   You test via error_injected variable.

   Conflicting error inject numbers will lead to tears
   (not Borsch, Vodka and Tears - that's quite nice).

   0 - DISABLED

   1 - doInsertRecord(): every 2nd row, LOCK_WAIT_TIMEOUT.
   2 - doInsertRecord(): every 2nd row, DEADLOCK.
   3 - rnd_next(): every 2nd row, LOCK_WAIT_TIMEOUT
   4 - doStartIndexScan returns an error.
 */
static uint32_t error_injected= 0;

#include <drizzled/function/math/int.h>
#include <drizzled/plugin/function.h>

class SEAPITesterErrorInjectFunc :public Item_int_func
{
public:
  int64_t val_int();
  SEAPITesterErrorInjectFunc() :Item_int_func() {}

  const char *func_name() const
  {
    return "seapitester_error_inject";
  }

  void fix_length_and_dec()
  {
    max_length= 4;
  }

  bool check_argument_count(int n)
  {
    return (n == 1);
  }
};


int64_t SEAPITesterErrorInjectFunc::val_int()
{
  assert(fixed == true);
  uint32_t err_to_inject= args[0]->val_int();

  error_injected= err_to_inject;

  return error_injected;
}

static plugin::TransactionalStorageEngine *getRealEngine()
{
  return down_cast<plugin::TransactionalStorageEngine*>(plugin::StorageEngine::findByName("INNODB"));
}

static inline void ENGINE_NEW_STATE(const string &new_state)
{
  state_multimap_iter cur= engine_state_transitions.find(engine_state);
  if (engine_state_transitions.count(engine_state) == 0)
  {
    std::cerr << "ERROR: Invalid engine state: " << engine_state << std::endl
      << "This should *NEVER* happen."
      << std::endl
      << "i.e. you've really screwed it up and you should be ashamed of "
      << "yourself." << std::endl;
    assert(engine_state_transitions.count(engine_state));
  }

  for(cur= engine_state_transitions.lower_bound(engine_state);
      cur != engine_state_transitions.upper_bound(engine_state);
      cur++)
  {
    if (new_state.compare((*cur).second) == 0)
      break;
  }

  if (cur == engine_state_transitions.end()
      || new_state.compare((*cur).second))
  {
    std::cerr << "ERROR: Invalid Storage Engine state transition!" << std::endl
      << "Cannot go from " << engine_state << " to " << new_state << std::endl;
    assert(false);
  }

  engine_state= new_state;
  engine_state_history.push_back(new_state);

  std::cerr << "\tENGINE STATE : " << engine_state << std::endl;
}

static const string engine_name("STORAGE_ENGINE_API_TESTER");
namespace drizzled {
class SEAPITesterCursor : public drizzled::Cursor
{
  friend class drizzled::Cursor;
public:
  drizzled::Cursor *realCursor;

  SEAPITesterCursor(drizzled::plugin::StorageEngine &engine_arg,
                    drizzled::Table &table_arg)
    : Cursor(engine_arg, table_arg)
    {
      cursor_state= "Cursor()";
      realCursor= NULL;
      id= ++next_cursor_id;
      CURSOR_NEW_STATE("Cursor()");
    }

  ~SEAPITesterCursor()
    { CURSOR_NEW_STATE("~Cursor()"); delete realCursor;}

  int close();
  int rnd_next(unsigned char *buf) {
    static int count= 0;
    CURSOR_NEW_STATE("::rnd_next()");

    if (error_injected == 3 && (count++ % 2))
    {
      user_session->markTransactionForRollback(false);
      return HA_ERR_LOCK_WAIT_TIMEOUT;
    }
    return realCursor->rnd_next(buf);
  }

  int rnd_pos(unsigned char* buf, unsigned char* pos) { CURSOR_NEW_STATE("::rnd_pos()"); return realCursor->rnd_pos(buf, pos); }
  void position(const unsigned char *record);
  int info(uint32_t flag);

  int reset();

  void get_auto_increment(uint64_t, uint64_t, uint64_t, uint64_t*, uint64_t*) {}
  int doStartTableScan(bool scan) { CURSOR_NEW_STATE("::doStartTableScan()"); return realCursor->doStartTableScan(scan); }
  int doEndTableScan() { CURSOR_NEW_STATE("::doEndTableScan()"); return realCursor->doEndTableScan(); }

  const char *index_type(uint32_t key_number);

  int doStartIndexScan(uint32_t, bool);
  int index_read(unsigned char *buf, const unsigned char *key_ptr,
                 uint32_t key_len, drizzled::ha_rkey_function find_flag);
  int index_read_idx_map(unsigned char * buf,
                         uint32_t index,
                         const unsigned char * key,
                         drizzled::key_part_map keypart_map,
                         drizzled::ha_rkey_function find_flag);

  int index_next(unsigned char * buf);
  int doEndIndexScan();
  int index_prev(unsigned char * buf);
  int index_first(unsigned char * buf);
  int index_last(unsigned char * buf);

  bool primary_key_is_clustered()
  {
    return realCursor->primary_key_is_clustered();
  }


  int doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked);

  THR_LOCK_DATA **store_lock(Session *,
                                     THR_LOCK_DATA **to,
                             enum thr_lock_type);

  int external_lock(Session *session, int lock_type);

  int doInsertRecord(unsigned char *buf)
  {
    static int i=0;
    CURSOR_NEW_STATE("::doInsertRecord()");

    if (error_injected == 1 && (i++ % 2))
    {
      user_session->markTransactionForRollback(false);
      return HA_ERR_LOCK_WAIT_TIMEOUT;
    }

    if (error_injected == 2 && (i++ % 2))
    {
      user_session->markTransactionForRollback(true);
      return HA_ERR_LOCK_DEADLOCK;
    }

    return realCursor->doInsertRecord(buf);
  }

  int doUpdateRecord(const unsigned char *old_row, unsigned char *new_row)
  {
    CURSOR_NEW_STATE("::doUpdateRecord()");
    return realCursor->doUpdateRecord(old_row, new_row);
  }

  double scan_time()
  {
    CURSOR_NEW_STATE("::scan_time()");
    CURSOR_NEW_STATE("locked");
    return realCursor->scan_time();
  }

  int extra(enum ha_extra_function operation)
  {
    return realCursor->extra(operation);
  }

private:
  string cursor_state;
  void CURSOR_NEW_STATE(const string &new_state);
  Session* user_session;
  uint64_t id;
};

int SEAPITesterCursor::doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked)
{
  CURSOR_NEW_STATE("::doOpen()");

  int r= realCursor->doOpen(identifier, mode, test_if_locked);

  ref_length= realCursor->ref_length;

  return r;
}

int SEAPITesterCursor::reset()
{
  CURSOR_NEW_STATE("::reset()");
  CURSOR_NEW_STATE("::doOpen()");

  return realCursor->reset();
}

int SEAPITesterCursor::close()
{
  CURSOR_NEW_STATE("::close()");
  CURSOR_NEW_STATE("Cursor()");

  return realCursor->close();
}

void SEAPITesterCursor::position(const unsigned char *record)
{
  CURSOR_NEW_STATE("::position()");

  /* We need to use the correct buffer for upper layer */
  realCursor->ref= ref;

  realCursor->position(record);
}

int SEAPITesterCursor::info(uint32_t flag)
{
  int r;
  CURSOR_NEW_STATE("::info()");
  CURSOR_NEW_STATE("locked");

  r= realCursor->info(flag);

  if (flag & (HA_STATUS_VARIABLE|HA_STATUS_AUTO|HA_STATUS_CONST))
  {
    stats= realCursor->stats;
  }

  if (flag & HA_STATUS_ERRKEY)
    errkey= realCursor->errkey;

  return r;
}

const char * SEAPITesterCursor::index_type(uint32_t key_number)
{
  CURSOR_NEW_STATE("::index_type()");
  return realCursor->index_type(key_number);
}

int SEAPITesterCursor::doStartIndexScan(uint32_t keynr, bool scan)
{
  int r;
  CURSOR_NEW_STATE("::doStartIndexScan()");

  if (error_injected == 4)
  {
    CURSOR_NEW_STATE("::doStartIndexScan() ERROR");
    CURSOR_NEW_STATE("locked");
    return HA_ERR_LOCK_DEADLOCK;
  }

  r= realCursor->doStartIndexScan(keynr, scan);

  active_index= realCursor->get_index();

  return r;
}

int SEAPITesterCursor::index_read(unsigned char *buf,
                                  const unsigned char *key_ptr,
                                  uint32_t key_len,
                                  drizzled::ha_rkey_function find_flag)
{
  CURSOR_NEW_STATE("::index_read()");
  CURSOR_NEW_STATE("::doStartIndexScan()");
  return realCursor->index_read(buf, key_ptr, key_len, find_flag);
}

int SEAPITesterCursor::index_read_idx_map(unsigned char * buf,
                                          uint32_t index,
                                          const unsigned char * key,
                                          drizzled::key_part_map keypart_map,
                                          drizzled::ha_rkey_function find_flag)
{
  CURSOR_NEW_STATE("::index_read_idx_map()");
  CURSOR_NEW_STATE("locked");
  return realCursor->index_read_idx_map(buf, index, key, keypart_map, find_flag);
}

int SEAPITesterCursor::index_next(unsigned char * buf)
{
  CURSOR_NEW_STATE("::index_next()");
  CURSOR_NEW_STATE("::doStartIndexScan()");
  return realCursor->index_next(buf);
}

int SEAPITesterCursor::doEndIndexScan()
{
  CURSOR_NEW_STATE("::doEndIndexScan()");
  CURSOR_NEW_STATE("locked");
  int r= realCursor->doEndIndexScan();

  active_index= realCursor->get_index();

  return r;
}

int SEAPITesterCursor::index_prev(unsigned char * buf)
{
  CURSOR_NEW_STATE("::index_prev()");
  CURSOR_NEW_STATE("::doStartIndexScan()");
  return realCursor->index_prev(buf);
}

int SEAPITesterCursor::index_first(unsigned char * buf)
{
  CURSOR_NEW_STATE("::index_first()");
  CURSOR_NEW_STATE("::doStartIndexScan()");
  return realCursor->index_first(buf);
}

int SEAPITesterCursor::index_last(unsigned char * buf)
{
  CURSOR_NEW_STATE("::index_last()");
  CURSOR_NEW_STATE("::doStartIndexScan()");
  return realCursor->index_last(buf);
}

int SEAPITesterCursor::external_lock(Session *session, int lock_type)
{
  CURSOR_NEW_STATE("::external_lock()");
  CURSOR_NEW_STATE("locked");

  user_session= session;

  return realCursor->external_lock(session, lock_type);
}

THR_LOCK_DATA **SEAPITesterCursor::store_lock(Session *session,
                                              THR_LOCK_DATA **to,
                                              enum thr_lock_type lock_type)

{
  CURSOR_NEW_STATE("::store_lock()");

  return realCursor->store_lock(session, to, lock_type);
}

void SEAPITesterCursor::CURSOR_NEW_STATE(const string &new_state)
{
  state_multimap_iter cur= cursor_state_transitions.find(cursor_state);
  if (cursor_state_transitions.count(cursor_state) == 0)
  {
    std::cerr << "ERROR: Invalid Cursor state: " << cursor_state << std::endl
      << "This should *NEVER* happen."
      << std::endl
      << "i.e. you've really screwed it up and you should be ashamed of "
      << "yourself." << std::endl;
    assert(cursor_state_transitions.count(cursor_state));
  }

  for(cur= cursor_state_transitions.lower_bound(cursor_state);
      cur != cursor_state_transitions.upper_bound(cursor_state);
      cur++)
  {
    if (new_state.compare((*cur).second) == 0)
      break;
  }

  if (cur == cursor_state_transitions.end()
      || new_state.compare((*cur).second))
  {
    std::cerr << "ERROR: Invalid Cursor state transition!" << std::endl
         << "Cursor " << this << "Cannot go from "
         << cursor_state << " to " << new_state << std::endl;
    assert(false);
  }

  cursor_state= new_state;

  std::string cursor_state_str("Cursor ");
  char nr[50];
  snprintf(nr, sizeof(nr), "%"PRIu64, this->id);
  cursor_state_str.append(nr);
  cursor_state_str.append(" ");
  cursor_state_str.append(cursor_state);

  engine_state_history.push_back(cursor_state_str);

  std::cerr << "\t\tCursor " << this << " STATE : " << cursor_state << std::endl;
}

} /* namespace drizzled */

static const char *api_tester_exts[] = {
  NULL
};

namespace drizzled {
  namespace plugin {
class SEAPITester : public drizzled::plugin::TransactionalStorageEngine
{
public:
  /* BUG: Currently flags are just copy&pasted from innobase. Instead, we
     need to have a call somewhere.
   */
  SEAPITester(const string &name_arg)
    : drizzled::plugin::TransactionalStorageEngine(name_arg,
                            HTON_NULL_IN_KEY |
                            HTON_CAN_INDEX_BLOBS |
                            HTON_PRIMARY_KEY_IN_READ_INDEX |
                            HTON_PARTIAL_COLUMN_READ |
                            HTON_TABLE_SCAN_ON_INDEX |
                            HTON_HAS_FOREIGN_KEYS |
                            HTON_HAS_DOES_TRANSACTIONS)
  {
    ENGINE_NEW_STATE("::SEAPITester()");
  }

  ~SEAPITester()
  {
    ENGINE_NEW_STATE("::~SEAPITester()");
  }

  const char **bas_ext() const {
    return api_tester_exts;
  }

  virtual Cursor *create(Table &table)
  {
    SEAPITesterCursor *c= new SEAPITesterCursor(*this, table);
    Cursor *realCursor= getRealEngine()->create(table);
    c->realCursor= realCursor;

    return c;
  }

  int doCreateTable(Session&,
                    Table&,
                    const drizzled::identifier::Table &identifier,
                    const drizzled::message::Table& create_proto);

  int doDropTable(Session&, const identifier::Table &identifier);

  int doRenameTable(drizzled::Session& session,
                    const drizzled::identifier::Table& from,
                    const drizzled::identifier::Table& to)
    { return getRealEngine()->renameTable(session, from, to); }

  int doGetTableDefinition(Session& ,
                           const identifier::Table &,
                           drizzled::message::Table &);

  bool doDoesTableExist(Session&, const identifier::Table &identifier);

  void doGetTableIdentifiers(drizzled::CachedDirectory &,
                             const drizzled::identifier::Schema &,
                             drizzled::identifier::table::vector &);

  virtual int doStartTransaction(Session *session,
                                 start_transaction_option_t options);
  virtual void doStartStatement(Session *session);
  virtual void doEndStatement(Session *session);

  virtual int doSetSavepoint(Session*,
                             drizzled::NamedSavepoint &)
    {
      ENGINE_NEW_STATE("SET SAVEPOINT");
      ENGINE_NEW_STATE("In Transaction");
      return 0; }
  virtual int doRollbackToSavepoint(Session*,
                                     drizzled::NamedSavepoint &)
    {
      ENGINE_NEW_STATE("ROLLBACK TO SAVEPOINT");
      ENGINE_NEW_STATE("In Transaction");
      return 0; }
  virtual int doReleaseSavepoint(Session*,
                                 drizzled::NamedSavepoint &)
    {
      ENGINE_NEW_STATE("RELEASE SAVEPOINT");
      ENGINE_NEW_STATE("In Transaction");
      return 0; }
  virtual int doCommit(Session*, bool);

  virtual int doRollback(Session*, bool);

  uint32_t max_supported_record_length(void) const {
    ENGINE_NEW_STATE("::max_supported_record_length()");
    return getRealEngine()->max_supported_record_length();
  }

  uint32_t max_supported_keys(void) const {
    ENGINE_NEW_STATE("::max_supported_keys()");
    return getRealEngine()->max_supported_keys();
  }

  uint32_t max_supported_key_parts(void) const {
    ENGINE_NEW_STATE("::max_supported_key_parts()");
    return getRealEngine()->max_supported_key_parts();
  }

  uint32_t max_supported_key_length(void) const {
    ENGINE_NEW_STATE("::max_supported_key_length()");
    return getRealEngine()->max_supported_key_length();
  }

  uint32_t max_supported_key_part_length(void) const {
    ENGINE_NEW_STATE("::max_supported_key_part_length()");
    return getRealEngine()->max_supported_key_part_length();
  }

  /* just copied from innobase... */
  uint32_t index_flags(enum  ha_key_alg) const
  {
    return (HA_READ_NEXT |
            HA_READ_PREV |
            HA_READ_RANGE |
            HA_READ_ORDER |
            HA_KEYREAD_ONLY);
  }

};

bool SEAPITester::doDoesTableExist(Session &session, const identifier::Table &identifier)
{
  return getRealEngine()->doDoesTableExist(session, identifier);
}

void SEAPITester::doGetTableIdentifiers(drizzled::CachedDirectory &cd,
                                        const drizzled::identifier::Schema &si,
                                        drizzled::identifier::table::vector &ti)
{
  return getRealEngine()->doGetTableIdentifiers(cd, si, ti);
}

int SEAPITester::doCreateTable(Session& session,
                               Table& table,
                               const drizzled::identifier::Table &identifier,
                               const drizzled::message::Table& create_proto)
{
  ENGINE_NEW_STATE("::doCreateTable()");

  int r= getRealEngine()->doCreateTable(session, table, identifier, create_proto);

  ENGINE_NEW_STATE("::SEAPITester()");
  return r;
}

int SEAPITester::doDropTable(Session& session, const identifier::Table &identifier)
{
  return getRealEngine()->doDropTable(session, identifier);
}

int SEAPITester::doGetTableDefinition(Session& session,
                                      const identifier::Table &identifier,
                                      drizzled::message::Table &table)
{
  return getRealEngine()->doGetTableDefinition(session, identifier, table);
}

int SEAPITester::doStartTransaction(Session *session,
                                    start_transaction_option_t opt)
{
  ENGINE_NEW_STATE("BEGIN");
  ENGINE_NEW_STATE("In Transaction");

  return getRealEngine()->startTransaction(session, opt);
}

void SEAPITester::doStartStatement(Session *session)
{
  ENGINE_NEW_STATE("START STATEMENT");
  return getRealEngine()->startStatement(session);
}

void SEAPITester::doEndStatement(Session *session)
{
  ENGINE_NEW_STATE("END STATEMENT");
  return getRealEngine()->endStatement(session);
}

int SEAPITester::doCommit(Session *session, bool all)
{
  if (all)
  {
    ENGINE_NEW_STATE("COMMIT");
    ENGINE_NEW_STATE("::SEAPITester()");
  }
  else
  {
    ENGINE_NEW_STATE("COMMIT STATEMENT");
    ENGINE_NEW_STATE("In Transaction");
  }
  return getRealEngine()->commit(session, all);
}

int SEAPITester::doRollback(Session *session, bool all)
{
  if (all)
  {
    ENGINE_NEW_STATE("ROLLBACK");
    ENGINE_NEW_STATE("::SEAPITester()");
  }
  else
  {
    ENGINE_NEW_STATE("ROLLBACK STATEMENT");
    ENGINE_NEW_STATE("In Transaction");
  }

  return getRealEngine()->rollback(session, all);
}

  } /* namespace plugin */
} /* namespace drizzled */

static int seapi_tester_init(drizzled::module::Context &context)
{
  load_engine_state_transitions(engine_state_transitions);
  load_cursor_state_transitions(cursor_state_transitions);
  engine_state= "INIT";

  context.add(new plugin::SEAPITester(engine_name));

  context.add(new plugin::Create_function<SEAPITesterErrorInjectFunc>("seapitester_error_inject"));

  engine_state_history_table_initialize(context);

  return 0;
}

DRIZZLE_DECLARE_PLUGIN
{
  DRIZZLE_VERSION_ID,
  "SEAPITESTER",
  "1.0",
  "Stewart Smith",
  "Test the Storage Engine API callls are in correct order",
  PLUGIN_LICENSE_GPL,
  seapi_tester_init,     /* Plugin Init */
  NULL, /* depends */
  NULL                /* config options   */
}
DRIZZLE_DECLARE_PLUGIN_END;