mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
foo1
sql/ha_innodb.cc: Import patch foo1 sql/ha_innodb.h: Import patch foo1 sql/handler.cc: Import patch foo1 sql/handler.h: Import patch foo1 sql/mysqld.cc: Import patch foo1 sql/set_var.cc: Import patch foo1 sql/sql_class.h: Import patch foo1 sql/sql_repl.cc: Import patch foo1
This commit is contained in:
parent
c16b9dfcaa
commit
ce33555014
8 changed files with 304 additions and 304 deletions
278
sql/ha_innodb.cc
278
sql/ha_innodb.cc
|
|
@ -153,7 +153,7 @@ longlong innobase_buffer_pool_size, innobase_log_file_size;
|
|||
|
||||
/* The default values for the following char* start-up parameters
|
||||
are determined in innobase_init below: */
|
||||
|
||||
|
||||
char* innobase_data_home_dir = NULL;
|
||||
char* innobase_data_file_path = NULL;
|
||||
char* innobase_log_group_home_dir = NULL;
|
||||
|
|
@ -205,7 +205,7 @@ static int innobase_release_savepoint(THD* thd, void *savepoint);
|
|||
handlerton innobase_hton = {
|
||||
"InnoDB",
|
||||
SHOW_OPTION_YES,
|
||||
"Supports transactions, row-level locking, and foreign keys",
|
||||
"Supports transactions, row-level locking, and foreign keys",
|
||||
DB_TYPE_INNODB,
|
||||
innobase_init,
|
||||
0, /* slot */
|
||||
|
|
@ -394,7 +394,7 @@ innobase_release_temporary_latches(
|
|||
trx_t* trx;
|
||||
|
||||
if (!innodb_inited) {
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -612,7 +612,7 @@ innobase_mysql_print_thd(
|
|||
|
||||
/* Points to buf or dyn_str. */
|
||||
char* str = buf;
|
||||
|
||||
|
||||
if (max_query_len == 0)
|
||||
{
|
||||
/* ADDITIONAL SAFETY: the default is to print at
|
||||
|
|
@ -623,7 +623,7 @@ innobase_mysql_print_thd(
|
|||
safe */
|
||||
max_query_len = 300;
|
||||
}
|
||||
|
||||
|
||||
len = min(thd->query_length, max_query_len);
|
||||
|
||||
if (len > (sizeof(buf) - 1))
|
||||
|
|
@ -975,7 +975,7 @@ innobase_query_caching_of_table_permitted(
|
|||
if (thd->variables.tx_isolation == ISO_SERIALIZABLE) {
|
||||
/* In the SERIALIZABLE mode we add LOCK IN SHARE MODE to every
|
||||
plain SELECT if AUTOCOMMIT is not on. */
|
||||
|
||||
|
||||
return((my_bool)FALSE);
|
||||
}
|
||||
|
||||
|
|
@ -1022,7 +1022,7 @@ innobase_query_caching_of_table_permitted(
|
|||
|
||||
return((my_bool)TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* Normalize the table name to InnoDB format */
|
||||
|
||||
memcpy(norm_name, full_name, full_name_len);
|
||||
|
|
@ -1306,12 +1306,12 @@ innobase_init(void)
|
|||
/* -------------- Log files ---------------------------*/
|
||||
|
||||
/* The default dir for log files is the datadir of MySQL */
|
||||
|
||||
|
||||
if (!innobase_log_group_home_dir) {
|
||||
innobase_log_group_home_dir = default_path;
|
||||
}
|
||||
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
/* Since innodb_log_arch_dir has no relevance under MySQL,
|
||||
starting from 4.0.6 we always set it the same as
|
||||
innodb_log_group_home_dir: */
|
||||
|
|
@ -1353,14 +1353,14 @@ innobase_init(void)
|
|||
if (innobase_buffer_pool_awe_mem_mb == 0) {
|
||||
/* Careful here: we first convert the signed long int to ulint
|
||||
and only after that divide */
|
||||
|
||||
|
||||
srv_pool_size = ((ulint) innobase_buffer_pool_size) / 1024;
|
||||
} else {
|
||||
srv_use_awe = TRUE;
|
||||
srv_pool_size = (ulint)
|
||||
(1024 * innobase_buffer_pool_awe_mem_mb);
|
||||
srv_awe_window_size = (ulint) innobase_buffer_pool_size;
|
||||
|
||||
|
||||
/* Note that what the user specified as
|
||||
innodb_buffer_pool_size is actually the AWE memory window
|
||||
size in this case, and the real buffer pool size is
|
||||
|
|
@ -1379,7 +1379,7 @@ innobase_init(void)
|
|||
|
||||
os_use_large_pages = (ibool) innobase_use_large_pages;
|
||||
os_large_page_size = (ulint) innobase_large_page_size;
|
||||
|
||||
|
||||
srv_file_per_table = (ibool) innobase_file_per_table;
|
||||
srv_locks_unsafe_for_binlog = (ibool) innobase_locks_unsafe_for_binlog;
|
||||
|
||||
|
|
@ -1439,7 +1439,7 @@ innobase_init(void)
|
|||
|
||||
THIS DOES NOT WORK CURRENTLY because replication seems to initialize
|
||||
glob_mi also after innobase_init. */
|
||||
|
||||
|
||||
/* if (trx_sys_mysql_master_log_pos != -1) {
|
||||
ut_memcpy(glob_mi.log_file_name, trx_sys_mysql_master_log_name,
|
||||
1 + ut_strlen(trx_sys_mysql_master_log_name));
|
||||
|
|
@ -1613,7 +1613,7 @@ innobase_commit(
|
|||
if (trx->has_search_latch) {
|
||||
trx_search_latch_release_if_reserved(trx);
|
||||
}
|
||||
|
||||
|
||||
/* The flag trx->active_trans is set to 1 in
|
||||
|
||||
1. ::external_lock(),
|
||||
|
|
@ -1631,13 +1631,13 @@ innobase_commit(
|
|||
|
||||
if (trx->active_trans == 0
|
||||
&& trx->conc_state != TRX_NOT_STARTED) {
|
||||
|
||||
|
||||
sql_print_error("trx->active_trans == 0, but trx->conc_state != "
|
||||
"TRX_NOT_STARTED");
|
||||
}
|
||||
if (all
|
||||
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
|
||||
|
||||
|
||||
/* We were instructed to commit the whole transaction, or
|
||||
this is an SQL statement end and autocommit is on */
|
||||
|
||||
|
|
@ -1658,7 +1658,7 @@ retry:
|
|||
else
|
||||
pthread_mutex_unlock(&commit_cond_m);
|
||||
}
|
||||
|
||||
|
||||
trx->mysql_log_file_name = mysql_bin_log.get_log_fname();
|
||||
trx->mysql_log_offset =
|
||||
(ib_longlong)mysql_bin_log.get_log_file()->pos_in_file;
|
||||
|
|
@ -1672,14 +1672,14 @@ retry:
|
|||
pthread_cond_signal(&commit_cond);
|
||||
pthread_mutex_unlock(&commit_cond_m);
|
||||
}
|
||||
|
||||
|
||||
if (trx->active_trans == 2) {
|
||||
|
||||
pthread_mutex_unlock(&prepare_commit_mutex);
|
||||
}
|
||||
|
||||
|
||||
trx->active_trans = 0;
|
||||
|
||||
|
||||
} else {
|
||||
/* We just mark the SQL statement ended and do not do a
|
||||
transaction commit */
|
||||
|
|
@ -1687,7 +1687,7 @@ retry:
|
|||
if (trx->auto_inc_lock) {
|
||||
/* If we had reserved the auto-inc lock for some
|
||||
table in this SQL statement we release it now */
|
||||
|
||||
|
||||
row_unlock_table_autoinc_for_mysql(trx);
|
||||
}
|
||||
/* Store the current undo_no of the transaction so that we
|
||||
|
|
@ -2074,7 +2074,7 @@ innobase_rollback(
|
|||
/* If we had reserved the auto-inc lock for some table (if
|
||||
we come here to roll back the latest SQL statement) we
|
||||
release it now before a possibly lengthy rollback */
|
||||
|
||||
|
||||
row_unlock_table_autoinc_for_mysql(trx);
|
||||
}
|
||||
|
||||
|
|
@ -2114,7 +2114,7 @@ innobase_rollback_trx(
|
|||
/* If we had reserved the auto-inc lock for some table (if
|
||||
we come here to roll back the latest SQL statement) we
|
||||
release it now before a possibly lengthy rollback */
|
||||
|
||||
|
||||
row_unlock_table_autoinc_for_mysql(trx);
|
||||
}
|
||||
|
||||
|
|
@ -2249,7 +2249,7 @@ innobase_close_connection(
|
|||
|
||||
if (trx->active_trans == 0
|
||||
&& trx->conc_state != TRX_NOT_STARTED) {
|
||||
|
||||
|
||||
sql_print_error("trx->active_trans == 0, but trx->conc_state != "
|
||||
"TRX_NOT_STARTED");
|
||||
}
|
||||
|
|
@ -2478,7 +2478,7 @@ ha_innobase::open(
|
|||
that may be NULL. ref_length must be as exact as possible to
|
||||
save space, because all row reference buffers are allocated
|
||||
based on ref_length. */
|
||||
|
||||
|
||||
ref_length = table->key_info[primary_key].key_length;
|
||||
} else {
|
||||
if (primary_key != MAX_KEY) {
|
||||
|
|
@ -2505,7 +2505,7 @@ ha_innobase::open(
|
|||
that key_used_on_scan is the undefined value MAX_KEY.
|
||||
The column is the row id in the automatical generation case,
|
||||
and it will never be updated anyway. */
|
||||
|
||||
|
||||
if (key_used_on_scan != MAX_KEY) {
|
||||
sql_print_warning("Table %s key_used_on_scan is %lu even "
|
||||
"though there is no primary key inside "
|
||||
|
|
@ -2914,7 +2914,7 @@ ha_innobase::store_key_val_for_row(
|
|||
|
||||
if (is_null) {
|
||||
buff += key_len + 2;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
cs = field->charset();
|
||||
|
|
@ -2922,7 +2922,7 @@ ha_innobase::store_key_val_for_row(
|
|||
lenlen = (ulint)
|
||||
(((Field_varstring*)field)->length_bytes);
|
||||
|
||||
data = row_mysql_read_true_varchar(&len,
|
||||
data = row_mysql_read_true_varchar(&len,
|
||||
(byte*) (record
|
||||
+ (ulint)get_field_offset(table, field)),
|
||||
lenlen);
|
||||
|
|
@ -2936,7 +2936,7 @@ ha_innobase::store_key_val_for_row(
|
|||
true_len = (ulint) cs->cset->well_formed_len(cs,
|
||||
(const char *) data,
|
||||
(const char *) data + len,
|
||||
key_len / cs->mbmaxlen,
|
||||
key_len / cs->mbmaxlen,
|
||||
&error);
|
||||
}
|
||||
|
||||
|
|
@ -2982,10 +2982,10 @@ ha_innobase::store_key_val_for_row(
|
|||
|
||||
if (is_null) {
|
||||
buff += key_len + 2;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
cs = field->charset();
|
||||
|
||||
blob_data = row_mysql_read_blob_ref(&blob_len,
|
||||
|
|
@ -3000,11 +3000,11 @@ ha_innobase::store_key_val_for_row(
|
|||
|
||||
/* For multi byte character sets we need to calculate
|
||||
the true length of the key */
|
||||
|
||||
|
||||
if (blob_len > 0 && cs->mbmaxlen > 1) {
|
||||
true_len = (ulint) cs->cset->well_formed_len(cs,
|
||||
(const char *) blob_data,
|
||||
(const char *) blob_data
|
||||
(const char *) blob_data
|
||||
+ blob_len,
|
||||
key_len / cs->mbmaxlen,
|
||||
&error);
|
||||
|
|
@ -3048,7 +3048,7 @@ ha_innobase::store_key_val_for_row(
|
|||
|
||||
if (is_null) {
|
||||
buff += key_len;
|
||||
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -3061,22 +3061,22 @@ ha_innobase::store_key_val_for_row(
|
|||
type is not enum or set. For these fields check
|
||||
if character set is multi byte. */
|
||||
|
||||
if (real_type != FIELD_TYPE_ENUM
|
||||
if (real_type != FIELD_TYPE_ENUM
|
||||
&& real_type != FIELD_TYPE_SET
|
||||
&& ( mysql_type == MYSQL_TYPE_VAR_STRING
|
||||
|| mysql_type == MYSQL_TYPE_STRING)) {
|
||||
|
||||
cs = field->charset();
|
||||
|
||||
/* For multi byte character sets we need to
|
||||
/* For multi byte character sets we need to
|
||||
calculate the true length of the key */
|
||||
|
||||
if (key_len > 0 && cs->mbmaxlen > 1) {
|
||||
|
||||
true_len = (ulint)
|
||||
true_len = (ulint)
|
||||
cs->cset->well_formed_len(cs,
|
||||
(const char *)src_start,
|
||||
(const char *)src_start
|
||||
(const char *)src_start
|
||||
+ key_len,
|
||||
key_len / cs->mbmaxlen,
|
||||
&error);
|
||||
|
|
@ -3086,9 +3086,9 @@ ha_innobase::store_key_val_for_row(
|
|||
memcpy(buff, src_start, true_len);
|
||||
buff += true_len;
|
||||
|
||||
/* Pad the unused space with spaces. Note that no
|
||||
padding is ever needed for UCS-2 because in MySQL,
|
||||
all UCS2 characters are 2 bytes, as MySQL does not
|
||||
/* Pad the unused space with spaces. Note that no
|
||||
padding is ever needed for UCS-2 because in MySQL,
|
||||
all UCS2 characters are 2 bytes, as MySQL does not
|
||||
support surrogate pairs, which are needed to represent
|
||||
characters in the range U+10000 to U+10FFFF. */
|
||||
|
||||
|
|
@ -3286,7 +3286,7 @@ include_field:
|
|||
templ->mysql_length_bytes = (ulint)
|
||||
(((Field_varstring*)field)->length_bytes);
|
||||
}
|
||||
|
||||
|
||||
templ->charset = dtype_get_charset_coll_noninline(
|
||||
index->table->cols[i].type.prtype);
|
||||
templ->mbminlen = index->table->cols[i].type.mbminlen;
|
||||
|
|
@ -3595,7 +3595,7 @@ calc_row_difference(
|
|||
|
||||
o_ptr = (byte*) old_row + get_field_offset(table, field);
|
||||
n_ptr = (byte*) new_row + get_field_offset(table, field);
|
||||
|
||||
|
||||
/* Use new_mysql_row_col and col_pack_len save the values */
|
||||
|
||||
new_mysql_row_col = n_ptr;
|
||||
|
|
@ -3605,10 +3605,10 @@ calc_row_difference(
|
|||
n_len = col_pack_len;
|
||||
|
||||
/* We use o_ptr and n_ptr to dig up the actual data for
|
||||
comparison. */
|
||||
comparison. */
|
||||
|
||||
field_mysql_type = field->type();
|
||||
|
||||
|
||||
col_type = prebuilt->table->cols[i].type.mtype;
|
||||
|
||||
switch (col_type) {
|
||||
|
|
@ -3626,12 +3626,12 @@ calc_row_difference(
|
|||
/* This is a >= 5.0.3 type true VARCHAR where
|
||||
the real payload data length is stored in
|
||||
1 or 2 bytes */
|
||||
|
||||
|
||||
o_ptr = row_mysql_read_true_varchar(
|
||||
&o_len, o_ptr,
|
||||
(ulint)
|
||||
(((Field_varstring*)field)->length_bytes));
|
||||
|
||||
|
||||
n_ptr = row_mysql_read_true_varchar(
|
||||
&n_len, n_ptr,
|
||||
(ulint)
|
||||
|
|
@ -3660,7 +3660,7 @@ calc_row_difference(
|
|||
/* The field has changed */
|
||||
|
||||
ufield = uvect->fields + n_changed;
|
||||
|
||||
|
||||
/* Let us use a dummy dfield to make the conversion
|
||||
from the MySQL column format to the InnoDB format */
|
||||
|
||||
|
|
@ -3812,7 +3812,7 @@ ha_innobase::delete_row(
|
|||
}
|
||||
|
||||
/**************************************************************************
|
||||
Removes a new lock set on a row. This method does nothing unless the
|
||||
Removes a new lock set on a row. This method does nothing unless the
|
||||
option innodb_locks_unsafe_for_binlog is set.*/
|
||||
|
||||
void
|
||||
|
|
@ -4496,10 +4496,10 @@ ha_innobase::position(
|
|||
|
||||
/* We assume that the 'ref' value len is always fixed for the same
|
||||
table. */
|
||||
|
||||
|
||||
if (len != ref_length) {
|
||||
sql_print_error("Stored ref len is %lu, but table ref len is %lu",
|
||||
(ulong) len, (ulong) ref_length);
|
||||
(ulong) len, (ulong) ref_length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4568,7 +4568,7 @@ create_table_def(
|
|||
binary_type = 0;
|
||||
}
|
||||
|
||||
charset_no = 0;
|
||||
charset_no = 0;
|
||||
|
||||
if (dtype_is_string_type(col_type)) {
|
||||
|
||||
|
|
@ -4587,7 +4587,7 @@ create_table_def(
|
|||
for a true VARCHAR. Let us subtract that, so that the InnoDB
|
||||
column length in the InnoDB data dictionary is the real
|
||||
maximum byte length of the actual data. */
|
||||
|
||||
|
||||
long_true_varchar = 0;
|
||||
|
||||
if (field->type() == MYSQL_TYPE_VARCHAR) {
|
||||
|
|
@ -4601,7 +4601,7 @@ create_table_def(
|
|||
dict_mem_table_add_col(table,
|
||||
(char*) field->field_name,
|
||||
col_type,
|
||||
dtype_form_prtype(
|
||||
dtype_form_prtype(
|
||||
(ulint)field->type()
|
||||
| nulls_allowed | unsigned_type
|
||||
| binary_type | long_true_varchar,
|
||||
|
|
@ -4642,7 +4642,7 @@ create_index(
|
|||
ulint i;
|
||||
ulint j;
|
||||
ulint* field_lengths;
|
||||
|
||||
|
||||
DBUG_ENTER("create_index");
|
||||
|
||||
key = form->key_info + key_num;
|
||||
|
|
@ -4667,7 +4667,7 @@ create_index(
|
|||
|
||||
field_lengths = (ulint*) my_malloc(sizeof(ulint) * n_fields,
|
||||
MYF(MY_FAE));
|
||||
|
||||
|
||||
for (i = 0; i < n_fields; i++) {
|
||||
key_part = key->key_part + i;
|
||||
|
||||
|
|
@ -4676,7 +4676,7 @@ create_index(
|
|||
bytes of the column to the index field.) The flag does not
|
||||
seem to be properly set by MySQL. Let us fall back on testing
|
||||
the length of the key part versus the column. */
|
||||
|
||||
|
||||
field = NULL;
|
||||
for (j = 0; j < form->s->fields; j++) {
|
||||
|
||||
|
|
@ -4715,7 +4715,7 @@ create_index(
|
|||
"name %s, column name %s.",
|
||||
table_name,
|
||||
key_part->field->field_name);
|
||||
|
||||
|
||||
prefix_len = 0;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -4740,7 +4740,7 @@ create_index(
|
|||
error = convert_error_code_to_mysql(error, NULL);
|
||||
|
||||
my_free((gptr) field_lengths, MYF(0));
|
||||
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
|
@ -4804,20 +4804,20 @@ ha_innobase::create(
|
|||
but we play safe here */
|
||||
|
||||
DBUG_RETURN(HA_ERR_TO_BIG_ROW);
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the transaction associated with the current thd, or create one
|
||||
if not yet created */
|
||||
|
||||
|
||||
parent_trx = check_trx_exists(current_thd);
|
||||
|
||||
/* In case MySQL calls this in the middle of a SELECT query, release
|
||||
possible adaptive hash latch to avoid deadlocks of threads */
|
||||
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
|
||||
trx = trx_allocate_for_mysql();
|
||||
|
||||
|
||||
trx->mysql_thd = thd;
|
||||
trx->mysql_query_str = &((*thd).query);
|
||||
|
||||
|
|
@ -4858,7 +4858,7 @@ ha_innobase::create(
|
|||
/* Look for a primary key */
|
||||
|
||||
primary_key_no= (table->s->primary_key != MAX_KEY ?
|
||||
(int) table->s->primary_key :
|
||||
(int) table->s->primary_key :
|
||||
-1);
|
||||
|
||||
/* Our function row_get_mysql_key_number_for_index assumes
|
||||
|
|
@ -4907,7 +4907,7 @@ ha_innobase::create(
|
|||
current_thd->query_length,
|
||||
current_thd->charset())) {
|
||||
error = HA_ERR_OUT_OF_MEM;
|
||||
|
||||
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -4939,7 +4939,7 @@ ha_innobase::create(
|
|||
if ((create_info->used_fields & HA_CREATE_USED_AUTO) &&
|
||||
(create_info->auto_increment_value != 0)) {
|
||||
|
||||
/* Query was ALTER TABLE...AUTO_INCREMENT = x; or
|
||||
/* Query was ALTER TABLE...AUTO_INCREMENT = x; or
|
||||
CREATE TABLE ...AUTO_INCREMENT = x; Find out a table
|
||||
definition from the dictionary and get the current value
|
||||
of the auto increment field. Set a new value to the
|
||||
|
|
@ -4961,9 +4961,9 @@ ha_innobase::create(
|
|||
|
||||
cleanup:
|
||||
innobase_commit_low(trx);
|
||||
|
||||
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
|
||||
trx_free_for_mysql(trx);
|
||||
|
||||
DBUG_RETURN(error);
|
||||
|
|
@ -5067,13 +5067,13 @@ ha_innobase::delete_table(
|
|||
|
||||
/* Get the transaction associated with the current thd, or create one
|
||||
if not yet created */
|
||||
|
||||
|
||||
parent_trx = check_trx_exists(current_thd);
|
||||
|
||||
/* In case MySQL calls this in the middle of a SELECT query, release
|
||||
possible adaptive hash latch to avoid deadlocks of threads */
|
||||
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
|
||||
if (lower_case_table_names) {
|
||||
srv_lower_case_table_names = TRUE;
|
||||
|
|
@ -5149,13 +5149,13 @@ 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);
|
||||
|
||||
/* In case MySQL calls this in the middle of a SELECT query, release
|
||||
possible adaptive hash latch to avoid deadlocks of threads */
|
||||
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
|
||||
ptr = strend(path) - 2;
|
||||
|
||||
|
|
@ -5225,13 +5225,13 @@ 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);
|
||||
|
||||
/* In case MySQL calls this in the middle of a SELECT query, release
|
||||
possible adaptive hash latch to avoid deadlocks of threads */
|
||||
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
trx_search_latch_release_if_reserved(parent_trx);
|
||||
|
||||
if (lower_case_table_names) {
|
||||
srv_lower_case_table_names = TRUE;
|
||||
|
|
@ -5439,7 +5439,7 @@ ha_innobase::scan_time()
|
|||
searches, we pretend that a sequential read takes the same time
|
||||
as a random disk read, that is, we do not divide the following
|
||||
by 10, which would be physically realistic. */
|
||||
|
||||
|
||||
return((double) (prebuilt->table->stat_clustered_index_size));
|
||||
}
|
||||
|
||||
|
|
@ -5457,9 +5457,9 @@ ha_innobase::read_time(
|
|||
{
|
||||
ha_rows total_rows;
|
||||
double time_for_scan;
|
||||
|
||||
|
||||
if (index != table->s->primary_key) {
|
||||
/* Not clustered */
|
||||
/* Not clustered */
|
||||
return(handler::read_time(index, ranges, rows));
|
||||
}
|
||||
|
||||
|
|
@ -5543,14 +5543,14 @@ ha_innobase::info(
|
|||
".ibd");
|
||||
unpack_filename(path,path);
|
||||
} else {
|
||||
my_snprintf(path, sizeof(path), "%s/%s%s",
|
||||
my_snprintf(path, sizeof(path), "%s/%s%s",
|
||||
mysql_data_home, ib_table->name,
|
||||
reg_ext);
|
||||
|
||||
|
||||
unpack_filename(path,path);
|
||||
}
|
||||
|
||||
/* Note that we do not know the access time of the table,
|
||||
/* Note that we do not know the access time of the table,
|
||||
nor the CHECK TABLE time, nor the UPDATE or INSERT time. */
|
||||
|
||||
if (os_file_get_status(path,&stat_info)) {
|
||||
|
|
@ -5689,7 +5689,7 @@ ha_innobase::info(
|
|||
the auto-inc counter, and the second call is guaranteed to
|
||||
succeed. */
|
||||
|
||||
ret = innobase_read_and_init_auto_inc(&auto_inc);
|
||||
ret = innobase_read_and_init_auto_inc(&auto_inc);
|
||||
|
||||
if (ret != 0) {
|
||||
ret = innobase_read_and_init_auto_inc(&auto_inc);
|
||||
|
|
@ -5702,7 +5702,7 @@ ha_innobase::info(
|
|||
auto_inc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
auto_increment_value = auto_inc;
|
||||
}
|
||||
|
||||
|
|
@ -5717,7 +5717,7 @@ each index tree. This does NOT calculate exact statistics on the table. */
|
|||
|
||||
int
|
||||
ha_innobase::analyze(
|
||||
/*=================*/
|
||||
/*=================*/
|
||||
/* out: returns always 0 (success) */
|
||||
THD* thd, /* in: connection thread handle */
|
||||
HA_CHECK_OPT* check_opt) /* in: currently ignored */
|
||||
|
|
@ -5775,7 +5775,7 @@ ha_innobase::check(
|
|||
return(HA_ADMIN_OK);
|
||||
}
|
||||
|
||||
return(HA_ADMIN_CORRUPT);
|
||||
return(HA_ADMIN_CORRUPT);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
|
|
@ -5917,7 +5917,7 @@ ha_innobase::get_foreign_key_create_info(void)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
|
||||
{
|
||||
dict_foreign_t* foreign;
|
||||
|
|
@ -5931,7 +5931,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
|
|||
mutex_enter_noninline(&(dict_sys->mutex));
|
||||
foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
|
||||
|
||||
while (foreign != NULL)
|
||||
while (foreign != NULL)
|
||||
{
|
||||
uint i;
|
||||
FOREIGN_KEY_INFO f_key_info;
|
||||
|
|
@ -5952,7 +5952,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
|
|||
f_key_info.referenced_db= make_lex_string(thd, 0,
|
||||
tmp_buff, i, 1);
|
||||
tmp_buff+= i + 1;
|
||||
f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff,
|
||||
f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff,
|
||||
(uint) strlen(tmp_buff), 1);
|
||||
|
||||
for (i= 0;;)
|
||||
|
|
@ -5972,7 +5972,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
|
|||
{
|
||||
length=17;
|
||||
tmp_buff= "ON DELETE CASCADE";
|
||||
}
|
||||
}
|
||||
else if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL)
|
||||
{
|
||||
length=18;
|
||||
|
|
@ -6002,7 +6002,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
|
|||
f_key_info.constraint_method,
|
||||
tmp_buff, length, 1);
|
||||
|
||||
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
|
||||
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
|
||||
thd->memdup((gptr) &f_key_info,
|
||||
sizeof(FOREIGN_KEY_INFO)));
|
||||
f_key_list->push_back(pf_key_info);
|
||||
|
|
@ -6187,13 +6187,13 @@ ha_innobase::start_stmt(
|
|||
this same LOCK TABLES; since MySQL does NOT call external_lock
|
||||
in this case, we must use x-row locks inside InnoDB to be
|
||||
prepared for an update of a row */
|
||||
|
||||
|
||||
prebuilt->select_lock_type = LOCK_X;
|
||||
} else {
|
||||
if (trx->isolation_level != TRX_ISO_SERIALIZABLE
|
||||
&& thd->lex->sql_command == SQLCOM_SELECT
|
||||
&& lock_type == TL_READ) {
|
||||
|
||||
|
||||
/* For other than temporary tables, we obtain
|
||||
no lock for consistent read (plain SELECT). */
|
||||
|
||||
|
|
@ -6203,8 +6203,8 @@ ha_innobase::start_stmt(
|
|||
select_lock_type value. The value of
|
||||
stored_select_lock_type was decided in:
|
||||
1) ::store_lock(),
|
||||
2) ::external_lock(),
|
||||
3) ::init_table_handle_for_HANDLER(), and
|
||||
2) ::external_lock(),
|
||||
3) ::init_table_handle_for_HANDLER(), and
|
||||
4) :.transactional_table_lock(). */
|
||||
|
||||
prebuilt->select_lock_type =
|
||||
|
|
@ -6254,9 +6254,9 @@ innobase_map_isolation_level(
|
|||
case ISO_SERIALIZABLE: return(TRX_ISO_SERIALIZABLE);
|
||||
case ISO_READ_UNCOMMITTED: return(TRX_ISO_READ_UNCOMMITTED);
|
||||
default: ut_a(0); return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
As MySQL will execute an external lock for every new table it uses when it
|
||||
starts to process an SQL statement (an exception is when MySQL calls
|
||||
|
|
@ -6301,7 +6301,7 @@ ha_innobase::external_lock(
|
|||
/* MySQL is setting a new table lock */
|
||||
|
||||
trx->detailed_error[0] = '\0';
|
||||
|
||||
|
||||
/* Set the MySQL flag to mark that there is an active
|
||||
transaction */
|
||||
if (trx->active_trans == 0) {
|
||||
|
|
@ -6342,7 +6342,7 @@ ha_innobase::external_lock(
|
|||
TABLES if AUTOCOMMIT=1. It does not make much sense to acquire
|
||||
an InnoDB table lock if it is released immediately at the end
|
||||
of LOCK TABLES, and InnoDB's table locks in that case cause
|
||||
VERY easily deadlocks.
|
||||
VERY easily deadlocks.
|
||||
|
||||
We do not set InnoDB table locks if user has not explicitly
|
||||
requested a table lock. Note that thd->in_lock_tables
|
||||
|
|
@ -6385,7 +6385,7 @@ ha_innobase::external_lock(
|
|||
|
||||
trx->mysql_n_tables_locked = 0;
|
||||
prebuilt->used_in_HANDLER = FALSE;
|
||||
|
||||
|
||||
/* Release a possible FIFO ticket and search latch. Since we
|
||||
may reserve the kernel mutex, we have to release the search
|
||||
system latch first to obey the latching order. */
|
||||
|
|
@ -6491,8 +6491,8 @@ ha_innobase::transactional_table_lock(
|
|||
|
||||
if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
|
||||
|
||||
/* Store the current undo_no of the transaction
|
||||
so that we know where to roll back if we have
|
||||
/* Store the current undo_no of the transaction
|
||||
so that we know where to roll back if we have
|
||||
to roll back the next SQL statement */
|
||||
|
||||
trx_mark_sql_stat_end(trx);
|
||||
|
|
@ -6735,7 +6735,7 @@ static INNOBASE_SHARE *get_share(const char *table_name)
|
|||
INNOBASE_SHARE *share;
|
||||
pthread_mutex_lock(&innobase_share_mutex);
|
||||
uint length=(uint) strlen(table_name);
|
||||
|
||||
|
||||
if (!(share=(INNOBASE_SHARE*) hash_search(&innobase_open_tables,
|
||||
(mysql_byte*) table_name,
|
||||
length))) {
|
||||
|
|
@ -6751,17 +6751,17 @@ static INNOBASE_SHARE *get_share(const char *table_name)
|
|||
(mysql_byte*) share)) {
|
||||
pthread_mutex_unlock(&innobase_share_mutex);
|
||||
my_free((gptr) share,0);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
thr_lock_init(&share->lock);
|
||||
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
|
||||
}
|
||||
|
||||
|
||||
share->use_count++;
|
||||
pthread_mutex_unlock(&innobase_share_mutex);
|
||||
|
||||
|
||||
return share;
|
||||
}
|
||||
|
||||
|
|
@ -6808,7 +6808,7 @@ ha_innobase::store_lock(
|
|||
Be careful to ignore TL_IGNORE if we are going to do something with
|
||||
only 'real' locks! */
|
||||
|
||||
if ((lock_type == TL_READ && thd->in_lock_tables) ||
|
||||
if ((lock_type == TL_READ && thd->in_lock_tables) ||
|
||||
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
|
||||
lock_type == TL_READ_WITH_SHARED_LOCKS ||
|
||||
lock_type == TL_READ_NO_INSERT ||
|
||||
|
|
@ -6894,7 +6894,7 @@ ha_innobase::store_lock(
|
|||
}
|
||||
|
||||
/* If we are not doing a LOCK TABLE, DISCARD/IMPORT
|
||||
TABLESPACE or TRUNCATE TABLE then allow multiple
|
||||
TABLESPACE or TRUNCATE TABLE then allow multiple
|
||||
writers. Note that ALTER TABLE uses a TL_WRITE_ALLOW_READ
|
||||
< TL_WRITE_CONCURRENT_INSERT.
|
||||
|
||||
|
|
@ -6903,7 +6903,7 @@ ha_innobase::store_lock(
|
|||
stored function call (MySQL does have thd->in_lock_tables
|
||||
TRUE there). */
|
||||
|
||||
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
|
||||
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
|
||||
&& lock_type <= TL_WRITE)
|
||||
&& !(thd->in_lock_tables
|
||||
&& thd->lex->sql_command == SQLCOM_LOCK_TABLES)
|
||||
|
|
@ -6919,19 +6919,19 @@ ha_innobase::store_lock(
|
|||
MySQL would use the lock TL_READ_NO_INSERT on t2, and that
|
||||
would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts
|
||||
to t2. Convert the lock to a normal read lock to allow
|
||||
concurrent inserts to t2.
|
||||
concurrent inserts to t2.
|
||||
|
||||
We especially allow concurrent inserts if MySQL is at the
|
||||
start of a stored procedure call (SQLCOM_CALL)
|
||||
We especially allow concurrent inserts if MySQL is at the
|
||||
start of a stored procedure call (SQLCOM_CALL)
|
||||
(MySQL does have thd->in_lock_tables TRUE there). */
|
||||
|
||||
|
||||
if (lock_type == TL_READ_NO_INSERT
|
||||
&& (!thd->in_lock_tables
|
||||
|| thd->lex->sql_command == SQLCOM_CALL)) {
|
||||
|
||||
lock_type = TL_READ;
|
||||
}
|
||||
|
||||
|
||||
lock.type = lock_type;
|
||||
}
|
||||
|
||||
|
|
@ -6963,7 +6963,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
|
|||
ut_a(prebuilt->trx ==
|
||||
(trx_t*) current_thd->ha_data[innobase_hton.slot]);
|
||||
ut_a(prebuilt->table);
|
||||
|
||||
|
||||
if (prebuilt->trx->conc_state == TRX_NOT_STARTED) {
|
||||
trx_was_not_started = TRUE;
|
||||
}
|
||||
|
|
@ -6978,7 +6978,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
|
|||
if (auto_inc != 0) {
|
||||
/* Already initialized */
|
||||
*ret = auto_inc;
|
||||
|
||||
|
||||
error = 0;
|
||||
|
||||
goto func_exit_early;
|
||||
|
|
@ -6990,14 +6990,14 @@ ha_innobase::innobase_read_and_init_auto_inc(
|
|||
error = convert_error_code_to_mysql(error, user_thd);
|
||||
|
||||
goto func_exit_early;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check again if someone has initialized the counter meanwhile */
|
||||
auto_inc = dict_table_autoinc_read(prebuilt->table);
|
||||
|
||||
if (auto_inc != 0) {
|
||||
*ret = auto_inc;
|
||||
|
||||
|
||||
error = 0;
|
||||
|
||||
goto func_exit_early;
|
||||
|
|
@ -7014,7 +7014,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
|
|||
accept this flaw, since the deadlocks were a bigger trouble. */
|
||||
|
||||
/* Fetch all the columns in the key */
|
||||
|
||||
|
||||
prebuilt->hint_need_to_fetch_extra_cols = ROW_RETRIEVE_ALL_COLS;
|
||||
|
||||
old_select_lock_type = prebuilt->select_lock_type;
|
||||
|
|
@ -7093,14 +7093,14 @@ ha_innobase::get_auto_increment()
|
|||
{
|
||||
longlong nr;
|
||||
int error;
|
||||
|
||||
|
||||
error = innobase_read_and_init_auto_inc(&nr);
|
||||
|
||||
if (error) {
|
||||
/* This should never happen in the current (5.0.6) code, since
|
||||
we call this function only after the counter has been
|
||||
initialized. */
|
||||
|
||||
|
||||
ut_print_timestamp(stderr);
|
||||
sql_print_error("Error %lu in ::get_auto_increment()",
|
||||
(ulong) error);
|
||||
|
|
@ -7125,7 +7125,7 @@ ha_innobase::reset_auto_increment(ulonglong value)
|
|||
error = convert_error_code_to_mysql(error, user_thd);
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
}
|
||||
|
||||
dict_table_autoinc_initialize(prebuilt->table, value);
|
||||
|
||||
|
|
@ -7190,7 +7190,7 @@ ha_innobase::cmp_ref(
|
|||
|| mysql_type == FIELD_TYPE_MEDIUM_BLOB
|
||||
|| mysql_type == FIELD_TYPE_BLOB
|
||||
|| mysql_type == FIELD_TYPE_LONG_BLOB) {
|
||||
|
||||
|
||||
/* In the MySQL key value format, a column prefix of
|
||||
a BLOB is preceded by a 2-byte length field */
|
||||
|
||||
|
|
@ -7296,7 +7296,7 @@ innobase_get_at_most_n_mbchars(
|
|||
str + data_len, (int) n_chars);
|
||||
if (char_length > data_len) {
|
||||
char_length = data_len;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (data_len < prefix_len) {
|
||||
char_length = data_len;
|
||||
|
|
@ -7311,15 +7311,15 @@ innobase_get_at_most_n_mbchars(
|
|||
|
||||
extern "C" {
|
||||
/**********************************************************************
|
||||
This function returns true if
|
||||
This function returns true if
|
||||
|
||||
1) SQL-query in the current thread
|
||||
is either REPLACE or LOAD DATA INFILE REPLACE.
|
||||
is either REPLACE or LOAD DATA INFILE REPLACE.
|
||||
|
||||
2) SQL-query in the current thread
|
||||
is INSERT ON DUPLICATE KEY UPDATE.
|
||||
|
||||
NOTE that /mysql/innobase/row/row0ins.c must contain the
|
||||
NOTE that /mysql/innobase/row/row0ins.c must contain the
|
||||
prototype for this function ! */
|
||||
|
||||
ibool
|
||||
|
|
@ -7327,9 +7327,9 @@ innobase_query_is_update(void)
|
|||
/*==========================*/
|
||||
{
|
||||
THD* thd;
|
||||
|
||||
|
||||
thd = (THD *)innobase_current_thd();
|
||||
|
||||
|
||||
if (thd->lex->sql_command == SQLCOM_REPLACE ||
|
||||
thd->lex->sql_command == SQLCOM_REPLACE_SELECT ||
|
||||
(thd->lex->sql_command == SQLCOM_LOAD &&
|
||||
|
|
@ -7351,7 +7351,7 @@ innobase_query_is_update(void)
|
|||
/***********************************************************************
|
||||
This function is used to prepare X/Open XA distributed transaction */
|
||||
|
||||
int
|
||||
int
|
||||
innobase_xa_prepare(
|
||||
/*================*/
|
||||
/* out: 0 or error number */
|
||||
|
|
@ -7444,10 +7444,10 @@ innobase_xa_prepare(
|
|||
/***********************************************************************
|
||||
This function is used to recover X/Open XA distributed transactions */
|
||||
|
||||
int
|
||||
int
|
||||
innobase_xa_recover(
|
||||
/*================*/
|
||||
/* out: number of prepared transactions
|
||||
/* out: number of prepared transactions
|
||||
stored in xid_list */
|
||||
XID* xid_list, /* in/out: prepared transactions */
|
||||
uint len) /* in: number of slots in xid_list */
|
||||
|
|
@ -7464,7 +7464,7 @@ innobase_xa_recover(
|
|||
This function is used to commit one X/Open XA distributed transaction
|
||||
which is in the prepared state */
|
||||
|
||||
int
|
||||
int
|
||||
innobase_commit_by_xid(
|
||||
/*===================*/
|
||||
/* out: 0 or error number */
|
||||
|
|
@ -7476,7 +7476,7 @@ innobase_commit_by_xid(
|
|||
|
||||
if (trx) {
|
||||
innobase_commit_low(trx);
|
||||
|
||||
|
||||
return(XA_OK);
|
||||
} else {
|
||||
return(XAER_NOTA);
|
||||
|
|
@ -7487,7 +7487,7 @@ innobase_commit_by_xid(
|
|||
This function is used to rollback one X/Open XA distributed transaction
|
||||
which is in the prepared state */
|
||||
|
||||
int
|
||||
int
|
||||
innobase_rollback_by_xid(
|
||||
/*=====================*/
|
||||
/* out: 0 or error number */
|
||||
|
|
@ -7507,7 +7507,7 @@ innobase_rollback_by_xid(
|
|||
/***********************************************************************
|
||||
Create a consistent view for a cursor based on current transaction
|
||||
which is created if the corresponding MySQL thread still lacks one.
|
||||
This consistent view is then used inside of MySQL when accessing records
|
||||
This consistent view is then used inside of MySQL when accessing records
|
||||
using a cursor. */
|
||||
|
||||
void*
|
||||
|
|
@ -7521,7 +7521,7 @@ innobase_create_cursor_view(void)
|
|||
|
||||
/***********************************************************************
|
||||
Close the given consistent cursor view of a transaction and restore
|
||||
global read view to a transaction read view. Transaction is created if the
|
||||
global read view to a transaction read view. Transaction is created if the
|
||||
corresponding MySQL thread still lacks one. */
|
||||
|
||||
void
|
||||
|
|
@ -7534,8 +7534,8 @@ innobase_close_cursor_view(
|
|||
}
|
||||
|
||||
/***********************************************************************
|
||||
Set the given consistent cursor view to a transaction which is created
|
||||
if the corresponding MySQL thread still lacks one. If the given
|
||||
Set the given consistent cursor view to a transaction which is created
|
||||
if the corresponding MySQL thread still lacks one. If the given
|
||||
consistent cursor view is NULL global read view of a transaction is
|
||||
restored to a transaction read view. */
|
||||
|
||||
|
|
@ -7544,7 +7544,7 @@ innobase_set_cursor_view(
|
|||
/*=====================*/
|
||||
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(current_thd),
|
||||
(cursor_view_t*) curview);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue