mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge 10.3 into 10.4
This commit is contained in:
@ -5278,7 +5278,7 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
|
||||
|
||||
err:
|
||||
/* In RBR we don't need to log CREATE TEMPORARY TABLE */
|
||||
if (thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
|
||||
if (!result && thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
|
||||
DBUG_RETURN(result);
|
||||
|
||||
if (create_info->tmp_table())
|
||||
@ -7943,9 +7943,11 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
KEY *key_info=table->key_info;
|
||||
bool rc= TRUE;
|
||||
bool modified_primary_key= FALSE;
|
||||
bool vers_system_invisible= false;
|
||||
Create_field *def;
|
||||
Field **f_ptr,*field;
|
||||
MY_BITMAP *dropped_fields= NULL; // if it's NULL - no dropped fields
|
||||
bool save_reopen= table->m_needs_reopen;
|
||||
bool drop_period= false;
|
||||
DBUG_ENTER("mysql_prepare_alter_table");
|
||||
|
||||
@ -8052,7 +8054,11 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
bitmap_set_bit(dropped_fields, field->field_index);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (field->invisible == INVISIBLE_SYSTEM &&
|
||||
field->flags & VERS_SYSTEM_FIELD)
|
||||
{
|
||||
vers_system_invisible= true;
|
||||
}
|
||||
/* invisible versioning column is dropped automatically on DROP SYSTEM VERSIONING */
|
||||
if (!drop && field->invisible >= INVISIBLE_SYSTEM &&
|
||||
field->flags & VERS_SYSTEM_FIELD &&
|
||||
@ -8170,7 +8176,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
dropped_sys_vers_fields &= VERS_SYSTEM_FIELD;
|
||||
if ((dropped_sys_vers_fields ||
|
||||
alter_info->flags & ALTER_DROP_PERIOD) &&
|
||||
dropped_sys_vers_fields != VERS_SYSTEM_FIELD)
|
||||
dropped_sys_vers_fields != VERS_SYSTEM_FIELD &&
|
||||
!vers_system_invisible)
|
||||
{
|
||||
StringBuffer<NAME_LEN*3> tmp;
|
||||
append_drop_column(thd, dropped_sys_vers_fields & VERS_SYS_START_FLAG,
|
||||
@ -8180,6 +8187,11 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
my_error(ER_MISSING, MYF(0), table->s->table_name.str, tmp.c_ptr());
|
||||
goto err;
|
||||
}
|
||||
else if (alter_info->flags & ALTER_DROP_PERIOD && vers_system_invisible)
|
||||
{
|
||||
my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), "PERIOD FOR SYSTEM_TIME on", table->s->table_name.str);
|
||||
goto err;
|
||||
}
|
||||
alter_info->flags &= ~(ALTER_DROP_PERIOD | ALTER_ADD_PERIOD);
|
||||
def_it.rewind();
|
||||
while ((def=def_it++)) // Add new columns
|
||||
@ -8687,7 +8699,9 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
||||
alter_info->create_list.swap(new_create_list);
|
||||
alter_info->key_list.swap(new_key_list);
|
||||
alter_info->check_constraint_list.swap(new_constraint_list);
|
||||
DBUG_RETURN(rc);
|
||||
err:
|
||||
table->m_needs_reopen= save_reopen;
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@ -10345,6 +10359,7 @@ end_temporary:
|
||||
(ulong) (copied + deleted), (ulong) deleted,
|
||||
(ulong) thd->get_stmt_da()->current_statement_warn_count());
|
||||
my_ok(thd, copied + deleted, 0L, alter_ctx.tmp_buff);
|
||||
DEBUG_SYNC(thd, "alter_table_inplace_trans_commit");
|
||||
DBUG_RETURN(false);
|
||||
|
||||
err_new_table_cleanup:
|
||||
@ -10411,7 +10426,8 @@ err_with_mdl:
|
||||
tables and release the exclusive metadata lock.
|
||||
*/
|
||||
thd->locked_tables_list.unlink_all_closed_tables(thd, NULL, 0);
|
||||
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
|
||||
if (!table_list->table)
|
||||
thd->mdl_context.release_all_locks_for_name(mdl_ticket);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
|
||||
@ -10444,12 +10460,14 @@ bool mysql_trans_commit_alter_copy_data(THD *thd)
|
||||
uint save_unsafe_rollback_flags;
|
||||
DBUG_ENTER("mysql_trans_commit_alter_copy_data");
|
||||
|
||||
/* Save flags as transcommit_implicit_are_deleting_them */
|
||||
/* Save flags as trans_commit_implicit are deleting them */
|
||||
save_unsafe_rollback_flags= thd->transaction.stmt.m_unsafe_rollback_flags;
|
||||
|
||||
DEBUG_SYNC(thd, "alter_table_copy_trans_commit");
|
||||
|
||||
if (ha_enable_transaction(thd, TRUE))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
|
||||
/*
|
||||
Ensure that the new table is saved properly to disk before installing
|
||||
the new .frm.
|
||||
|
Reference in New Issue
Block a user