mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-29069 follow-up: allow deterministic DEFAULTs
This commit is contained in:
committed by
Sergei Golubchik
parent
2be4c836e5
commit
bac728a263
@ -1073,8 +1073,8 @@ update t set a = a + 1 where a = 10;
|
||||
set debug_sync= 'now signal goforit';
|
||||
connection default;
|
||||
Warnings:
|
||||
Note 1105 Key chosen: -1
|
||||
Note 1105 Key chosen: -1
|
||||
Note 1105 Key chosen: 0
|
||||
Note 1105 Key chosen: 0
|
||||
select a from t;
|
||||
a
|
||||
11
|
||||
@ -1093,8 +1093,8 @@ update t set a = a + 1 where a = 10;
|
||||
set debug_sync= 'now signal goforit';
|
||||
connection default;
|
||||
Warnings:
|
||||
Note 1105 Key chosen: -1
|
||||
Note 1105 Key chosen: -1
|
||||
Note 1105 Key chosen: 0
|
||||
Note 1105 Key chosen: 0
|
||||
#
|
||||
# Add key for old row
|
||||
#
|
||||
|
@ -7107,11 +7107,12 @@ record_compare_differ:
|
||||
bool Rows_log_event::is_key_usable(const KEY *key) const
|
||||
{
|
||||
RPL_TABLE_LIST *tl= (RPL_TABLE_LIST*)m_table->pos_in_table_list;
|
||||
const bool online_alter= tl->m_online_alter_copy_fields;
|
||||
|
||||
if (!m_table->s->keys_in_use.is_set(uint(key - m_table->key_info)))
|
||||
return false;
|
||||
|
||||
if (!tl->m_online_alter_copy_fields)
|
||||
if (!online_alter)
|
||||
{
|
||||
if (m_cols.n_bits >= m_table->s->fields)
|
||||
return true;
|
||||
@ -7126,8 +7127,17 @@ bool Rows_log_event::is_key_usable(const KEY *key) const
|
||||
|
||||
for (uint p= 0; p < key->user_defined_key_parts; p++)
|
||||
{
|
||||
uint field_idx= key->key_part[p].fieldnr - 1;
|
||||
if (!bitmap_is_set(&m_table->has_value_set, field_idx))
|
||||
Field *f= key->key_part[p].field;
|
||||
/*
|
||||
in the online alter case (but not in replication) we don't have
|
||||
to reject an index if it includes new columns, as long as
|
||||
their values are deterministic.
|
||||
*/
|
||||
bool non_deterministic_default= f->default_value &&
|
||||
f->default_value->flags & VCOL_NOT_STRICTLY_DETERMINISTIC;
|
||||
bool next_number_field= f == f->table->next_number_field;
|
||||
if (!bitmap_is_set(&m_table->has_value_set, f->field_index) &&
|
||||
(!online_alter || non_deterministic_default || next_number_field))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user