[ZBX-18169] housekeeper does not delete history/trends of deleted items if override period is used Created: 2020 Jul 30  Updated: 2024 Apr 10  Resolved: 2020 Aug 07

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 5.0.2
Fix Version/s: 5.0.3rc1, 5.2.0alpha1, 5.2 (plan)

Type: Problem report Priority: Blocker
Reporter: Oleksii Zagorskyi Assignee: Vladislavs Sokurenko
Resolution: Fixed Votes: 1
Labels: housekeeper, regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Team: Team A
Sprint: Sprint 66 (Jul 2020), Sprint 67 (Aug 2020)
Story Points: 1

 Description   

I could not believe it is. But that's true.

In function we have these lines:

	for (table = hk_cleanup_tables; NULL != table->name; table++)
	{
		if (ZBX_HK_MODE_REGULAR != *table->poption_mode || ZBX_HK_OPTION_ENABLED == *table->poption_global)
			continue;

Imagine that for some reason I decided to keep less history and/or trends than set per-item level.
I've just enabled "Override item history/trend period" checkbox(s) and set custom number of days.
I keep "Enable internal housekeeping" enabled for history/trends, as it was.

In a result, number of records in "housekeeper" table started to grow.
Zabbix server executes this SQL to select records for cleanup:

select housekeeperid,tablename,field,value from housekeeper where tablename in ('events') order by tablename

Why is this so?
How history/trends of deleted items is different from history/trends of existing items?
Why for deleted ones it's preserved but for existing ones it's cleaned up ?

I'm pretty sure this is regression.
If it's by design - it's absolutely not clear for user why such logic is used.

As I see this logic has been changed in version 4.2.
4.0 was fine in this regard.



 Comments   
Comment by Oleksii Zagorskyi [ 2020 Aug 03 ]

Btw, affected installations likely may log slow SQL warnings for this SQL:

select housekeeperid,tablename,field,value from housekeeper where tablename in ('events') order by tablename

as the table became big.
I saw these slow SQL already on 2 installations.
They should go away after some period after upgrade, of course.

Comment by Vladislavs Sokurenko [ 2020 Aug 06 ]

Fixed in

  • pre-5.0.3rc1 9c3ca976629
  • pre-5.2.0alpha1 (master) 9078bba3fef
Generated at Sat Jun 14 17:31:42 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.