Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-10012

Housekeeper tries to delete data which could not exist (0 days keep history/trends)

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Won't fix
    • Icon: Minor Minor
    • None
    • 2.2.10, 2.4.6, 3.0.0alpha3
    • Server (S)

      Investigated in zabbix server v 3.0.0 alpha4
      Suppose we have numeric items which have keep history or keep trends set to 0 days.
      According to documentation, zabbix server will not store history or trends if corresponding keep parameter is 0.
      https://www.zabbix.com/documentation/2.4/manual/config/items/history_and_trends

      But housekeeper process still each time is trying to delete data for such items, disregarding that they could not store any data. From 2nd and for following executions:

       10286:20151027:175335.549 In housekeeping_history_and_trends() now:1445961215
       10286:20151027:175335.549 In hk_history_delete_queue_prepare_all()
       10286:20151027:175335.550 query [txnlev:0] [select i.itemid,i.value_type,i.history,i.trends from items i,hosts h where i.hostid=h.hostid and h.status in (0,1)]
       10286:20151027:175335.550 End of hk_history_delete_queue_prepare_all()
       10286:20151027:175335.550 query without transaction detected
       10286:20151027:175335.550 query [txnlev:0] [delete from history_uint where itemid=27785 and clock<1445961215]
       10286:20151027:175335.550 query without transaction detected
       10286:20151027:175335.550 query [txnlev:0] [delete from trends where itemid=27796 and clock<1445961215]
       10286:20151027:175335.551 query without transaction detected
      ...
      

      note that the time stamps in "clock<1445961215" conditions are always
      = now(), which is sort of correct.

      The same happens if you change some item "keep" parameter to 0 days when server is running - those SQLs will start to appear.

      One interesting point that such unneeded delete SQLs performed starting from 2nd housekeeper execution only.

      I've tested another case - when an item has history/trends data, but on server start the items settings is 0 for keep history or trends.
      In this case housekeeper correctly starts to delete already outdated data in 4*HousekeepingFrequency batches (note, from 1st housekeeper execution).
      But would be good if it would stop to do unneeded deletions if it deleted everything (has deleted 0 rows during last batch) and the item has 0 days in settings.

      Yeah, I understand that this request will improve housekeeper just a little, but still ...
      I always look with suspicion on unneeded SQL queries, and it has happened this time too

      Also, taking into account that those deletes performed from 2nd housekeeper execution only, I suppose that there could be a small bug.

            Unassigned Unassigned
            zalex_ua Oleksii Zagorskyi
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: