summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-01-13 23:35:16 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-01-13 23:35:16 +0300
commit4d5ae2b3258d0d4eb3addd61fdabf49d9a6314e7 (patch)
tree5c211278de35118604bb0650b6e775fed2e37724 /sql/ha_partition.cc
parentf9f6b190ccea9c266a541ebbc05b1e2352c84d25 (diff)
downloadmariadb-git-4d5ae2b3258d0d4eb3addd61fdabf49d9a6314e7.tar.gz
MDEV-27217 DELETE partition selection doesn't work for history partitions
LIMIT history switching requires the number of history partitions to be marked for read: from first to last non-empty plus one empty. The least we can do is to fail with error message if the needed partition was not marked for read. As this is handler interface we require new handler error code to display user-friendly error message. Switching by INTERVAL works out-of-the-box with ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET error.
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index bd73642cd0d..33204c03cf1 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3943,8 +3943,9 @@ int ha_partition::external_lock(THD *thd, int lock_type)
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);
+ thd->lex->sql_command != SQLCOM_INSERT_SELECT &&
+ (error= m_part_info->vers_set_hist_part(thd)))
+ goto err_handler;
}
DBUG_RETURN(0);
@@ -4085,6 +4086,7 @@ 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);
}
+ // FIXME: check error?
switch (lock_type)
{
case TL_WRITE_ALLOW_WRITE:
@@ -4100,7 +4102,7 @@ int ha_partition::start_stmt(THD *thd, thr_lock_type lock_type)
// 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);
+ error= m_part_info->vers_set_hist_part(thd);
default:;
}
DBUG_RETURN(error);