123
typedef hash_map<std::string, StorageEngine *> EngineMap;
124
typedef std::vector<StorageEngine *> EngineVector;
122
126
extern const std::string UNKNOWN_STRING;
123
127
extern const std::string DEFAULT_DEFINITION_FILE_EXT;
130
134
usually StorageEngine instance is defined statically in ha_xxx.cc as
132
136
static StorageEngine { ... } xxx_engine;
134
savepoint_*, prepare, recover, and *_by_xid pointers can be 0.
136
138
class StorageEngine : public Plugin
139
141
typedef uint64_t Table_flags;
144
Name used for storage engine.
146
const bool two_phase_commit;
149
146
const std::bitset<HTON_BIT_SIZE> flags; /* global Cursor flags */
151
void setTransactionReadWrite(Session& session);
148
virtual void setTransactionReadWrite(Session& session);
154
151
std::string table_definition_ext;
183
180
ProtoCache proto_cache;
184
181
pthread_mutex_t proto_cache_mutex;
187
* Implementing classes should override these to provide savepoint
190
virtual int savepoint_set_hook(Session *, NamedSavepoint &) { return 0; }
192
virtual int savepoint_rollback_hook(Session *, NamedSavepoint &) { return 0; }
194
virtual int savepoint_release_hook(Session *, NamedSavepoint &) { return 0; }
198
185
StorageEngine(const std::string name_arg,
199
const std::bitset<HTON_BIT_SIZE> &flags_arg= HTON_NO_FLAGS,
200
bool support_2pc= false);
186
const std::bitset<HTON_BIT_SIZE> &flags_arg= HTON_NO_FLAGS);
202
188
virtual ~StorageEngine();
285
'all' is true if it's a real commit, that makes persistent changes
286
'all' is false if it's not in fact a commit but an end of the
287
statement that is part of the transaction.
288
NOTE 'all' is also false in auto-commit mode where 'end of statement'
289
and 'real commit' mean the same event.
291
virtual int commit(Session *, bool)
296
virtual int rollback(Session *, bool)
302
The void * points to an uninitialized storage area of requested size
303
(see savepoint_offset description)
305
int savepoint_set(Session *session, NamedSavepoint &sp)
307
return savepoint_set_hook(session, sp);
311
The void * points to a storage area, that was earlier passed
312
to the savepoint_set call
314
int savepoint_rollback(Session *session, NamedSavepoint &sp)
316
return savepoint_rollback_hook(session, sp);
319
int savepoint_release(Session *session, NamedSavepoint &sp)
321
return savepoint_release_hook(session, sp);
324
virtual int prepare(Session *, bool) { return 0; }
325
virtual int recover(XID *, uint32_t) { return 0; }
326
virtual int commit_by_xid(XID *) { return 0; }
327
virtual int rollback_by_xid(XID *) { return 0; }
328
265
virtual Cursor *create(TableShare &, memory::Root *)= 0;
330
267
virtual void drop_database(char*) { }
397
332
std::string find_str);
398
333
static void closeConnection(Session* session);
399
334
static void dropDatabase(char* path);
400
static int commitOrRollbackByXID(XID *xid, bool commit);
401
static int releaseTemporaryLatches(Session *session);
402
335
static bool flushLogs(plugin::StorageEngine *db_type);
403
static int recover(HASH *commit_list);
404
static int startConsistentSnapshot(Session *session);
405
336
static int dropTable(Session& session,
406
337
TableIdentifier &identifier,
407
338
bool generate_warning);