212
212
static INNOBASE_SHARE *get_share(const char *table_name);
213
213
static void free_share(INNOBASE_SHARE *share);
214
static int innobase_close_connection(StorageEngine *hton, Session* session);
215
static int innobase_commit(StorageEngine *hton, Session* session, bool all);
216
static int innobase_rollback(StorageEngine *hton, Session* session, bool all);
217
static int innobase_rollback_to_savepoint(StorageEngine *hton, Session* session,
219
static int innobase_savepoint(StorageEngine *hton, Session* session, void *savepoint);
220
static int innobase_release_savepoint(StorageEngine *hton, Session* session,
222
static handler *innobase_create_handler(StorageEngine *hton,
214
static int innobase_close_connection(StorageEngine *engine, Session* session);
215
static int innobase_commit(StorageEngine *engine, Session* session, bool all);
216
static int innobase_rollback(StorageEngine *engine, Session* session, bool all);
217
static int innobase_rollback_to_savepoint(StorageEngine *engine, Session* session,
219
static int innobase_savepoint(StorageEngine *engine, Session* session, void *savepoint);
220
static int innobase_release_savepoint(StorageEngine *engine, Session* session,
222
static handler *innobase_create_handler(StorageEngine *engine,
223
223
TABLE_SHARE *table,
224
224
MEM_ROOT *mem_root);
274
274
NULL, NULL, 50, 1, 1024 * 1024 * 1024, 0);
277
static handler *innobase_create_handler(StorageEngine *hton,
277
static handler *innobase_create_handler(StorageEngine *engine,
278
278
TABLE_SHARE *table,
279
279
MEM_ROOT *mem_root)
281
return new (mem_root) ha_innobase(hton, table);
281
return new (mem_root) ha_innobase(engine, table);
284
284
/***********************************************************************
288
288
innobase_xa_prepare(
289
289
/*================*/
290
290
/* out: 0 or error number */
291
StorageEngine* engine,
292
292
Session* session, /* in: handle to the MySQL thread of the user
293
293
whose XA transaction should be prepared */
294
294
bool all); /* in: TRUE - commit transaction
301
301
/*================*/
302
302
/* out: number of prepared transactions
303
303
stored in xid_list */
304
StorageEngine* engine,
305
305
XID* xid_list, /* in/out: prepared transactions */
306
306
uint len); /* in: number of slots in xid_list */
307
307
/***********************************************************************
312
312
innobase_commit_by_xid(
313
313
/*===================*/
314
314
/* out: 0 or error number */
315
StorageEngine* engine,
316
316
XID* xid); /* in: X/Open XA transaction identification */
317
317
/***********************************************************************
318
318
This function is used to rollback one X/Open XA distributed transaction
322
322
innobase_rollback_by_xid(
323
323
/*=====================*/
324
324
/* out: 0 or error number */
325
StorageEngine* engine,
326
326
XID *xid); /* in: X/Open XA transaction identification */
327
327
/*********************************************************************
328
328
Removes all tables in the named database inside InnoDB. */
331
331
innobase_drop_database(
332
332
/*===================*/
333
333
/* out: error number */
334
StorageEngine* hton, /* in: StorageEngine of Innodb */
334
StorageEngine* engine, /* in: StorageEngine of Innodb */
335
335
char* path); /* in: database path; inside InnoDB the name
336
336
of the last directory in the path is used as
337
337
the database name: for example, in 'mysql/data/test'
352
352
innobase_start_trx_and_assign_read_view(
353
353
/*====================================*/
355
StorageEngine* hton, /* in: Innodb StorageEngine */
355
StorageEngine* engine, /* in: Innodb StorageEngine */
356
356
Session* session); /* in: MySQL thread handle of the user for whom
357
357
the transaction should be committed */
358
358
/********************************************************************
363
363
innobase_flush_logs(
364
364
/*================*/
365
365
/* out: TRUE if error */
366
StorageEngine* hton); /* in: InnoDB StorageEngine */
366
StorageEngine* engine); /* in: InnoDB StorageEngine */
368
368
/****************************************************************************
369
369
Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB
373
373
innodb_show_status(
374
374
/*===============*/
375
StorageEngine* hton, /* in: the innodb StorageEngine */
375
StorageEngine* engine, /* in: the innodb StorageEngine */
376
376
Session* session, /* in: the MySQL query thread of the caller */
377
377
stat_print_fn *stat_print);
379
bool innobase_show_status(StorageEngine *hton, Session* session,
379
bool innobase_show_status(StorageEngine *engine, Session* session,
380
380
stat_print_fn* stat_print,
381
381
enum ha_stat_type stat_type);
642
642
innobase_release_temporary_latches(
643
643
/*===============================*/
645
StorageEngine *hton, /* in: StorageEngine */
645
StorageEngine *engine, /* in: StorageEngine */
646
646
Session* session) /* in: MySQL thread */
650
assert(hton == innodb_hton_ptr);
650
assert(engine == innodb_hton_ptr);
652
652
if (!innodb_inited) {
1279
1279
/*************************************************************************
1280
1280
Construct ha_innobase handler. */
1282
ha_innobase::ha_innobase(StorageEngine *hton, TABLE_SHARE *table_arg)
1283
:handler(hton, table_arg),
1282
ha_innobase::ha_innobase(StorageEngine *engine, TABLE_SHARE *table_arg)
1283
:handler(engine, table_arg),
1284
1284
int_table_flags(HA_REC_NOT_IN_SEQ |
1285
1285
HA_NULL_IN_KEY |
1286
1286
HA_CAN_INDEX_BLOBS |
1351
1351
innobase_register_stmt(
1352
1352
/*===================*/
1353
StorageEngine* hton, /* in: Innobase hton */
1353
StorageEngine* engine, /* in: Innobase engine */
1354
1354
Session* session) /* in: MySQL session (connection) object */
1356
assert(hton == innodb_hton_ptr);
1356
assert(engine == innodb_hton_ptr);
1357
1357
/* Register the statement */
1358
trans_register_ha(session, FALSE, hton);
1358
trans_register_ha(session, FALSE, engine);
1361
1361
/*************************************************************************
1370
1370
innobase_register_trx_and_stmt(
1371
1371
/*===========================*/
1372
StorageEngine *hton, /* in: Innobase StorageEngine */
1372
StorageEngine *engine, /* in: Innobase StorageEngine */
1373
1373
Session* session) /* in: MySQL session (connection) object */
1375
1375
/* NOTE that actually innobase_register_stmt() registers also
1376
1376
the transaction in the AUTOCOMMIT=1 mode. */
1378
innobase_register_stmt(hton, session);
1378
innobase_register_stmt(engine, session);
1380
1380
if (session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
1382
1382
/* No autocommit mode, register for a transaction */
1383
trans_register_ha(session, TRUE, hton);
1383
trans_register_ha(session, TRUE, engine);
2153
2153
the logs, and the name of this function should be innobase_checkpoint. */
2156
innobase_flush_logs(StorageEngine *hton)
2156
innobase_flush_logs(StorageEngine *engine)
2157
2157
/*=====================*/
2158
2158
/* out: TRUE if error */
2160
2160
bool result = 0;
2162
assert(hton == innodb_hton_ptr);
2162
assert(engine == innodb_hton_ptr);
2164
2164
log_buffer_flush_to_disk();
2192
2192
innobase_start_trx_and_assign_read_view(
2193
2193
/*====================================*/
2195
StorageEngine *hton, /* in: Innodb StorageEngine */
2195
StorageEngine *engine, /* in: Innodb StorageEngine */
2196
2196
Session* session) /* in: MySQL thread handle of the user for whom
2197
2197
the transaction should be committed */
2201
assert(hton == innodb_hton_ptr);
2201
assert(engine == innodb_hton_ptr);
2203
2203
/* Create a new trx struct for session, if it does not yet have one */
2221
2221
/* Set the MySQL flag to mark that there is an active transaction */
2223
2223
if (trx->active_trans == 0) {
2224
innobase_register_trx_and_stmt(hton, current_session);
2224
innobase_register_trx_and_stmt(engine, current_session);
2225
2225
trx->active_trans = 1;
2236
2236
innobase_commit(
2237
2237
/*============*/
2239
StorageEngine *hton, /* in: Innodb StorageEngine */
2239
StorageEngine *engine, /* in: Innodb StorageEngine */
2240
2240
Session* session, /* in: MySQL thread handle of the user for whom
2241
2241
the transaction should be committed */
2242
2242
bool all) /* in: TRUE - commit transaction
2360
2360
innobase_rollback(
2361
2361
/*==============*/
2362
2362
/* out: 0 or error number */
2363
StorageEngine *hton, /* in: Innodb StorageEngine */
2363
StorageEngine *engine, /* in: Innodb StorageEngine */
2364
2364
Session* session, /* in: handle to the MySQL thread of the user
2365
2365
whose transaction should be rolled back */
2366
2366
bool all) /* in: TRUE - commit transaction
2433
2433
/*===========================*/
2434
2434
/* out: 0 if success, HA_ERR_NO_SAVEPOINT if
2435
2435
no savepoint with the given name */
2436
StorageEngine *hton, /* in: Innodb StorageEngine */
2436
StorageEngine *engine, /* in: Innodb StorageEngine */
2437
2437
Session* session, /* in: handle to the MySQL thread of the user
2438
2438
whose transaction should be rolled back */
2439
2439
void* savepoint) /* in: savepoint data */
2470
2470
/*=======================*/
2471
2471
/* out: 0 if success, HA_ERR_NO_SAVEPOINT if
2472
2472
no savepoint with the given name */
2473
StorageEngine* hton, /* in: StorageEngine for Innodb */
2473
StorageEngine* engine, /* in: StorageEngine for Innodb */
2474
2474
Session* session, /* in: handle to the MySQL thread of the user
2475
2475
whose transaction should be rolled back */
2476
2476
void* savepoint) /* in: savepoint data */
2499
2499
innobase_savepoint(
2500
2500
/*===============*/
2501
2501
/* out: always 0, that is, always succeeds */
2502
StorageEngine* hton, /* in: handle to the Innodb StorageEngine */
2502
StorageEngine* engine, /* in: handle to the Innodb StorageEngine */
2503
2503
Session* session, /* in: handle to the MySQL thread */
2504
2504
void* savepoint) /* in: savepoint data */
2509
assert(hton == innodb_hton_ptr);
2509
assert(engine == innodb_hton_ptr);
2512
2512
In the autocommit mode there is no sense to set a savepoint
2541
2541
innobase_close_connection(
2542
2542
/*======================*/
2543
2543
/* out: 0 or error number */
2544
StorageEngine* hton, /* in: innobase StorageEngine */
2544
StorageEngine* engine, /* in: innobase StorageEngine */
2545
2545
Session* session) /* in: handle to the MySQL thread of the user
2546
2546
whose resources should be free'd */
2550
assert(hton == innodb_hton_ptr);
2550
assert(engine == innodb_hton_ptr);
2551
2551
trx = session_to_trx(session);
6271
6271
innobase_drop_database(
6272
6272
/*===================*/
6273
6273
/* out: error number */
6274
StorageEngine *hton, /* in: StorageEngine of Innodb */
6274
StorageEngine *engine, /* in: StorageEngine of Innodb */
6275
6275
char* path) /* in: database path; inside InnoDB the name
6276
6276
of the last directory in the path is used as
6277
6277
the database name: for example, in 'mysql/data/test'
6287
6287
/* Get the transaction associated with the current session, or create one
6288
6288
if not yet created */
6290
assert(hton == innodb_hton_ptr);
6290
assert(engine == innodb_hton_ptr);
6292
6292
/* In the Windows plugin, session = current_session is always NULL */
7759
7759
innodb_show_status(
7760
7760
/*===============*/
7761
StorageEngine* hton, /* in: the innodb StorageEngine */
7761
StorageEngine* engine, /* in: the innodb StorageEngine */
7762
7762
Session* session, /* in: the MySQL query thread of the caller */
7763
7763
stat_print_fn *stat_print)
7768
7768
ulint trx_list_start = ULINT_UNDEFINED;
7769
7769
ulint trx_list_end = ULINT_UNDEFINED;
7771
assert(hton == innodb_hton_ptr);
7771
assert(engine == innodb_hton_ptr);
7773
7773
trx = check_trx_exists(session);
7846
7846
innodb_mutex_show_status(
7847
7847
/*=====================*/
7848
StorageEngine* hton, /* in: the innodb StorageEngine */
7848
StorageEngine* engine, /* in: the innodb StorageEngine */
7849
7849
Session* session, /* in: the MySQL query thread of the
7851
7851
stat_print_fn* stat_print)
7862
7862
uint64_t rw_lock_wait_time= 0;
7863
7863
#endif /* UNIV_DEBUG */
7864
7864
uint hton_name_len= strlen(innobase_hton_name), buf1len, buf2len;
7865
assert(hton == innodb_hton_ptr);
7865
assert(engine == innodb_hton_ptr);
7867
7867
mutex_enter(&mutex_list_mutex);
7967
bool innobase_show_status(StorageEngine *hton, Session* session,
7967
bool innobase_show_status(StorageEngine *engine, Session* session,
7968
7968
stat_print_fn* stat_print,
7969
7969
enum ha_stat_type stat_type)
7971
assert(hton == innodb_hton_ptr);
7971
assert(engine == innodb_hton_ptr);
7973
7973
switch (stat_type) {
7974
7974
case HA_ENGINE_STATUS:
7975
return innodb_show_status(hton, session, stat_print);
7975
return innodb_show_status(engine, session, stat_print);
7976
7976
case HA_ENGINE_MUTEX:
7977
return innodb_mutex_show_status(hton, session, stat_print);
7977
return innodb_mutex_show_status(engine, session, stat_print);
8660
8660
innobase_xa_prepare(
8661
8661
/*================*/
8662
8662
/* out: 0 or error number */
8663
StorageEngine *hton,
8663
StorageEngine *engine,
8664
8664
Session* session, /* in: handle to the MySQL thread of the user
8665
8665
whose XA transaction should be prepared */
8666
8666
bool all) /* in: TRUE - commit transaction
8670
8670
trx_t* trx = check_trx_exists(session);
8672
assert(hton == innodb_hton_ptr);
8672
assert(engine == innodb_hton_ptr);
8674
8674
if (all || !session_test_options(session, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
8761
8761
/*================*/
8762
8762
/* out: number of prepared transactions
8763
8763
stored in xid_list */
8764
StorageEngine *hton,
8764
StorageEngine *engine,
8765
8765
XID* xid_list, /* in/out: prepared transactions */
8766
8766
uint len) /* in: number of slots in xid_list */
8768
assert(hton == innodb_hton_ptr);
8768
assert(engine == innodb_hton_ptr);
8770
8770
if (len == 0 || xid_list == NULL) {
8783
8783
innobase_commit_by_xid(
8784
8784
/*===================*/
8785
8785
/* out: 0 or error number */
8786
StorageEngine *hton,
8786
StorageEngine *engine,
8787
8787
XID* xid) /* in: X/Open XA transaction identification */
8791
assert(hton == innodb_hton_ptr);
8791
assert(engine == innodb_hton_ptr);
8793
8793
trx = trx_get_trx_by_xid(xid);
8809
8809
innobase_rollback_by_xid(
8810
8810
/*=====================*/
8811
8811
/* out: 0 or error number */
8812
StorageEngine *hton,
8812
StorageEngine *engine,
8813
8813
XID *xid) /* in: X/Open XA transaction identification */
8817
assert(hton == innodb_hton_ptr);
8817
assert(engine == innodb_hton_ptr);
8819
8819
trx = trx_get_trx_by_xid(xid);