zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: dc_load_trigger_queue                                            *
 *                                                                            *
 * Purpose: load trigger queue from database                                  *
 *                                                                            *
 * Comments: This function is called when syncing configuration cache for the *
 *           first time after server start. After loading trigger queue it    *
 *           will clear the corresponding data in database.                   *
 *                                                                            *
 ******************************************************************************/
dc_load_trigger_queue

Purpose: load trigger queue from database

Comments: This function is called when syncing configuration cache for the
first time after server start. After loading trigger queue it
will clear the corresponding data in database.
dc_load_trigger_queue Purpose : load trigger queue from database Comments : This function is called when syncing configuration cache for the first time after server start . After loading trigger queue it will clear the corresponding data in database .
static void	dc_load_trigger_queue(zbx_hashset_t *trend_functions)
{
	DB_RESULT	result;
	DB_ROW		row;
	result = DBselect("select objectid,type,clock,ns from trigger_queue");
	while (NULL != (row = DBfetch(result)))
	{
		zbx_trigger_timer_t	timer_local, *timer;
		if (ZBX_TRIGGER_TIMER_FUNCTION_TREND != atoi(row[1]))
		{
			THIS_SHOULD_NEVER_HAPPEN;
			continue;
		}
		ZBX_STR2UINT64(timer_local.objectid, row[0]);
		timer_local.eval_ts.sec = atoi(row[2]);
		timer_local.eval_ts.ns =  atoi(row[3]);
		timer = zbx_hashset_insert(trend_functions, &timer_local, sizeof(timer_local));
		if (0 > zbx_timespec_compare(&timer->eval_ts, &timer_local.eval_ts))
			timer->eval_ts = timer_local.eval_ts;
	}
	DBfree_result(result);
}
static void dc_load_trigger_queue ( zbx_hashset_t * trend_functions ) { DB_RESULT result ; DB_ROW row ; result = DBselect ( " " ) ; while ( NULL != ( row = DBfetch ( result ) ) ) { zbx_trigger_timer_t timer_local , * timer ; if ( ZBX_TRIGGER_TIMER_FUNCTION_TREND != atoi ( row [ 1 ] ) ) { THIS_SHOULD_NEVER_HAPPEN ; continue ; } ZBX_STR2UINT64 ( timer_local . objectid , row [ 0 ] ) ; timer_local . eval_ts . sec = atoi ( row [ 2 ] ) ; timer_local . eval_ts . ns = atoi ( row [ 3 ] ) ; timer = zbx_hashset_insert ( trend_functions , & timer_local , sizeof ( timer_local ) ) ; if ( 0 > zbx_timespec_compare ( & timer -> eval_ts , & timer_local . eval_ts ) ) timer -> eval_ts = timer_local . eval_ts ; } DBfree_result ( result ) ; }
Function: dc_load_trigger_queue                                            
                                                                            
 Purpose: load trigger queue from database                                  
                                                                            
 Comments: This function is called when syncing configuration cache for the 
           first time after server start.
Function : dc_load_trigger_queue Purpose : load trigger queue from database Comments : This function is called when syncing configuration cache for the first time after server start .
/* in the case function was scheduled multiple times use the latest data */