summaryrefslogtreecommitdiff
path: root/sql/partition_info.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-04-22 15:49:37 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-04-22 15:49:37 +0300
commit88a9f13a9004180d447dfd405bcc4c0139308a04 (patch)
tree3d501cd7cfd22f8e3f0a81e5b96c5941de7b35cc /sql/partition_info.cc
parent4d1129006500ebc0febe173308cc09190238e91b (diff)
downloadmariadb-git-88a9f13a9004180d447dfd405bcc4c0139308a04.tar.gz
MDEV-25546 LIMIT partitioning does not respect ROLLBACK
vers_info->hist_part retained stale value after ROLLBACK. The algorithm in vers_set_hist_part() continued iteration from that value. The simplest solution is to process partitions each time from start for LIMIT in vers_set_hist_part().
Diffstat (limited to 'sql/partition_info.cc')
-rw-r--r--sql/partition_info.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index edcdd6d2b37..f523415f6cc 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -843,12 +843,10 @@ int partition_info::vers_set_hist_part(THD *thd)
if (vers_info->limit)
{
ha_partition *hp= (ha_partition*)(table->file);
- partition_element *next= NULL;
+ partition_element *next;
List_iterator<partition_element> it(partitions);
- while (next != vers_info->hist_part)
- next= it++;
- DBUG_ASSERT(bitmap_is_set(&read_partitions, next->id));
- ha_rows records= hp->part_records(next);
+ ha_rows records= 0;
+ vers_info->hist_part= partitions.head();
while ((next= it++) != vers_info->now_part)
{
DBUG_ASSERT(bitmap_is_set(&read_partitions, next->id));