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

Housekeeper (history/trends) table is not maintained if TimescaleDB is used

XMLWordPrintable

    • Sprint 79 (Aug 2021), Sprint 80 (Sep 2021)
    • 2

      Steps to reproduce:

      1. use LTS 5.0 with PgSQL/TSDB
      2. generate history/trends data

      Result:

      select count(*),tablename,field from housekeeper group by tablename, field order by 1 desc; 
      count   tablename   field
      5618227 trends_uint itemid
      5618227 history_text    itemid
      5618227 history_uint    itemid
      5618227 trends  itemid
      5618227 history itemid
      5618227 history_log itemid
      5618227 history_str itemid
      56  events  lldruleid
      56  events  itemid
      2   events  triggerid
      

      Expected:
      Internal housekeeper backlog should be cleaned automatically for history/trends, even if TimescaleDB is used.

      This is a problem because of high amount of data, pgsql vacuum handling and also highly affects streaming replication.

      ...
      static unsigned char poption_mode_regular 	= ZBX_HK_MODE_REGULAR;
      static unsigned char poption_global_disabled	= ZBX_HK_OPTION_DISABLED;
      ...
      /* Housekeeper table mapping to housekeeping configuration values.    */
      /* This mapping is used to exclude disabled tables from housekeeping  */
      /* cleanup procedure.                                                 */
      static zbx_hk_cleanup_table_t	hk_cleanup_tables[] = {
      	{"history",		&cfg.hk.history_mode,	&cfg.hk.history_global},
      	{"history_log",		&cfg.hk.history_mode,	&cfg.hk.history_global},
      	{"history_str",		&cfg.hk.history_mode,	&cfg.hk.history_global},
      	{"history_text",	&cfg.hk.history_mode,	&cfg.hk.history_global},
      	{"history_uint",	&cfg.hk.history_mode,	&cfg.hk.history_global},
      	{"trends",		&cfg.hk.trends_mode,	&cfg.hk.trends_global},
      	{"trends_uint",		&cfg.hk.trends_mode,	&cfg.hk.trends_global},
      	/* force events housekeeping mode on to perform problem cleanup when events housekeeping is disabled */
      	{"events",		&poption_mode_regular,	&poption_global_disabled},
      	{NULL}
      };
      ...
      /* assemble list of tables included in the housekeeping procedure */
      	for (table = hk_cleanup_tables; NULL != table->name; table++)
      	{
      		if (ZBX_HK_MODE_REGULAR != *table->poption_mode)
      			continue;
      
      		table_name_esc = DBdyn_escape_string(table->name);
      
      		zbx_chrcpy_alloc(&sql, &sql_alloc, &sql_offset, '\'');
      		zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset, table_name_esc);
      		zbx_strcpy_alloc(&sql, &sql_alloc, &sql_offset, "',");
      
      		zbx_free(table_name_esc);
      	}
      ...
      

      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/zabbix_server/housekeeper/housekeeper.c#900,911,1228

            vso Vladislavs Sokurenko
            edgar.akhmetshin Edgar Akhmetshin
            Team A
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: