diff options
author | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-11-03 19:35:16 +0300 |
---|---|---|
committer | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-11-03 19:35:16 +0300 |
commit | cb16097d469cbf3e58fc5341311414b8eb5817ff (patch) | |
tree | 04e97d04388a67d218317ff1778c900600a96659 | |
parent | ff814d2a9b49f5bff938b0bb474be2d8f016982a (diff) |
........S. [ZBX-21825] improved history syncer performance
-rw-r--r-- | src/libs/zbxdbhigh/proxy.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libs/zbxdbhigh/proxy.c b/src/libs/zbxdbhigh/proxy.c index de160ce47e1..786fd93b4ca 100644 --- a/src/libs/zbxdbhigh/proxy.c +++ b/src/libs/zbxdbhigh/proxy.c @@ -3466,10 +3466,9 @@ static int process_history_data_by_itemids(zbx_socket_t *sock, zbx_client_item_v zbx_proxy_suppress_t *nodata_win, char **info, unsigned int mode) { const char *pnext = NULL; - int ret = SUCCEED, processed_num = 0, total_num = 0, values_num, read_num, i, - errcodes[ZBX_HISTORY_VALUES_MAX]; + int ret = SUCCEED, processed_num = 0, total_num = 0, values_num, read_num, i, *errcodes; double sec; - DC_ITEM items[ZBX_HISTORY_VALUES_MAX] = {0}; + DC_ITEM *items; char *error = NULL; zbx_uint64_t itemids[ZBX_HISTORY_VALUES_MAX], last_valueid = 0; zbx_agent_value_t values[ZBX_HISTORY_VALUES_MAX]; @@ -3477,6 +3476,9 @@ static int process_history_data_by_itemids(zbx_socket_t *sock, zbx_client_item_v zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__); + items = (DC_ITEM *)zbx_calloc(NULL, 1, sizeof(DC_ITEM) * ZBX_HISTORY_VALUES_MAX); + errcodes = (int *)zbx_malloc(NULL, sizeof(int) * ZBX_HISTORY_VALUES_MAX); + sec = zbx_time(); while (SUCCEED == parse_history_data_by_itemids(jp_data, &pnext, values, itemids, &values_num, &read_num, @@ -3534,6 +3536,9 @@ static int process_history_data_by_itemids(zbx_socket_t *sock, zbx_client_item_v session->last_valueid = last_valueid; } + zbx_free(errcodes); + zbx_free(items); + if (NULL == error) { ret = SUCCEED; |