zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCsync_corr_operations                                           *
 *                                                                            *
 * Purpose: Updates correlation operations configuration cache                *
 *                                                                            *
 * Parameters: result - [IN] the result of correlation operations database    *
 *                           select                                           *
 *                                                                            *
 * Comments: The result contains the following fields:                        *
 *           0 - corr_operationid                                             *
 *           1 - correlationid                                                *
 *           2 - type                                                         *
 *                                                                            *
 ******************************************************************************/
DCsync_corr_operations

Purpose: Updates correlation operations configuration cache

Parameters: result - [IN] the result of correlation operations database
select

Comments: The result contains the following fields:
0 - corr_operationid
1 - correlationid
2 - type
DCsync_corr_operations Purpose : Updates correlation operations configuration cache Parameters : result - [ IN ] the result of correlation operations database select Comments : The result contains the following fields : 0 - corr_operationid 1 - correlationid 2 - type
static void	DCsync_corr_operations(zbx_dbsync_t *sync)
{
	char			**row;
	zbx_uint64_t		rowid;
	unsigned char		tag;
	zbx_uint64_t		operationid, correlationid;
	zbx_dc_corr_operation_t	*operation;
	zbx_dc_correlation_t	*correlation;
	int			found, ret, index;
	unsigned char		type;
	zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
	while (SUCCEED == (ret = zbx_dbsync_next(sync, &rowid, &row, &tag)))
	{
		if (ZBX_DBSYNC_ROW_REMOVE == tag)
			break;
		ZBX_STR2UINT64(correlationid, row[1]);
		if (NULL == (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &correlationid)))
			continue;
		ZBX_STR2UINT64(operationid, row[0]);
		ZBX_STR2UCHAR(type, row[2]);
		operation = (zbx_dc_corr_operation_t *)DCfind_id(&config->corr_operations, operationid, sizeof(zbx_dc_corr_operation_t), &found);
		operation->type = type;
		if (0 == found)
		{
			operation->correlationid = correlationid;
			zbx_vector_ptr_append(&correlation->operations, operation);
		}
	}
	for (; SUCCEED == ret; ret = zbx_dbsync_next(sync, &rowid, &row, &tag))
	{
		if (NULL == (operation = (zbx_dc_corr_operation_t *)zbx_hashset_search(&config->corr_operations, &rowid)))
			continue;
		if (NULL != (correlation = (zbx_dc_correlation_t *)zbx_hashset_search(&config->correlations, &operation->correlationid)))
		{
			if (FAIL != (index = zbx_vector_ptr_search(&correlation->operations, operation,
					ZBX_DEFAULT_PTR_COMPARE_FUNC)))
			{
				zbx_vector_ptr_remove_noorder(&correlation->operations, index);
			}
		}
		zbx_hashset_remove_direct(&config->corr_operations, operation);
	}
	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __func__);
}
static void DCsync_corr_operations ( zbx_dbsync_t * sync ) { char * * row ; zbx_uint64_t rowid ; unsigned char tag ; zbx_uint64_t operationid , correlationid ; zbx_dc_corr_operation_t * operation ; zbx_dc_correlation_t * correlation ; int found , ret , index ; unsigned char type ; zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ ) ; while ( SUCCEED == ( ret = zbx_dbsync_next ( sync , & rowid , & row , & tag ) ) ) { if ( ZBX_DBSYNC_ROW_REMOVE == tag ) break ; ZBX_STR2UINT64 ( correlationid , row [ 1 ] ) ; if ( NULL == ( correlation = ( zbx_dc_correlation_t * ) zbx_hashset_search ( & config -> correlations , & correlationid ) ) ) continue ; ZBX_STR2UINT64 ( operationid , row [ 0 ] ) ; ZBX_STR2UCHAR ( type , row [ 2 ] ) ; operation = ( zbx_dc_corr_operation_t * ) DCfind_id ( & config -> corr_operations , operationid , sizeof ( zbx_dc_corr_operation_t ) , & found ) ; operation -> type = type ; if ( 0 == found ) { operation -> correlationid = correlationid ; zbx_vector_ptr_append ( & correlation -> operations , operation ) ; } } for ( ; SUCCEED == ret ; ret = zbx_dbsync_next ( sync , & rowid , & row , & tag ) ) { if ( NULL == ( operation = ( zbx_dc_corr_operation_t * ) zbx_hashset_search ( & config -> corr_operations , & rowid ) ) ) continue ; if ( NULL != ( correlation = ( zbx_dc_correlation_t * ) zbx_hashset_search ( & config -> correlations , & operation -> correlationid ) ) ) { if ( FAIL != ( index = zbx_vector_ptr_search ( & correlation -> operations , operation , ZBX_DEFAULT_PTR_COMPARE_FUNC ) ) ) { zbx_vector_ptr_remove_noorder ( & correlation -> operations , index ) ; } } zbx_hashset_remove_direct ( & config -> corr_operations , operation ) ; } zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ ) ; }
Function: DCsync_corr_operations                                           
                                                                            
 Purpose: Updates correlation operations configuration cache                
                                                                            
 Parameters: result - [IN] the result of correlation operations database    
                           select                                           
                                                                            
 Comments: The result contains the following fields:                        
           0 - corr_operationid                                             
           1 - correlationid                                                
           2 - type
Function : DCsync_corr_operations Purpose : Updates correlation operations configuration cache Parameters : result - [ IN ] the result of correlation operations database select Comments : The result contains the following fields : 0 - corr_operationid 1 - correlationid 2 - type
/* removed rows will be always added at the end */ /* remove deleted correlation operations */ /* remove deleted actions */ /* remove operation from correlation->conditions vector */