Thanks @apenning
From a users perspective it isn’t illogical to expect a comment and comment history to be different, so the use case to have comment be removed from a object but maintained in the history logical.
I feel that if there is a bug it is more likely that retention shouldn’t be using remove_time.
retention:
history-days: 90
This config reads as it should have the behaviour “delete [comment] history after 90 days from when it was created” not “delete [comment] history after 90 days but only if something else has set a remove_time”
Thought with this there could be a argument to maintain the comment history if the comment hasn’t been deleted so perhaps the safe statement is “delete [comment] history after 90 days from when it was created if the comment is no longer exists”
I useful query I’ve been using to monitor history is
SELECT 'acknowledgement_history' AS type,
FROM_UNIXTIME(MIN(set_time) DIV 1000) AS oldest,
FROM_UNIXTIME(MAX(set_time) DIV 1000) AS newest,
COUNT(*) AS total,
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MIN(set_time) DIV 1000), NOW()) AS oldest_age_days,
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MAX(set_time) DIV 1000), NOW()) AS newest_age_days
FROM acknowledgement_history
UNION ALL
SELECT 'comment_history',
FROM_UNIXTIME(MIN(entry_time) DIV 1000), FROM_UNIXTIME(MAX(entry_time) DIV 1000), COUNT(*),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MIN(entry_time) DIV 1000), NOW()),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MAX(entry_time) DIV 1000), NOW())
FROM comment_history
UNION ALL
SELECT 'downtime_history',
FROM_UNIXTIME(MIN(entry_time) DIV 1000), FROM_UNIXTIME(MAX(entry_time) DIV 1000), COUNT(*),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MIN(entry_time) DIV 1000), NOW()),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MAX(entry_time) DIV 1000), NOW())
FROM downtime_history
UNION ALL
SELECT 'flapping_history',
FROM_UNIXTIME(MIN(start_time) DIV 1000), FROM_UNIXTIME(MAX(start_time) DIV 1000), COUNT(*),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MIN(start_time) DIV 1000), NOW()),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MAX(start_time) DIV 1000), NOW())
FROM flapping_history
UNION ALL
SELECT 'notification_history',
FROM_UNIXTIME(MIN(send_time) DIV 1000), FROM_UNIXTIME(MAX(send_time) DIV 1000), COUNT(*),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MIN(send_time) DIV 1000), NOW()),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MAX(send_time) DIV 1000), NOW())
FROM notification_history
UNION ALL
SELECT 'state_history',
FROM_UNIXTIME(MIN(event_time) DIV 1000), FROM_UNIXTIME(MAX(event_time) DIV 1000), COUNT(*),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MIN(event_time) DIV 1000), NOW()),
TIMESTAMPDIFF(DAY, FROM_UNIXTIME(MAX(event_time) DIV 1000), NOW())
FROM state_history;