From 0ce41399e0b0c2e5de489a9f3c4b9b608e682952 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Fri, 3 Jun 2016 14:40:37 +0200 Subject: [PATCH] DB IDO: Ensure to delete outdated comments/downtimes for host/service objects fixes #11688 --- lib/db_ido/dbevents.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/db_ido/dbevents.cpp b/lib/db_ido/dbevents.cpp index b9b379632..b19bfad5d 100644 --- a/lib/db_ido/dbevents.cpp +++ b/lib/db_ido/dbevents.cpp @@ -303,11 +303,11 @@ void DbEvents::AddComments(const Checkable::Ptr& checkable) { std::set comments = checkable->GetComments(); - if (comments.empty()) - return; - std::vector queries; + /* Ensure to delete all comments and then insert any or none. + * We must purge obsolete comments in the database at all cost. */ + DbQuery query1; query1.Table = "comments"; query1.Type = DbQueryDelete; @@ -442,8 +442,8 @@ void DbEvents::AddDowntimes(const Checkable::Ptr& checkable) { std::set downtimes = checkable->GetDowntimes(); - if (downtimes.empty()) - return; + /* Ensure to delete all downtimes and then insert any or none. + * We must purge obsolete downtimes in the database at all cost. */ std::vector queries;