Skip to content

Commit

Permalink
MDEV-28552 Assertion `inited==RND' failed in handler::ha_rnd_end
Browse files Browse the repository at this point in the history
We cannot permanently change bits in read_partitions in the middle of
processing because ha_rnd_init()/ha_rnd_end() depends on that.
  • Loading branch information
midenok authored and vuvova committed May 12, 2022
1 parent e03a13e commit 2cde995
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
12 changes: 12 additions & 0 deletions mysql-test/suite/versioning/r/partition.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
18 changes: 18 additions & 0 deletions mysql-test/suite/versioning/t/partition.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion sql/ha_partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,6 @@ class ha_partition :public handler
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;
}
Expand Down
2 changes: 0 additions & 2 deletions sql/partition_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2cde995

Please sign in to comment.