Source
zbx_rtc_subscribe(process_type, process_num, rtc_msgs, ARRSIZE(rtc_msgs), housekeeper_args_in->config_timeout,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/******************************************************************************
* *
* Purpose: remove outdated information from historical table *
* *
* Parameters: table - [IN] *
* lastid_field - [IN] lastid field name in ids table *
* clock_field - [IN] record creation timestamp field *
* now - [IN] current timestamp *
* config_offline_buffer - [IN] hours to keep data when offline *
* config_local_buffer - [IN] hours to keep data *
* *
* Return value: number of rows records *
* *
******************************************************************************/
static int delete_history(const char *table, const char *lastid_field, const char *clock_field, int now,
int config_offline_buffer, int config_local_buffer)
{
zbx_db_result_t result;
zbx_db_row_t row;
int records = 0;
zbx_uint64_t lastid, maxid;
char *condition = NULL;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() table:'%s' now:%d", __func__, table, now);
zbx_db_begin();
result = zbx_db_select(
"select nextid"
" from ids"
" where table_name='%s'"
" and field_name='%s'",
table, lastid_field);
if (NULL == (row = zbx_db_fetch(result)))