diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-08-16 14:35:32 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-08-16 14:35:32 +0300 |
commit | 67ddb6507d58b08f88dfede96b057eae34d9d76e (patch) | |
tree | 5f28ca11d7940d4fc17b6b9182eda27bae88e70f /sql/ha_partition.cc | |
parent | 6073049a3675363f7d7efe26f47525b528be9e2f (diff) | |
parent | c221bcdce7714a74b89a02de941e8d8df2994ce3 (diff) | |
download | mariadb-git-67ddb6507d58b08f88dfede96b057eae34d9d76e.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r-- | sql/ha_partition.cc | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index a08928d964b..80cb6dd4322 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -3953,7 +3953,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); @@ -4095,8 +4100,24 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type) /* Add partition to be called in reset(). */ bitmap_set_bit(&m_partitions_to_reset, i); } - if (lock_type == F_WRLCK && m_part_info->part_expr) - m_part_info->part_expr->walk(&Item::register_field_in_read_map, 1, 0); + switch (lock_type) + { + case TL_WRITE_ALLOW_WRITE: + case TL_WRITE_CONCURRENT_INSERT: + case TL_WRITE_DELAYED: + case TL_WRITE_DEFAULT: + case TL_WRITE_LOW_PRIORITY: + case TL_WRITE: + 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 && + // 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:; + } DBUG_RETURN(error); } |