-
Problem report
-
Resolution: Fixed
-
Blocker
-
4.2.3
-
None
-
Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
-
0.5
Zabbix proxy log shows following error
[Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix_proxy`.`items`, CONSTRAINT `c_items_5` FOREIGN KEY (`master_itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE)
Proxy log shows, that Zabbix tries to create dependent item entry into database before master item is created, because master item has higher itemid (29154 is master itemid):
MariaDB [zabbix_proxy]> insert into items (itemid,type,snmp_community,snmp_oid,hostid,key_,delay,status,value_type,trapper_hosts,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,lastlogsize,logtimefmt,params,ipmi_sensor,authtype,username,password,publickey,privatekey,mtime,flags,interfaceid,port,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,jmx_endpoint,master_itemid,timeout,url,query_fields,posts,status_codes,follow_redirects,post_type,http_proxy,headers,retrieve_mode,request_method,output_format,ssl_cert_file,ssl_key_file,ssl_key_password,verify_peer,verify_host,allow_traps,description) values (29100,18,'','',10272,'ZabbixProxyMySQL.Com_select','0',0,3,'','',0,'','',0,'','','',0,'','','','',0,0,null,'',0,0,'','',29154,'3s','','','','200',1,0,'','',0,1,0,'','','',0,0,0,''), (29154,7,'','',10272,'level3.agent.control[proxy_mysql]','30s',0,2,'','',0,'','',0,'','','',0,'','','','',0,0,null,'',0,0,'','',null,'3s','','','','200',1,0,'','',0,1,0,'','','',0,0,0,''); ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`zabbix_proxy`.`items`, CONSTRAINT `c_items_5` FOREIGN KEY (`master_itemid`) REFERENCES `items` (`itemid`) ON DELETE CASCADE)
if the order is changed, query succeeds:
MariaDB [zabbix_proxy]> insert into items (itemid,type,snmp_community,snmp_oid,hostid,key_,delay,status,value_type,trapper_hosts,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,lastlogsize,logtimefmt,params,ipmi_sensor,authtype,username,password,publickey,privatekey,mtime,flags,interfaceid,port,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,jmx_endpoint,master_itemid,timeout,url,query_fields,posts,status_codes,follow_redirects,post_type,http_proxy,headers,retrieve_mode,request_method,output_format,ssl_cert_file,ssl_key_file,ssl_key_password,verify_peer,verify_host,allow_traps,description) values (29154,7,'','',10272,'level3.agent.control[proxy_mysql]','30s',0,2,'','',0,'','',0,'','','',0,'','','','',0,0,null,'',0,0,'','',null,'3s','','','','200',1,0,'','',0,1,0,'','','',0,0,0,''), (29100,18,'','',10272,'ZabbixProxyMySQL.Com_select','0',0,3,'','',0,'','',0,'','','',0,'','','','',0,0,null,'',0,0,'','',29154,'3s','','','','200',1,0,'','',0,1,0,'','','',0,0,0,''); Query OK, 2 rows affected (0.00 sec) Records: 2 Duplicates: 0 Warnings: 0
Proxy configuration update is completely broken by this.