Bug 1544890

Summary: notifications do not get cleared from the notification table
Product: Red Hat CloudForms Management Engine Reporter: Felix Dewaleyne <fdewaley>
Component: ApplianceAssignee: Nick LaMuro <nlamuro>
Status: CLOSED CURRENTRELEASE QA Contact: Shveta <sshveta>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.8.0CC: abellott, cpelland, dluong, dmetzger, fdewaley, nlamuro, obarenbo, sshveta
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1553780 1568016 (view as bug list) Environment:
Last Closed: 2019-02-11 14:01:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1553780, 1568016    

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