From 2bde31bb8107043645b7a7041b0daec9b9779720 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 16 Jan 2020 09:27:28 +0100 Subject: [PATCH] UrlMigrator: Replace `next_update` with `is_overdue` `next_update` is volatile and only in redis up to date so it's not possible to filter for it in the database. `is_overdue` on the other hand is not volatile and serves the same purpose if the expression is `now` --- library/Icingadb/Compat/UrlMigrator.php | 26 +++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/library/Icingadb/Compat/UrlMigrator.php b/library/Icingadb/Compat/UrlMigrator.php index e628c61e..c6f9fddf 100644 --- a/library/Icingadb/Compat/UrlMigrator.php +++ b/library/Icingadb/Compat/UrlMigrator.php @@ -371,10 +371,17 @@ class UrlMigrator 'host_last_time_unreachable' => self::DROP, 'host_last_time_up' => self::DROP, 'host_next_notification' => self::DROP, - 'host_next_update' => [ + 'host_next_update' => function ($filter) { + /** @var \Icinga\Data\Filter\FilterExpression $filter */ + if ($filter->getExpression() !== 'now') { + return false; + } + // Doesn't get dropped because there's a default dashlet using it.. - 'host.state.next_update' => self::USE_EXPR - ], + // Though since this dashlet uses it to check for overdue hosts we'll + // replace it as next_update is volatile (only in redis up2date) + return Filter::where('host.state.is_overdue', $filter->getSign() === '<' ? 'y' : 'n'); + }, 'host_no_more_notifications' => self::DROP, 'host_normal_check_interval' => self::DROP, 'host_problem_has_been_acknowledged' => self::DROP, @@ -684,10 +691,17 @@ class UrlMigrator 'service_failure_prediction_enabled' => self::DROP, 'service_is_passive_checked' => self::DROP, 'service_next_notification' => self::DROP, - 'service_next_update' => [ + 'service_next_update' => function ($filter) { + /** @var \Icinga\Data\Filter\FilterExpression $filter */ + if ($filter->getExpression() !== 'now') { + return false; + } + // Doesn't get dropped because there's a default dashlet using it.. - 'service.state.next_update' => self::USE_EXPR - ], + // Though since this dashlet uses it to check for overdue services we'll + // replace it as next_update is volatile (only in redis up2date) + return Filter::where('host.state.is_overdue', $filter->getSign() === '<' ? 'y' : 'n'); + }, 'service_no_more_notifications' => self::DROP, 'service_normal_check_interval' => self::DROP, 'service_percent_state_change' => self::DROP,