summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-05-12 20:19:33 +0300
committerSergei Golubchik <serg@mariadb.org>2022-05-18 01:22:29 +0200
commit107623c5c57fa81fd2942ba43ac3677f32ae230c (patch)
tree1d1f71ffcc39c0cb8e6cf8979789d47732659064
parent8609254f4f299cac7f047cd170ae09af17feed0b (diff)
downloadmariadb-git-107623c5c57fa81fd2942ba43ac3677f32ae230c.tar.gz
MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end
We cannot permanently change bits in read_partitions in the middle of processing because ha_rnd_init()/ha_rnd_end() depends on that.
-rw-r--r--mysql-test/suite/versioning/r/partition.result12
-rw-r--r--mysql-test/suite/versioning/t/partition.test18
-rw-r--r--sql/ha_partition.h1
-rw-r--r--sql/partition_info.cc2
4 files changed, 30 insertions, 3 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index a5bc8284f8c..eae7d276fde 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -1133,5 +1133,17 @@ select count(*) from t1 partition (p1);
count(*)
100
drop table t1;
+#
+# MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end
+#
+create table tcount (c int unsigned);
+insert into tcount values (0);
+create table t (f int) with system versioning
+partition by system_time limit 1000
+(partition p1 history, partition pn current);
+insert into t values (1),(2);
+create trigger tr before insert on t for each row update tcount set c = c + 1;
+insert into t select * from t;
+drop table tcount, t;
# End of 10.3 tests
set global innodb_stats_persistent= @save_persistent;
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index f65f544147f..b18493ae91c 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -1080,6 +1080,24 @@ replace t1 select * from t1;
select count(*) from t1 partition (p0);
select count(*) from t1 partition (p1);
drop table t1;
+
+--echo #
+--echo # MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end
+--echo #
+create table tcount (c int unsigned);
+insert into tcount values (0);
+
+create table t (f int) with system versioning
+partition by system_time limit 1000
+(partition p1 history, partition pn current);
+insert into t values (1),(2);
+create trigger tr before insert on t for each row update tcount set c = c + 1;
+
+insert into t select * from t;
+
+# cleanup
+drop table tcount, t;
+
--echo # End of 10.3 tests
set global innodb_stats_persistent= @save_persistent;
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index f5c12318b2d..e85c61b839d 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1608,7 +1608,6 @@ public:
for (; part_id < part_id_end; ++part_id)
{
handler *file= m_file[part_id];
- DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), part_id));
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_OPEN);
part_recs+= file->stats.records;
}
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 90ef388f3b9..fb55091f05e 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -904,8 +904,6 @@ void partition_info::vers_check_limit(THD *thd)
uint32 part_id= vers_info->hist_part->id * sub_factor;
const uint32 part_id_end= part_id + sub_factor;
DBUG_ASSERT(part_id_end <= num_parts * sub_factor);
- for (; part_id < part_id_end; ++part_id)
- bitmap_set_bit(&read_partitions, part_id);
ha_partition *hp= (ha_partition*)(table->file);
ha_rows hist_rows= hp->part_records(vers_info->hist_part);