Commit f3a617f3 authored by marko's avatar marko

branches/zip: Merge revisions 869:887 from trunk.

parent 66ae0ded
......@@ -24,3 +24,6 @@ noinst_LIBRARIES = libhandler.a
libhandler_a_SOURCES = ha_innodb.cc
EXTRA_PROGRAMS =
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -54,6 +54,12 @@ pthread_cond_t commit_cond;
pthread_mutex_t commit_cond_m;
bool innodb_inited= 0;
/*
This needs to exist until the query cache callback is removed
or learns to pass hton.
*/
static handlerton *legacy_innodb_hton;
/*-----------------------------------------------------------------*/
/* These variables are used to implement (semi-)synchronous MySQL binlog
replication for InnoDB tables. */
......@@ -197,22 +203,25 @@ static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
my_bool not_used __attribute__((unused)));
static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share);
static int innobase_close_connection(THD* thd);
static int innobase_commit(THD* thd, bool all);
static int innobase_rollback(THD* thd, bool all);
static int innobase_rollback_to_savepoint(THD* thd, void *savepoint);
static int innobase_savepoint(THD* thd, void *savepoint);
static int innobase_release_savepoint(THD* thd, void *savepoint);
static handler *innobase_create_handler(TABLE_SHARE *table,
static int innobase_close_connection(handlerton *hton, THD* thd);
static int innobase_commit(handlerton *hton, THD* thd, bool all);
static int innobase_rollback(handlerton *hton, THD* thd, bool all);
static int innobase_rollback_to_savepoint(handlerton *hton, THD* thd,
void *savepoint);
static int innobase_savepoint(handlerton *hton, THD* thd, void *savepoint);
static int innobase_release_savepoint(handlerton *hton, THD* thd,
void *savepoint);
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root);
static const char innobase_hton_name[]= "InnoDB";
handlerton *innobase_hton;
static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table,
MEM_ROOT *mem_root)
{
return new (mem_root) ha_innobase(table);
return new (mem_root) ha_innobase(hton, table);
}
......@@ -380,6 +389,7 @@ documentation, see handler.cc. */
int
innobase_release_temporary_latches(
/*===============================*/
handlerton *hton,
THD *thd)
{
trx_t* trx;
......@@ -389,7 +399,7 @@ innobase_release_temporary_latches(
return 0;
}
trx = (trx_t*) thd->ha_data[innobase_hton->slot];
trx = (trx_t*) thd->ha_data[hton->slot];
if (trx) {
innobase_release_stat_resources(trx);
......@@ -841,13 +851,14 @@ trx_t*
check_trx_exists(
/*=============*/
/* out: InnoDB transaction handle */
handlerton* hton, /* in: handlerton for innodb */
THD* thd) /* in: user thread handle */
{
trx_t* trx;
ut_ad(thd == current_thd);
trx = (trx_t*) thd->ha_data[innobase_hton->slot];
trx = (trx_t*) thd->ha_data[hton->slot];
if (trx == NULL) {
DBUG_ASSERT(thd != NULL);
......@@ -861,7 +872,7 @@ check_trx_exists(
CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
thd->ha_data[innobase_hton->slot] = trx;
thd->ha_data[hton->slot] = trx;
} else {
if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption(trx);
......@@ -889,8 +900,8 @@ check_trx_exists(
/*************************************************************************
Construct ha_innobase handler. */
ha_innobase::ha_innobase(TABLE_SHARE *table_arg)
:handler(innobase_hton, table_arg),
ha_innobase::ha_innobase(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg),
int_table_flags(HA_REC_NOT_IN_SEQ |
HA_NULL_IN_KEY |
HA_CAN_INDEX_BLOBS |
......@@ -917,7 +928,7 @@ ha_innobase::update_thd(
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
trx = check_trx_exists(thd);
trx = check_trx_exists(ht, thd);
if (prebuilt->trx != trx) {
......@@ -938,10 +949,11 @@ inline
void
innobase_register_stmt(
/*===================*/
handlerton* hton, /* in: Innobase hton */
THD* thd) /* in: MySQL thd (connection) object */
{
/* Register the statement */
trans_register_ha(thd, FALSE, innobase_hton);
trans_register_ha(thd, FALSE, hton);
}
/*************************************************************************
......@@ -955,17 +967,18 @@ inline
void
innobase_register_trx_and_stmt(
/*===========================*/
handlerton *hton, /* in: Innobase handlerton */
THD* thd) /* in: MySQL thd (connection) object */
{
/* NOTE that actually innobase_register_stmt() registers also
the transaction in the AUTOCOMMIT=1 mode. */
innobase_register_stmt(thd);
innobase_register_stmt(hton, thd);
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
/* No autocommit mode, register for a transaction */
trans_register_ha(thd, TRUE, innobase_hton);
trans_register_ha(thd, TRUE, hton);
}
}
......@@ -1061,7 +1074,7 @@ innobase_query_caching_of_table_permitted(
return((my_bool)FALSE);
}
trx = check_trx_exists(thd);
trx = check_trx_exists(legacy_innodb_hton, thd);
if (trx->has_search_latch) {
ut_print_timestamp(stderr);
sql_print_error("The calling thread is holding the adaptive "
......@@ -1120,7 +1133,7 @@ innobase_query_caching_of_table_permitted(
if (trx->active_trans == 0) {
innobase_register_trx_and_stmt(thd);
innobase_register_trx_and_stmt(legacy_innodb_hton, thd);
trx->active_trans = 1;
}
......@@ -1295,7 +1308,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
if (prebuilt->trx->active_trans == 0) {
innobase_register_trx_and_stmt(current_thd);
innobase_register_trx_and_stmt(ht, current_thd);
prebuilt->trx->active_trans = 1;
}
......@@ -1338,7 +1351,8 @@ innobase_init(void *p)
char *default_path;
DBUG_ENTER("innobase_init");
innobase_hton= (handlerton *)p;
handlerton *innobase_hton= (handlerton *)p;
legacy_innodb_hton= innobase_hton;
innobase_hton->state=have_innodb;
innobase_hton->db_type= DB_TYPE_INNODB;
......@@ -1613,7 +1627,7 @@ innobase_init(void *p)
Closes an InnoDB database. */
int
innobase_end(ha_panic_function type)
innobase_end(handlerton *hton, ha_panic_function type)
/*==============*/
/* out: TRUE if error */
{
......@@ -1651,7 +1665,7 @@ Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes
the logs, and the name of this function should be innobase_checkpoint. */
bool
innobase_flush_logs(void)
innobase_flush_logs(handlerton *hton)
/*=====================*/
/* out: TRUE if error */
{
......@@ -1690,6 +1704,7 @@ int
innobase_start_trx_and_assign_read_view(
/*====================================*/
/* out: 0 */
handlerton *hton, /* in: Innodb handlerton */
THD* thd) /* in: MySQL thread handle of the user for whom
the transaction should be committed */
{
......@@ -1699,7 +1714,7 @@ innobase_start_trx_and_assign_read_view(
/* Create a new trx struct for thd, if it does not yet have one */
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
/* This is just to play safe: release a possible FIFO ticket and
search latch. Since we will reserve the kernel mutex, we have to
......@@ -1718,9 +1733,7 @@ innobase_start_trx_and_assign_read_view(
/* Set the MySQL flag to mark that there is an active transaction */
if (trx->active_trans == 0) {
innobase_register_trx_and_stmt(current_thd);
innobase_register_trx_and_stmt(hton, current_thd);
trx->active_trans = 1;
}
......@@ -1735,6 +1748,7 @@ int
innobase_commit(
/*============*/
/* out: 0 */
handlerton *hton, /* in: Innodb handlerton */
THD* thd, /* in: MySQL thread handle of the user for whom
the transaction should be committed */
bool all) /* in: TRUE - commit transaction
......@@ -1745,7 +1759,7 @@ innobase_commit(
DBUG_ENTER("innobase_commit");
DBUG_PRINT("trans", ("ending transaction"));
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
/* Update the info whether we should skip XA steps that eat CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
......@@ -1871,6 +1885,7 @@ int
innobase_report_binlog_offset_and_commit(
/*=====================================*/
/* out: 0 */
handlerton *hton, /* in: Innodb handlerton */
THD* thd, /* in: user thread */
void* trx_handle, /* in: InnoDB trx handle */
char* log_file_name, /* in: latest binlog file name */
......@@ -1888,7 +1903,7 @@ innobase_report_binlog_offset_and_commit(
trx->flush_log_later = TRUE;
innobase_commit(thd, TRUE);
innobase_commit(hton, thd, TRUE);
trx->flush_log_later = FALSE;
......@@ -1936,11 +1951,12 @@ int
innobase_commit_complete(
/*=====================*/
/* out: 0 */
handlerton *hton, /* in: Innodb handlerton */
THD* thd) /* in: user thread */
{
trx_t* trx;
trx = (trx_t*) thd->ha_data[innobase_hton->slot];
trx = (trx_t*) thd->ha_data[hton->slot];
if (trx && trx->active_trans) {
......@@ -1964,6 +1980,7 @@ static int
innobase_rollback(
/*==============*/
/* out: 0 or error number */
handlerton *hton, /* in: Innodb handlerton */
THD* thd, /* in: handle to the MySQL thread of the user
whose transaction should be rolled back */
bool all) /* in: TRUE - commit transaction
......@@ -1975,7 +1992,7 @@ innobase_rollback(
DBUG_ENTER("innobase_rollback");
DBUG_PRINT("trans", ("aborting transaction"));
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
/* Update the info whether we should skip XA steps that eat CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
......@@ -2047,6 +2064,7 @@ innobase_rollback_to_savepoint(
/*===========================*/
/* out: 0 if success, HA_ERR_NO_SAVEPOINT if
no savepoint with the given name */
handlerton *hton, /* in: Innodb handlerton */
THD* thd, /* in: handle to the MySQL thread of the user
whose transaction should be rolled back */
void* savepoint) /* in: savepoint data */
......@@ -2058,7 +2076,7 @@ innobase_rollback_to_savepoint(
DBUG_ENTER("innobase_rollback_to_savepoint");
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
/* Release a possible FIFO ticket and search latch. Since we will
reserve the kernel mutex, we have to release the search system latch
......@@ -2083,6 +2101,7 @@ innobase_release_savepoint(
/*=======================*/
/* out: 0 if success, HA_ERR_NO_SAVEPOINT if
no savepoint with the given name */
handlerton* hton, /* in: handlerton for Innodb */
THD* thd, /* in: handle to the MySQL thread of the user
whose transaction should be rolled back */
void* savepoint) /* in: savepoint data */
......@@ -2093,7 +2112,7 @@ innobase_release_savepoint(
DBUG_ENTER("innobase_release_savepoint");
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
/* TODO: use provided savepoint data area to store savepoint data */
......@@ -2111,6 +2130,7 @@ int
innobase_savepoint(
/*===============*/
/* out: always 0, that is, always succeeds */
handlerton* hton, /* in: handle to the Innodb handlerton */
THD* thd, /* in: handle to the MySQL thread */
void* savepoint) /* in: savepoint data */
{
......@@ -2127,7 +2147,7 @@ innobase_savepoint(
DBUG_ASSERT(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) ||
thd->in_sub_stmt);
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
/* Release a possible FIFO ticket and search latch. Since we will
reserve the kernel mutex, we have to release the search system latch
......@@ -2154,12 +2174,13 @@ int
innobase_close_connection(
/*======================*/
/* out: 0 or error number */
handlerton* hton, /* in: innobase handlerton */
THD* thd) /* in: handle to the MySQL thread of the user
whose resources should be free'd */
{
trx_t* trx;
trx = (trx_t*)thd->ha_data[innobase_hton->slot];
trx = (trx_t*)thd->ha_data[hton->slot];
ut_a(trx);
......@@ -3254,11 +3275,11 @@ ha_innobase::write_row(
DBUG_ENTER("ha_innobase::write_row");
if (prebuilt->trx !=
(trx_t*) current_thd->ha_data[innobase_hton->slot]) {
(trx_t*) current_thd->ha_data[ht->slot]) {
sql_print_error("The transaction object for the table handle is at "
"%p, but for the current thread it is at %p",
prebuilt->trx,
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
......@@ -3266,7 +3287,7 @@ ha_innobase::write_row(
"InnoDB: Dump of 200 bytes around transaction.all: ",
stderr);
ut_print_buf(stderr,
((byte*)(&(current_thd->ha_data[innobase_hton->slot]))) - 100,
((byte*)(&(current_thd->ha_data[ht->slot]))) - 100,
200);
putc('\n', stderr);
ut_error;
......@@ -3320,7 +3341,7 @@ ha_innobase::write_row(
no need to re-acquire locks on it. */
/* Altering to InnoDB format */
innobase_commit(user_thd, 1);
innobase_commit(ht, user_thd, 1);
/* Note that this transaction is still active. */
prebuilt->trx->active_trans = 1;
/* We will need an IX lock on the destination table. */
......@@ -3336,7 +3357,7 @@ ha_innobase::write_row(
/* Commit the transaction. This will release the table
locks, so they have to be acquired again. */
innobase_commit(user_thd, 1);
innobase_commit(ht, user_thd, 1);
/* Note that this transaction is still active. */
prebuilt->trx->active_trans = 1;
/* Re-acquire the table lock on the source table. */
......@@ -3403,7 +3424,8 @@ ha_innobase::write_row(
/* We must use the handler code to update the auto-increment
value to be sure that we increment it correctly. */
update_auto_increment();
if ((error= update_auto_increment()))
goto func_exit;
auto_inc_used = 1;
}
......@@ -3642,7 +3664,7 @@ ha_innobase::update_row(
DBUG_ENTER("ha_innobase::update_row");
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
......@@ -3703,7 +3725,7 @@ ha_innobase::delete_row(
DBUG_ENTER("ha_innobase::delete_row");
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
if (last_query_id != user_thd->query_id) {
prebuilt->sql_stat_start = TRUE;
......@@ -3801,7 +3823,7 @@ ha_innobase::try_semi_consistent_read(bool yes)
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
/* Row read type is set to semi consistent read if this was
requested by the MySQL and either innodb_locks_unsafe_for_binlog
......@@ -3968,7 +3990,7 @@ ha_innobase::index_read(
DBUG_ENTER("index_read");
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
statistic_increment(current_thd->status_var.ha_read_key_count,
&LOCK_status);
......@@ -4083,7 +4105,7 @@ ha_innobase::change_active_index(
ut_ad(user_thd == current_thd);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
active_index = keynr;
......@@ -4173,7 +4195,7 @@ ha_innobase::general_fetch(
DBUG_ENTER("general_fetch");
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
innodb_srv_conc_enter_innodb(prebuilt->trx);
......@@ -4409,7 +4431,7 @@ ha_innobase::rnd_pos(
&LOCK_status);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
......@@ -4459,7 +4481,7 @@ ha_innobase::position(
uint len;
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
......@@ -4786,7 +4808,7 @@ ha_innobase::create(
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(thd);
parent_trx = check_trx_exists(ht, thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -4968,7 +4990,7 @@ ha_innobase::discard_or_import_tablespace(
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
dict_table = prebuilt->table;
trx = prebuilt->trx;
......@@ -5048,7 +5070,7 @@ ha_innobase::delete_table(
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(thd);
parent_trx = check_trx_exists(ht, thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -5115,6 +5137,7 @@ void
innobase_drop_database(
/*===================*/
/* out: error number */
handlerton *hton, /* in: handlerton of Innodb */
char* path) /* in: database path; inside InnoDB the name
of the last directory in the path is used as
the database name: for example, in 'mysql/data/test'
......@@ -5130,7 +5153,7 @@ innobase_drop_database(
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
parent_trx = check_trx_exists(hton, current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -5209,7 +5232,7 @@ ha_innobase::rename_table(
/* Get the transaction associated with the current thd, or create one
if not yet created */
parent_trx = check_trx_exists(current_thd);
parent_trx = check_trx_exists(ht, current_thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
......@@ -5296,7 +5319,7 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range");
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
prebuilt->trx->op_info = (char*)"estimating records in index range";
......@@ -5738,7 +5761,7 @@ ha_innobase::check(
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
if (prebuilt->mysql_template == NULL) {
/* Build the template; we will use a dummy template
......@@ -6022,7 +6045,7 @@ ha_innobase::can_switch_engines(void)
DBUG_ENTER("ha_innobase::can_switch_engines");
ut_a(prebuilt->trx ==
(trx_t*) current_thd->ha_data[innobase_hton->slot]);
(trx_t*) current_thd->ha_data[ht->slot]);
prebuilt->trx->op_info =
"determining if there are foreign key constraints";
......@@ -6201,10 +6224,10 @@ ha_innobase::start_stmt(
/* Set the MySQL flag to mark that there is an active transaction */
if (trx->active_trans == 0) {
innobase_register_trx_and_stmt(thd);
innobase_register_trx_and_stmt(ht, thd);
trx->active_trans = 1;
} else {
innobase_register_stmt(thd);
innobase_register_stmt(ht, thd);
}
return(0);
......@@ -6277,10 +6300,10 @@ ha_innobase::external_lock(
transaction */
if (trx->active_trans == 0) {
innobase_register_trx_and_stmt(thd);
innobase_register_trx_and_stmt(ht, thd);
trx->active_trans = 1;
} else if (trx->n_mysql_tables_in_use == 0) {
innobase_register_stmt(thd);
innobase_register_stmt(ht, thd);
}
trx->n_mysql_tables_in_use++;
......@@ -6358,7 +6381,7 @@ ha_innobase::external_lock(
if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
if (trx->active_trans != 0) {
innobase_commit(thd, TRUE);
innobase_commit(ht, thd, TRUE);
}
} else {
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
......@@ -6439,7 +6462,7 @@ ha_innobase::transactional_table_lock(
/* Set the MySQL flag to mark that there is an active transaction */
if (trx->active_trans == 0) {
innobase_register_trx_and_stmt(thd);
innobase_register_trx_and_stmt(ht, thd);
trx->active_trans = 1;
}
......@@ -6487,6 +6510,7 @@ Monitor to the client. */
bool
innodb_show_status(
/*===============*/
handlerton* hton, /* in: the innodb handlerton */
THD* thd, /* in: the MySQL query thread of the caller */
stat_print_fn *stat_print)
{
......@@ -6502,7 +6526,7 @@ innodb_show_status(
DBUG_RETURN(FALSE);
}
trx = check_trx_exists(thd);
trx = check_trx_exists(hton, thd);
innobase_release_stat_resources(trx);
......@@ -6577,6 +6601,7 @@ Implements the SHOW MUTEX STATUS command. . */
bool
innodb_mutex_show_status(
/*=====================*/
handlerton* hton, /* in: the innodb handlerton */
THD* thd, /* in: the MySQL query thread of the
caller */
stat_print_fn* stat_print)
......@@ -6658,14 +6683,15 @@ innodb_mutex_show_status(
DBUG_RETURN(FALSE);
}
bool innobase_show_status(THD* thd, stat_print_fn* stat_print,
bool innobase_show_status(handlerton *hton, THD* thd,
stat_print_fn* stat_print,
enum ha_stat_type stat_type)
{
switch (stat_type) {
case HA_ENGINE_STATUS:
return innodb_show_status(thd, stat_print);
return innodb_show_status(hton, thd, stat_print);
case HA_ENGINE_MUTEX:
return innodb_mutex_show_status(thd, stat_print);
return innodb_mutex_show_status(hton, thd, stat_print);
default:
return FALSE;
}
......@@ -6765,7 +6791,7 @@ ha_innobase::store_lock(
because we call update_thd() later, in ::external_lock()! Failure to
understand this caused a serious memory corruption bug in 5.1.11. */
trx = check_trx_exists(thd);
trx = check_trx_exists(ht, thd);
/* NOTE: MySQL can call this function with lock 'type' TL_IGNORE!
Be careful to ignore TL_IGNORE if we are going to do something with
......@@ -7151,7 +7177,7 @@ ha_innobase::reset_auto_increment(ulonglong value)
bool
ha_innobase::get_error_message(int error, String *buf)
{
trx_t* trx = check_trx_exists(current_thd);
trx_t* trx = check_trx_exists(ht, current_thd);
buf->copy(trx->detailed_error, strlen(trx->detailed_error),
system_charset_info);
......@@ -7370,13 +7396,14 @@ int
innobase_xa_prepare(
/*================*/
/* out: 0 or error number */
handlerton *hton,
THD* thd, /* in: handle to the MySQL thread of the user
whose XA transaction should be prepared */
bool all) /* in: TRUE - commit transaction
FALSE - the current SQL statement ended */
{
int error = 0;
trx_t* trx = check_trx_exists(thd);
trx_t* trx = check_trx_exists(hton, thd);
if (thd->lex->sql_command != SQLCOM_XA_PREPARE &&
(all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))
......@@ -7466,6 +7493,7 @@ innobase_xa_recover(
/*================*/
/* out: number of prepared transactions
stored in xid_list */
handlerton *hton,
XID* xid_list, /* in/out: prepared transactions */
uint len) /* in: number of slots in xid_list */
{
......@@ -7485,6 +7513,7 @@ int
innobase_commit_by_xid(
/*===================*/
/* out: 0 or error number */
handlerton *hton,
XID* xid) /* in: X/Open XA transaction identification */
{
trx_t* trx;
......@@ -7508,6 +7537,7 @@ int
innobase_rollback_by_xid(
/*=====================*/
/* out: 0 or error number */
handlerton *hton,
XID *xid) /* in: X/Open XA transaction identification */
{
trx_t* trx;
......@@ -7528,12 +7558,13 @@ This consistent view is then used inside of MySQL when accessing records
using a cursor. */
void*
innobase_create_cursor_view(void)
/*=============================*/
/* out: Pointer to cursor view or NULL */
innobase_create_cursor_view(
/* out: pointer to cursor view or NULL */
handlerton *hton, /* in: innobase hton */
THD* thd) /* in: user thread handle */
{
return(read_cursor_view_create_for_mysql(
check_trx_exists(current_thd)));
check_trx_exists(hton, thd)));
}
/***********************************************************************
......@@ -7543,10 +7574,11 @@ corresponding MySQL thread still lacks one. */
void
innobase_close_cursor_view(
/*=======================*/
handlerton *hton,
THD* thd, /* in: user thread handle */
void* curview)/* in: Consistent read view to be closed */
{
read_cursor_view_close_for_mysql(check_trx_exists(current_thd),
read_cursor_view_close_for_mysql(check_trx_exists(hton, current_thd),
(cursor_view_t*) curview);
}
......@@ -7559,9 +7591,11 @@ restored to a transaction read view. */
void
innobase_set_cursor_view(
/*=====================*/
handlerton *hton,
THD* thd, /* in: user thread handle */
void* curview)/* in: Consistent cursor view to be set */
{
read_cursor_set_for_mysql(check_trx_exists(current_thd),
read_cursor_set_for_mysql(check_trx_exists(hton, current_thd),
(cursor_view_t*) curview);
}
......@@ -7606,7 +7640,7 @@ SHOW_VAR innodb_status_variables_export[]= {
};
struct st_mysql_storage_engine innobase_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION, innobase_hton};
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
mysql_declare_plugin(innobase)
{
......
......@@ -80,7 +80,7 @@ class ha_innobase: public handler
/* Init values for the class: */
public:
ha_innobase(TABLE_SHARE *table_arg);
ha_innobase(handlerton *hton, TABLE_SHARE *table_arg);
~ha_innobase() {}
/*
Get the row type from the storage engine. If this method returns
......@@ -238,8 +238,8 @@ extern ulong srv_flush_log_at_trx_commit;
}
int innobase_init(void);
int innobase_end(ha_panic_function type);
bool innobase_flush_logs(void);
int innobase_end(handlerton *hton, ha_panic_function type);
bool innobase_flush_logs(handlerton *hton);
uint innobase_get_free_space(void);
/*
......@@ -256,14 +256,14 @@ int innobase_commit_complete(void* trx_handle);
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
#endif
void innobase_drop_database(char *path);
bool innobase_show_status(THD* thd, stat_print_fn*, enum ha_stat_type);
void innobase_drop_database(handlerton *hton, char *path);
bool innobase_show_status(handlerton *hton, THD* thd, stat_print_fn*, enum ha_stat_type);
int innobase_release_temporary_latches(THD *thd);
int innobase_release_temporary_latches(handlerton *hton, THD *thd);
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
void innobase_store_binlog_offset_and_flush_log(handlerton *hton, char *binlog_name,longlong offset);
int innobase_start_trx_and_assign_read_view(THD* thd);
int innobase_start_trx_and_assign_read_view(handlerton *hton, THD* thd);
/***********************************************************************
This function is used to prepare X/Open XA distributed transaction */
......@@ -271,6 +271,7 @@ This function is used to prepare X/Open XA distributed transaction */
int innobase_xa_prepare(
/*====================*/
/* out: 0 or error number */
handlerton *hton, /* in: innobase hton */
THD* thd, /* in: handle to the MySQL thread of the user
whose XA transaction should be prepared */
bool all); /* in: TRUE - commit transaction
......@@ -283,6 +284,7 @@ int innobase_xa_recover(
/*====================*/
/* out: number of prepared transactions
stored in xid_list */
handlerton *hton, /* in: innobase hton */
XID* xid_list, /* in/out: prepared transactions */
uint len); /* in: number of slots in xid_list */
......@@ -293,6 +295,7 @@ which is in the prepared state */
int innobase_commit_by_xid(
/*=======================*/
/* out: 0 or error number */
handlerton *hton, /* in: innobase hton */
XID* xid); /* in : X/Open XA Transaction Identification */
/***********************************************************************
......@@ -301,6 +304,7 @@ which is in the prepared state */
int innobase_rollback_by_xid(
/* out: 0 or error number */
handlerton *hton, /* in: innobase hton */
XID *xid); /* in : X/Open XA Transaction Identification */
......@@ -311,9 +315,10 @@ This consistent view is then used inside of MySQL when accessing records
using a cursor. */
void*
innobase_create_cursor_view(void);
/*=============================*/
innobase_create_cursor_view(
/* out: Pointer to cursor view or NULL */
handlerton *hton, /* in: innobase hton */
THD* thd); /* in: user thread handle */
/***********************************************************************
Close the given consistent cursor view of a transaction and restore
......@@ -323,8 +328,11 @@ corresponding MySQL thread still lacks one. */
void
innobase_close_cursor_view(
/*=======================*/
handlerton *hton, /* in: innobase hton */
THD* thd, /* in: user thread handle */
void* curview); /* in: Consistent read view to be closed */
/***********************************************************************
Set the given consistent cursor view to a transaction which is created
if the corresponding MySQL thread still lacks one. If the given
......@@ -334,4 +342,6 @@ restored to a transaction read view. */
void
innobase_set_cursor_view(
/*=====================*/
handlerton *hton, /* in: innobase hton */
THD* thd, /* in: user thread handle */
void* curview); /* in: Consistent read view to be set */
......@@ -3,43 +3,18 @@
# Prepare the MySQL source code tree for building
# with checked-out InnoDB Subversion directory.
# This script assumes that the MySQL tree is at .. and that . = ../innodb
# This script assumes that the current directory is storage/innobase.
set -eu
TARGETDIR=../storage/innobase
rm -fr "$TARGETDIR"
mkdir "$TARGETDIR"
# link the build scripts
ln -sf ../innodb/compile-innodb{,-debug} ../BUILD
# create the directories
for dir in */
do
case "$dir" in
mysql-test/) ;;
*.svn*) ;;
*to-mysql*) ;;
*) mkdir "$TARGETDIR/$dir" ;;
esac
done
# create the symlinks to files
cd "$TARGETDIR"
for dir in */
do
cd "$dir"
ln -s ../../../innodb/"$dir"* .
cd ..
done
for file in plug.in Makefile.am CMakeLists.txt
do
ln -s ../../innodb/"$file" .
done
ln -sf $TARGETDIR/compile-innodb{,-debug} ../../BUILD
cd ../../mysql-test/t
ln -sf ../../innodb/mysql-test/*.test ../../innodb/mysql-test/*.opt ./
ln -sf ../../innodb/mysql-test/*.result ../r/
ln -sf ../../innodb/mysql-test/*.inc ../include/
ln -sf ../$TARGETDIR/mysql-test/*.test $TARGETDIR/mysql-test/*.opt .
cd ../r
ln -sf ../$TARGETDIR/mysql-test/*.result .
cd ../include
ln -sf ../$TARGETDIR/mysql-test/*.inc .
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment