TT#52359 consider negative DateTime::Duration / 6.5

Change-Id: I1f5c4885196b0179350ec4a258712afb29a7c27b
(cherry picked from commit c58bf4ed45)
changes/19/27119/2
Rene Krenn 8 years ago
parent 724e613be6
commit 0720271cb3

@ -352,15 +352,15 @@ sub update_partitions {
$dt_max->add(months => 1);
$dt_max->truncate(to => 'month');
my $dt_diff = $dt_max-$dt_min;
my $months = $dt_diff->years*12+$dt_diff->months;
my $months = ($dt_diff->years*12+$dt_diff->months) * ($dt_diff->is_negative() ? -1 : 1);
$self->debug(sprintf "table=%s checking start=%s end=%s",
$table, $dt_min->strftime('%Y-%m'), $dt_max->strftime('%Y-%m'));
if ($months >= $MAX_PARTITIONS) {
die sprintf "%s%s",
"Cannot update partitions for table=$table,",
"the gap between min/max record is too large (more than 24 months).";
"Cannot update partitions for table=$table, ",
"the gap between max record time and min record time is too large (more than 24 months).";
}
if ($self->check_partition_exists($table, 'pmax')) { # already partitionined

Loading…
Cancel
Save