diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2019-08-14 15:52:08 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2019-08-14 17:32:19 +0300 |
commit | a20f6f9853e522ad388f5b968ce11af3c5d1fc10 (patch) | |
tree | 85e763bad3cd71f3383baa42f3b85a13b1c33897 /sql/ha_partition.cc | |
parent | 39db116562f7e5bdd4b8c5dbbdc21a06c7ae09ad (diff) | |
download | mariadb-git-a20f6f9853e522ad388f5b968ce11af3c5d1fc10.tar.gz |
MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
Exclude SELECT and INSERT SELECT from vers_set_hist_part(). We cannot
likewise exclude REPLACE SELECT because it may REPLACE into itself
(and REPLACE generates history).
INSERT also does not generate history, but we have history
modification setting which might be interfered.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 125669a403d..aa630e83ba0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3951,7 +3951,12 @@ int ha_partition::external_lock(THD *thd, int lock_type) { if (m_part_info->part_expr) m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0); - if (m_part_info->part_type == VERSIONING_PARTITION) + if (m_part_info->part_type == VERSIONING_PARTITION && + /* TODO: MDEV-20345 exclude more inapproriate commands like INSERT + These commands may be excluded because working history partition is needed + only for versioned DML. */ + thd->lex->sql_command != SQLCOM_SELECT && + thd->lex->sql_command != SQLCOM_INSERT_SELECT) m_part_info->vers_set_hist_part(thd); } DBUG_RETURN(0); @@ -4104,7 +4109,10 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type) case TL_WRITE_ONLY: if (m_part_info->part_expr) m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0); - if (m_part_info->part_type == VERSIONING_PARTITION) + if (m_part_info->part_type == VERSIONING_PARTITION && + // TODO: MDEV-20345 (see above) + thd->lex->sql_command != SQLCOM_SELECT && + thd->lex->sql_command != SQLCOM_INSERT_SELECT) m_part_info->vers_set_hist_part(thd); default:; } |