Bug 1544890 - notifications do not get cleared from the notification table
Summary: notifications do not get cleared from the notification table
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Appliance
Version: 5.8.0
Hardware: All
OS: All
medium
medium
Target Milestone: GA
: 5.10.0
Assignee: Nick LaMuro
QA Contact: Shveta
URL:
Whiteboard:
Depends On:
Blocks: 1553780 1568016
TreeView+ depends on / blocked
 
Reported: 2018-02-13 17:00 UTC by Felix Dewaleyne
Modified: 2021-12-10 15:40 UTC (History)
8 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1553780 1568016 (view as bug list)
Environment:
Last Closed: 2019-02-11 14:01:43 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3656321 0 None None None 2018-10-16 21:03:14 UTC

Description Felix Dewaleyne 2018-02-13 17:00:43 UTC
Description of problem:
notifications do not get cleared from the notification table - this means the notifications table keeps on growing 

Version-Release number of selected component (if applicable):
5.8.2

How reproducible:
all the time

Steps to Reproduce:
1.generate notifications for cloudforms
2.
3.

Actual results:
there is no mechanism in place so notifications never get removed from the database

Expected results:
the notifications get removed from the db at some point to avoid the table from growing out of control

Additional info:
did not find any mechanism in app/models/miq_alert.rb that shows how alerts would be removed from the db (from the notifications table)

Comment 3 Nick LaMuro 2018-02-23 23:10:31 UTC
Proposed purger PR:  https://github.com/ManageIQ/manageiq/pull/17046

Comment 4 Nick LaMuro 2018-03-08 21:05:25 UTC
PR above merged.

Of note, we tried a different approached making use of the `expired_in` column that wasn't currently being used, but decided against that since it could just be purged with everything else.

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

[1]
~~~~~~~~~~~~~~
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 8 Nick LaMuro 2018-06-06 15:10:53 UTC
This question has been responded to in https://bugzilla.redhat.com/show_bug.cgi?id=1568016#c4

Comment 9 Nick LaMuro 2018-06-06 15:11:50 UTC
Err... comment #5... fat-fingered copy paste.

Comment 10 Shveta 2018-12-03 20:30:16 UTC
Entries from notification table can be deleted .
Verified in 5.10.0.27.20181128170555_43ed8cb


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