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
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions doc/en/faq/administration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ Anyway, it doesn't mean the data will stay into your database
indefinitely. It will be removed in the future, depending on you data
retention policy.

My dashboard on several days is undetermined, what should I look into?
======================================================================

This is a bug from some mysql versions with partitioned tables
(https://bugs.mysql.com/bug.php?id=70588).
Replacing '=' by LIKE in queries fixes the problem but reduces performance.

We therefore recommend to update your SGBD :
MySQL 5.5.36, 5.6.16, 5.7.4,
MariaDB 10.0.33, 10.1.29, 10.2.10.

No graph seems to be generated, what should I look into?
========================================================
Expand Down
14 changes: 7 additions & 7 deletions doc/en/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ DBMS

**Centreon advises you to use MariaDB** instead of MySQL.

+----------+-----------+
| Software | Version |
+==========+===========+
| MariaDB | >= 10.1.x |
+----------+-----------+
| MySQL | >= 5.6.x |
+----------+-----------+
+----------+------------+
| Software | Version |
+==========+============+
| MariaDB | >= 10.1.29 |
+----------+------------+
| MySQL | >= 5.6.16 |
+----------+------------+

Dependent software
==================
Expand Down
11 changes: 11 additions & 0 deletions doc/fr/faq/administration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ Quoi qu'il en soit, cela ne signifie pas que les données resteront dans votre b
indéfiniment. Elles seront supprimées plus tard, en fonction de votre politique de rétention
des données programmée.

Mon dashboard sur plusieurs jours est indetermminé, que dois-je contrôler?
==========================================================================

Il s'agit d'un bug du à certaines versions mysql avec les tables partitionées
(https://bugs.mysql.com/bug.php?id=70588).
Remplacer les '=' par des LIKE dans les requêtes corrige le problème mais réduit les performances.

Nous vous recommandons de mettre à jour votre SGBD
MySQL 5.5.36, 5.6.16, 5.7.4,
MariaDB 10.0.33, 10.1.29, 10.2.10.

Aucun graphique ne semble être généré, que dois-je contrôler?
=============================================================

Expand Down
14 changes: 7 additions & 7 deletions doc/fr/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ SGBD

**Centreon vous recommande d'utiliser MariaDB** plutôt que le moteur MySQL.

+----------+-----------+
| Logiciel | Version |
+==========+===========+
| MariaDB | >= 10.1.x |
+----------+-----------+
| MySQL | >= 5.6.x |
+----------+-----------+
+----------+------------+
| Logiciel | Version |
+==========+============+
| MariaDB | >= 10.1.29 |
+----------+------------+
| MySQL | >= 5.6.16 |
+----------+------------+

Dépendances logicielles
=======================
Expand Down
4 changes: 3 additions & 1 deletion www/include/reporting/dashboard/DB-Func.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@ 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, "
Expand All @@ -432,7 +434,7 @@ function getLogInDbForOneSVC($host_id, $service_id, $start_date, $end_date, $rep
. "sum(MaintenanceTime) as MAINTENANCE_T "
. "FROM log_archive_service las "
. "WHERE las.host_id = " . $host_id . " "
. $aclCondition .
. $aclCondition .
" AND las.service_id = " . $service_id . " AND `date_start` >= " . $start_date .
" AND date_end <= " . $end_date . " "
. "AND DATE_FORMAT(FROM_UNIXTIME(date_start), '%W') IN (" . $days_of_week . ") "
Expand Down