-
Problem report
-
Resolution: Won't fix
-
Trivial
-
None
-
None
-
None
-
None
Problem described also in Zabbix forum - https://www.zabbix.com/forum/zabbix-help/450318-error-with-duplicate-values-on-tables-history_uint-columns-itemid-clock-ns .
Steps to reproduce:
- Perform upgrade on Zabbix server from 5.0 LTS to 6.0 LTS. Database engine is PostgreSQL.
- Execute SQL script "history_pk_prepare.sql".
- Reinsert data from table "history_uint_old" to table "history_uint", who has new multi column primary key "history_uint_pkey".
- Problem also occurs when new data gets added from Zabbix Agent active item.
- To find duplicate values:
SELECT itemid, clock, ns, COUNT(*) FROM history_uint GROUP BY itemid, clock, ns HAVING COUNT(*) > 1 ORDER BY COUNT desc;
- Item who receives lot of data from host. That generates duplicate values:
logrt[C:\app\file.log,"Query speed:"]
Item should receive from Zabbix Agent Active at least 100 values per second. So CPU can process at least 2 item values on same one nanosecond.
Possibly item "log" also could reproduce issue.
Result:
INSERT INTO history_uint SELECT * FROM history_uint_old; ERROR: duplicate key value violates unique constraint "history_uint_pkey" DETAIL: Key (itemid, clock, ns)=(1442, 1657527245, 687061700) already exists.
Expected:
Successfully import all data from tables "history*_old" without indexes into newly created tables "history*" with indexes.
Successfully adding new data from Zabbix Agent Active items to table "history_uint", also items whose data gets processed by CPU on same nano second.