mirror of
https://github.com/MariaDB/server.git
synced 2025-04-21 22:55:35 +02:00
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.
This commit is contained in:
parent
b70d5476b6
commit
732d1ec3ae
4 changed files with 23 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue