diff --git a/include/zbxcacheconfig.h b/include/zbxcacheconfig.h index 64d112ae4ce..93562027058 100644 --- a/include/zbxcacheconfig.h +++ b/include/zbxcacheconfig.h @@ -1039,9 +1039,8 @@ void zbx_dc_items_update_nextcheck(zbx_history_recv_item_t *items, zbx_agent_val size_t values_num); int zbx_dc_get_host_interfaces(zbx_uint64_t hostid, zbx_dc_interface2_t **interfaces, int *n); -int zbx_dc_get_nodata_flags(zbx_uint64_t proxyid, int *flags); -int zbx_dc_set_nodata_flags(zbx_uint64_t proxyid, int flags); -int zbx_dc_set_data_expected_from(zbx_uint64_t proxyid, int time); +int zbx_dc_set_proxy_more_data(zbx_uint64_t proxyid); +int zbx_dc_set_proxy_data_expected_from(zbx_uint64_t proxyid, int time); void zbx_dc_update_proxy(zbx_proxy_diff_t *diff); void zbx_dc_get_proxy_lastaccess(zbx_vector_uint64_pair_t *lastaccess); void zbx_dc_proxy_update_nodata(zbx_vector_uint64_pair_t *subscriptions); diff --git a/src/libs/zbxcacheconfig/dbconfig.c b/src/libs/zbxcacheconfig/dbconfig.c index 44db240c99e..c5c42d95776 100644 --- a/src/libs/zbxcacheconfig/dbconfig.c +++ b/src/libs/zbxcacheconfig/dbconfig.c @@ -15272,35 +15272,11 @@ void zbx_dc_proxy_update_nodata(zbx_vector_uint64_pair_t *subscriptions) /****************************************************************************** * * - * Purpose: retrieves nodata_win flags value of a proxy in configuration * - * cache * - * * - ******************************************************************************/ -int zbx_dc_get_nodata_flags(zbx_uint64_t proxyid, int *flags) -{ - ZBX_DC_PROXY *proxy; - int ret = SUCCEED; - - WRLOCK_CACHE; - - if (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &proxyid))) - { - *flags = proxy->nodata_win.flags; - } - else - ret = FAIL; - - UNLOCK_CACHE; - - return ret; -} - -/****************************************************************************** - * * - * Purpose: updates nodata_win flags value of a proxy in configuration cache * + * Purpose: sets ZBX_PROXY_SUPPRESS_PROXY_MORE_DATA in nodata_win flags value * + * of a proxy in configuration cache * * * ******************************************************************************/ -int zbx_dc_set_nodata_flags(zbx_uint64_t proxyid, int flags) +int zbx_dc_set_proxy_more_data(zbx_uint64_t proxyid) { ZBX_DC_PROXY *proxy; int ret = SUCCEED; @@ -15309,7 +15285,7 @@ int zbx_dc_set_nodata_flags(zbx_uint64_t proxyid, int flags) if (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &proxyid))) { - proxy->nodata_win.flags = flags; + proxy->nodata_win.flags |= ZBX_PROXY_SUPPRESS_PROXY_MORE_DATA; } else ret = FAIL; @@ -15325,7 +15301,7 @@ int zbx_dc_set_nodata_flags(zbx_uint64_t proxyid, int flags) * configuration cache * * * ******************************************************************************/ -int zbx_dc_set_data_expected_from(zbx_uint64_t proxyid, int time) +int zbx_dc_set_proxy_data_expected_from(zbx_uint64_t proxyid, int time) { ZBX_DC_PROXY *proxy; int ret = SUCCEED; @@ -15334,6 +15310,7 @@ int zbx_dc_set_data_expected_from(zbx_uint64_t proxyid, int time) if (NULL != (proxy = (ZBX_DC_PROXY *)zbx_hashset_search(&config->proxies, &proxyid))) { + proxy->nodata_win.flags |= ZBX_PROXY_SUPPRESS_PROXY_DATA_EXPECTED; proxy->nodata_win.data_expected_from = time; } else diff --git a/src/zabbix_server/pgmanager/pg_cache.c b/src/zabbix_server/pgmanager/pg_cache.c index 14c105acaa9..9aa8adb5a4e 100644 --- a/src/zabbix_server/pgmanager/pg_cache.c +++ b/src/zabbix_server/pgmanager/pg_cache.c @@ -1147,7 +1147,7 @@ void pg_cache_update_proxy_state(zbx_pg_cache_t *cache, zbx_dc_um_handle_t *um_h for (int i = 0; i < group->proxies.values_num; i++) { - int state = ZBX_PG_PROXY_STATE_UNKNOWN, flags; + int state = ZBX_PG_PROXY_STATE_UNKNOWN; proxy = group->proxies.values[i]; @@ -1175,11 +1175,7 @@ void pg_cache_update_proxy_state(zbx_pg_cache_t *cache, zbx_dc_um_handle_t *um_h if (ZBX_PG_PROXY_STATE_ONLINE != state) { - if (SUCCEED == zbx_dc_get_nodata_flags(proxy->proxyid, &flags)) { - zbx_dc_set_nodata_flags(proxy->proxyid, - flags | ZBX_PROXY_SUPPRESS_PROXY_MORE_DATA); - } - else + if (SUCCEED != zbx_dc_set_proxy_more_data(proxy->proxyid)) { zabbix_log(LOG_LEVEL_WARNING, "cannot find proxy with id '" ZBX_FS_UI64 "'", proxy->proxyid); diff --git a/src/zabbix_server/proxyconfigread/proxyconfigread.c b/src/zabbix_server/proxyconfigread/proxyconfigread.c index f800426da32..1bb334351ee 100644 --- a/src/zabbix_server/proxyconfigread/proxyconfigread.c +++ b/src/zabbix_server/proxyconfigread/proxyconfigread.c @@ -1518,23 +1518,13 @@ int zbx_proxyconfig_get_data(zbx_dc_proxy_t *proxy, const struct zbx_json_parse if (0 != zbx_dc_register_config_session(proxy->proxyid, token, proxy_config_revision, &dc_revision) || 0 == proxy_config_revision) { - int flags; - zabbix_log(LOG_LEVEL_DEBUG, "%s() forcing full proxy configuration sync", __func__); proxy_config_revision = 0; proxy_hostmap_revision = 0; zbx_json_addint64(j, ZBX_PROTO_TAG_FULL_SYNC, 1); - if (SUCCEED == zbx_dc_get_nodata_flags(proxy->proxyid, &flags)) { - zbx_dc_set_nodata_flags(proxy->proxyid, - flags | ZBX_PROXY_SUPPRESS_PROXY_DATA_EXPECTED); - zbx_dc_set_data_expected_from(proxy->proxyid, time(NULL)); - } - else - { - zabbix_log(LOG_LEVEL_WARNING, "cannot find proxy with id '" ZBX_FS_UI64 "'", - proxy->proxyid); - } + if (SUCCEED != zbx_dc_set_proxy_data_expected_from(proxy->proxyid, time(NULL))) + zabbix_log(LOG_LEVEL_WARNING, "cannot find proxy with id '" ZBX_FS_UI64 "'", proxy->proxyid); } else {