Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(mysql) fix mysql bug on partitioned tables #6974

Merged
merged 6 commits into from
Dec 10, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions www/include/reporting/dashboard/DB-Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,16 +424,17 @@ function getLogInDbForOneSVC($host_id, $service_id, $start_date, $end_date, $rep
'WHERE las.host_id = acl.host_id AND las.service_id = acl.service_id ' .
'AND acl.group_id IN (' . $centreon->user->access->getAccessGroupsString() . ') )';
}
// Use "like" instead of "=" to avoid mysql bug on partitioned tables
$rq = "SELECT DISTINCT las.service_id, sum(OKTimeScheduled) as OK_T, sum(OKnbEvent) as OK_A, "
. "sum(WARNINGTimeScheduled) as WARNING_T, sum(WARNINGnbEvent) as WARNING_A, "
. "sum(UNKNOWNTimeScheduled) as UNKNOWN_T, sum(UNKNOWNnbEvent) as UNKNOWN_A, "
. "sum(CRITICALTimeScheduled) as CRITICAL_T, sum(CRITICALnbEvent) as CRITICAL_A, "
. "sum(UNDETERMINEDTimeScheduled) as UNDETERMINED_T, "
. "sum(MaintenanceTime) as MAINTENANCE_T "
. "FROM log_archive_service las "
. "WHERE las.host_id = " . $host_id . " "
. $aclCondition .
" AND las.service_id = " . $service_id . " AND `date_start` >= " . $start_date .
. "WHERE las.host_id LIKE '" . $host_id . "' "
. $aclCondition .
" AND las.service_id LIKE '" . $service_id . "' AND `date_start` >= " . $start_date .
" AND date_end <= " . $end_date . " "
. "AND DATE_FORMAT(FROM_UNIXTIME(date_start), '%W') IN (" . $days_of_week . ") "
. "GROUP BY las.service_id";
Expand Down