Bug 1568016 - notifications do not get cleared from the notification table
Summary: notifications do not get cleared from the notification table
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.8.0
Hardware: All
OS: All
Target Milestone: GA
: 5.8.4
Assignee: Nick LaMuro
QA Contact: luke couzens
Keywords: ZStream
Depends On: 1544890
TreeView+ depends on / blocked
Reported: 2018-04-16 15:19 UTC by Satoe Imaishi
Modified: 2018-07-12 22:08 UTC (History)
8 users (show)

Clone Of: 1544890
Last Closed: 2018-06-25 14:20:05 UTC

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:1972 None None None 2018-06-25 14:20 UTC

Comment 3 luke couzens 2018-05-17 13:33:19 UTC
Verified in

Comment 4 Felix Dewaleyne 2018-06-06 12:45:31 UTC
the customer found that table "notification_recipients" also needs to be cleared. 

psql -U postgres vmdb_production -c "DELETE FROM notifications n WHERE n.created_at < '$(date -u --date="1 day ago" +"%Y-%m-%d %H:%M")' AND n.notification_type_id IN ( SELECT nt.id FROM notification_types nt WHERE NOT nt.level='warning' AND NOT nt.level='error' );"

if this is correct, how can we clean it?

Comment 5 Nick LaMuro 2018-06-06 15:05:36 UTC
Hmm.... that is odd.  I specifically covered that case in the changes.

You should be able to run the following though (NOT TESTED) and clear out the notification recipients related to the notification records as well:

DELETE FROM notification_recipients
WHERE notification_recipients.notification_id NOT IN (
  SELECT id FROM notifications

Should delete all notification_recipients where the notification_id is now not present in the notifications table (was purged).

* * *

Can you tell me what version this is happening on?  Might be related to the purging mixin code, and some of that extra functionality might have not made it in whatever version they are experiencing it on, so the associated records are not being deleted.

That said, I added tests around this specifically for Notification recipients, so it might be something else.

Comment 10 errata-xmlrpc 2018-06-25 14:20:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.