mirror of
https://github.com/MariaDB/server.git
synced 2026-05-14 19:07:15 +02:00
Merge branch '10.0' into 10.1
This commit is contained in:
commit
8e15768731
180 changed files with 10539 additions and 2460 deletions
|
|
@ -15835,6 +15835,37 @@ ha_innobase::get_auto_increment(
|
|||
ulonglong col_max_value = innobase_get_int_col_max_value(
|
||||
table->next_number_field);
|
||||
|
||||
/** The following logic is needed to avoid duplicate key error
|
||||
for autoincrement column.
|
||||
|
||||
(1) InnoDB gives the current autoincrement value with respect
|
||||
to increment and offset value.
|
||||
|
||||
(2) Basically it does compute_next_insert_id() logic inside InnoDB
|
||||
to avoid the current auto increment value changed by handler layer.
|
||||
|
||||
(3) It is restricted only for insert operations. */
|
||||
|
||||
if (increment > 1 && thd_sql_command(user_thd) != SQLCOM_ALTER_TABLE
|
||||
&& autoinc < col_max_value) {
|
||||
|
||||
ulonglong prev_auto_inc = autoinc;
|
||||
|
||||
autoinc = ((autoinc - 1) + increment - offset)/ increment;
|
||||
|
||||
autoinc = autoinc * increment + offset;
|
||||
|
||||
/* If autoinc exceeds the col_max_value then reset
|
||||
to old autoinc value. Because in case of non-strict
|
||||
sql mode, boundary value is not considered as error. */
|
||||
|
||||
if (autoinc >= col_max_value) {
|
||||
autoinc = prev_auto_inc;
|
||||
}
|
||||
|
||||
ut_ad(autoinc > 0);
|
||||
}
|
||||
|
||||
/* Called for the first time ? */
|
||||
if (trx->n_autoinc_rows == 0) {
|
||||
|
||||
|
|
@ -18784,6 +18815,12 @@ static MYSQL_SYSVAR_BOOL(use_fallocate, innobase_use_fallocate,
|
|||
"Preallocate files fast, using operating system functionality. On POSIX systems, posix_fallocate system call is used.",
|
||||
NULL, NULL, FALSE);
|
||||
|
||||
static MYSQL_SYSVAR_BOOL(stats_include_delete_marked,
|
||||
srv_stats_include_delete_marked,
|
||||
PLUGIN_VAR_OPCMDARG,
|
||||
"Scan delete marked records for persistent stat",
|
||||
NULL, NULL, FALSE);
|
||||
|
||||
static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity,
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"Number of IOPs the server can do. Tunes the background IO rate",
|
||||
|
|
@ -19910,6 +19947,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
|
|||
MYSQL_SYSVAR(doublewrite),
|
||||
MYSQL_SYSVAR(use_atomic_writes),
|
||||
MYSQL_SYSVAR(use_fallocate),
|
||||
MYSQL_SYSVAR(stats_include_delete_marked),
|
||||
MYSQL_SYSVAR(api_enable_binlog),
|
||||
MYSQL_SYSVAR(api_enable_mdl),
|
||||
MYSQL_SYSVAR(api_disable_rowlock),
|
||||
|
|
|
|||
|
|
@ -1864,6 +1864,7 @@ innobase_fts_check_doc_id_index_in_def(
|
|||
|
||||
return(FTS_NOT_EXIST_DOC_ID_INDEX);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Create an index table where indexes are ordered as follows:
|
||||
|
||||
|
|
@ -1932,26 +1933,11 @@ innobase_create_key_defs(
|
|||
(only prefix/part of the column is indexed), MySQL will treat the
|
||||
index as a PRIMARY KEY unless the table already has one. */
|
||||
|
||||
if (n_add > 0 && !new_primary && got_default_clust
|
||||
&& (key_info[*add].flags & HA_NOSAME)
|
||||
&& !(key_info[*add].flags & HA_KEY_HAS_PART_KEY_SEG)) {
|
||||
uint key_part = key_info[*add].user_defined_key_parts;
|
||||
ut_ad(altered_table->s->primary_key == 0
|
||||
|| altered_table->s->primary_key == MAX_KEY);
|
||||
|
||||
new_primary = true;
|
||||
|
||||
while (key_part--) {
|
||||
const uint maybe_null
|
||||
= key_info[*add].key_part[key_part].key_type
|
||||
& FIELDFLAG_MAYBE_NULL;
|
||||
DBUG_ASSERT(!maybe_null
|
||||
== !key_info[*add].key_part[key_part].
|
||||
field->real_maybe_null());
|
||||
|
||||
if (maybe_null) {
|
||||
new_primary = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (got_default_clust && !new_primary) {
|
||||
new_primary = (altered_table->s->primary_key != MAX_KEY);
|
||||
}
|
||||
|
||||
const bool rebuild = new_primary || add_fts_doc_id
|
||||
|
|
@ -1970,8 +1956,14 @@ innobase_create_key_defs(
|
|||
ulint primary_key_number;
|
||||
|
||||
if (new_primary) {
|
||||
DBUG_ASSERT(n_add > 0);
|
||||
primary_key_number = *add;
|
||||
if (n_add == 0) {
|
||||
DBUG_ASSERT(got_default_clust);
|
||||
DBUG_ASSERT(altered_table->s->primary_key
|
||||
== 0);
|
||||
primary_key_number = 0;
|
||||
} else {
|
||||
primary_key_number = *add;
|
||||
}
|
||||
} else if (got_default_clust) {
|
||||
/* Create the GEN_CLUST_INDEX */
|
||||
index_def_t* index = indexdef++;
|
||||
|
|
@ -3089,6 +3081,8 @@ prepare_inplace_alter_table_dict(
|
|||
ctx->add_cols = add_cols;
|
||||
} else {
|
||||
DBUG_ASSERT(!innobase_need_rebuild(ha_alter_info, old_table));
|
||||
DBUG_ASSERT(old_table->s->primary_key
|
||||
== altered_table->s->primary_key);
|
||||
|
||||
if (!ctx->new_table->fts
|
||||
&& innobase_fulltext_exist(altered_table)) {
|
||||
|
|
@ -4125,6 +4119,27 @@ found_col:
|
|||
add_fts_doc_id_idx));
|
||||
}
|
||||
|
||||
/** Get the name of an erroneous key.
|
||||
@param[in] error_key_num InnoDB number of the erroneus key
|
||||
@param[in] ha_alter_info changes that were being performed
|
||||
@param[in] table InnoDB table
|
||||
@return the name of the erroneous key */
|
||||
static
|
||||
const char*
|
||||
get_error_key_name(
|
||||
ulint error_key_num,
|
||||
const Alter_inplace_info* ha_alter_info,
|
||||
const dict_table_t* table)
|
||||
{
|
||||
if (error_key_num == ULINT_UNDEFINED) {
|
||||
return(FTS_DOC_ID_INDEX_NAME);
|
||||
} else if (ha_alter_info->key_count == 0) {
|
||||
return(dict_table_get_first_index(table)->name);
|
||||
} else {
|
||||
return(ha_alter_info->key_info_buffer[error_key_num].name);
|
||||
}
|
||||
}
|
||||
|
||||
/** Alter the table structure in-place with operations
|
||||
specified using Alter_inplace_info.
|
||||
The level of concurrency allowed during this operation depends
|
||||
|
|
@ -4247,17 +4262,13 @@ oom:
|
|||
case DB_ONLINE_LOG_TOO_BIG:
|
||||
DBUG_ASSERT(ctx->online);
|
||||
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
|
||||
(prebuilt->trx->error_key_num == ULINT_UNDEFINED)
|
||||
? FTS_DOC_ID_INDEX_NAME
|
||||
: ha_alter_info->key_info_buffer[
|
||||
prebuilt->trx->error_key_num].name);
|
||||
get_error_key_name(prebuilt->trx->error_key_num,
|
||||
ha_alter_info, prebuilt->table));
|
||||
break;
|
||||
case DB_INDEX_CORRUPT:
|
||||
my_error(ER_INDEX_CORRUPT, MYF(0),
|
||||
(prebuilt->trx->error_key_num == ULINT_UNDEFINED)
|
||||
? FTS_DOC_ID_INDEX_NAME
|
||||
: ha_alter_info->key_info_buffer[
|
||||
prebuilt->trx->error_key_num].name);
|
||||
get_error_key_name(prebuilt->trx->error_key_num,
|
||||
ha_alter_info, prebuilt->table));
|
||||
break;
|
||||
case DB_DECRYPTION_FAILED: {
|
||||
String str;
|
||||
|
|
@ -5077,7 +5088,6 @@ innobase_update_foreign_cache(
|
|||
"Foreign key constraints for table '%s'"
|
||||
" are loaded with charset check off",
|
||||
user_table->name);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5177,14 +5187,13 @@ commit_try_rebuild(
|
|||
DBUG_RETURN(true);
|
||||
case DB_ONLINE_LOG_TOO_BIG:
|
||||
my_error(ER_INNODB_ONLINE_LOG_TOO_BIG, MYF(0),
|
||||
ha_alter_info->key_info_buffer[0].name);
|
||||
get_error_key_name(err_key, ha_alter_info,
|
||||
rebuilt_table));
|
||||
DBUG_RETURN(true);
|
||||
case DB_INDEX_CORRUPT:
|
||||
my_error(ER_INDEX_CORRUPT, MYF(0),
|
||||
(err_key == ULINT_UNDEFINED)
|
||||
? FTS_DOC_ID_INDEX_NAME
|
||||
: ha_alter_info->key_info_buffer[err_key]
|
||||
.name);
|
||||
get_error_key_name(err_key, ha_alter_info,
|
||||
rebuilt_table));
|
||||
DBUG_RETURN(true);
|
||||
default:
|
||||
my_error_innodb(error, table_name, user_table->flags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue