Commit 732d1ec3 authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-29873 MSAN uninitialized value errors in bcmp /

	   prep_alter_part_table upon re-partitioning by system time

memcmp() tries to compare beyond the last member of interval because
sizeof(Vers_part_info::interval) is 80. It is sizeof of variable,
sizeof of type is 76.

Now we compare interval_t struct C++ way.
parent b70d5476
......@@ -3406,4 +3406,11 @@ f()
drop procedure p;
drop function f;
drop table t;
#
# MDEV-29873 MSAN uninitialized value errors in bcmp /
# prep_alter_part_table upon re-partitioning by system time
#
create table t (a int) with system versioning partition by system_time interval 5 week;
alter table t partition by system_time interval 10 week;
drop table t;
set global innodb_stats_persistent= @save_persistent;
......@@ -2624,6 +2624,15 @@ drop procedure p;
drop function f;
drop table t;
--echo #
--echo # MDEV-29873 MSAN uninitialized value errors in bcmp /
--echo # prep_alter_part_table upon re-partitioning by system time
--echo #
create table t (a int) with system versioning partition by system_time interval 5 week;
alter table t partition by system_time interval 10 week;
# cleanup
drop table t;
--disable_prepare_warnings
set global innodb_stats_persistent= @save_persistent;
--source suite/versioning/common_finish.inc
......@@ -78,11 +78,16 @@ struct Vers_part_info : public Sql_alloc
}
return false;
}
struct {
struct interval_t {
my_time_t start;
INTERVAL step;
enum interval_type type;
bool is_set() const { return type < INTERVAL_LAST; }
bool operator==(const interval_t &rhs) const
{
/* TODO: equivalent intervals like 1 hour and 60 mins should be considered equal */
return start == rhs.start && type == rhs.type && !memcmp(&step, &rhs.step, sizeof(INTERVAL));
}
} interval;
ulonglong limit;
bool auto_hist;
......
......@@ -6035,10 +6035,7 @@ the generated partition syntax in a correct manner.
{
if (part_info->vers_info->interval.is_set() && (
!tab_part_info->vers_info->interval.is_set() ||
/* TODO: equivalent intervals like 1 hour and 60 mins should be considered equal */
memcmp(&part_info->vers_info->interval,
&tab_part_info->vers_info->interval,
sizeof(Vers_part_info::interval))))
part_info->vers_info->interval == tab_part_info->vers_info->interval))
{
/* If interval is changed we can not do fast alter */
tab_part_info= tab_part_info->get_clone(thd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment