diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-08-14 18:06:51 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-08-14 18:06:51 +0300 |
commit | 1d15a28e52e41fae0847284089b2073ab33162a5 (patch) | |
tree | 3d2dbd3ebda6547c26642e597b5cafc56e7ed031 /sql/ha_partition.cc | |
parent | c4feef50cfa4033e646636ed37e255d2b3593fbf (diff) | |
parent | a20f6f9853e522ad388f5b968ce11af3c5d1fc10 (diff) | |
download | mariadb-git-1d15a28e52e41fae0847284089b2073ab33162a5.tar.gz |
Merge 10.3 into 10.4
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 75f6585f847..b6c5db7cd5c 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); } |