Skip to content

Commit

Permalink
fix(gorgone): mbi unable to rebuild partial data with new scripts (#1190
Browse files Browse the repository at this point in the history
)
  • Loading branch information
garnier-quentin authored Mar 31, 2023
1 parent 0473aa4 commit 43b94d0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions gorgone/gorgone/modules/centreon/mbi/etl/perfdata/main.pm
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,22 @@ sub deleteEntriesForRebuild {
"DELETE FROM $options{name} WHERE time_id >= " . $utils->getDateEpoch($options{start}) . " AND time_id < " . $utils->getDateEpoch($options{end})
];
} else {
my $structure = $biTables->dumpTableStructure($options{name});
my $partitionsPerf = $utils->getRangePartitionDate($options{start}, $options{end});
foreach (@$partitionsPerf) {
push @$sql,
[
"[PURGE] Truncate partition $_->{name} on table [$options{name}]",
"ALTER TABLE $options{name} TRUNCATE PARTITION p$_->{name}"
];
if ($structure =~ /p$_->{name}/m) {
push @$sql,
[
"[PURGE] Truncate partition $_->{name} on table [$options{name}]",
"ALTER TABLE $options{name} TRUNCATE PARTITION p$_->{name}"
];
} else {
push @$sql,
[
'[PARTITIONS] Add partition [p' . $_->{name} . '] on table [' . $options{name} . ']',
"ALTER TABLE `$options{name}` ADD PARTITION (PARTITION `p$_->{name}` VALUES LESS THAN(" . $_->{epoch} . "))"
];
}
}
}

Expand Down

0 comments on commit 43b94d0

Please sign in to comment.