[ZBX-5469] foreign key constraint fails Created: 2012 Aug 20 Updated: 2017 May 30 Resolved: 2012 Aug 22 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Proxy (P) |
Affects Version/s: | 2.0.2 |
Fix Version/s: | 2.0.3rc1, 2.1.0 |
Type: | Incident report | Priority: | Major |
Reporter: | Stephan A. Klein | Assignee: | dimir |
Resolution: | Fixed | Votes: | 0 |
Labels: | database, dm | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Debian Squeeze 64bit, MySQL 5.1.63-0+squeeze1 (Debian), Multi-Node Setup, but only one node active |
Attachments: | Zabbix Proxy-Log.rtf zabbix-2.0-ZBX-5469.patch zabbix_proxy.log |
Description |
Webchecks which should run on the zabbix-proxy are not synchronised from the master zabbix server. The proxy-log states therse errors: 12587:20120820:162144.527 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix_proxy`.`httpstep`, CONSTRAINT `c_httpstep_1` FOREIGN KEY (`httptestid`) REFERENCES `httptest` (`httptestid` ... and a few more for additional sites. 12587:20120820:162145.673 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix_proxy`.`httpstepitem`, CONSTRAINT `c_httpstepitem_1` FOREIGN KEY (`httpstepid`) REFERENCES `httpstep` (`htt ... and a few more. New checks added on the server are not populated to the proxy so the newly added webchecks stay in an unknown state. I've tried to delete the proxy database, rebuild a new databse with schema.sql (nothing else) from 2.0.2 package, but the error remains. If you need further information, please contact me. |
Comments |
Comment by dimir [ 2012 Aug 21 ] |
Could you please attach the whole proxy log? |
Comment by Stephan A. Klein [ 2012 Aug 21 ] |
Please find attached the proxy-log after a proxy restart. |
Comment by dimir [ 2012 Aug 22 ] |
Thanks, but this file seems to be modified by some rtf editor or something. Could you instead send the real unmodified log? |
Comment by dimir [ 2012 Aug 22 ] |
Seems that the issue is when one host contains 2 applications and this information is sent to proxy. The unique applications index (hostid,name) fails because we do not send the host name (which ends up empty). |
Comment by Stephan A. Klein [ 2012 Aug 22 ] |
OK, here is the plain vanilla log, sorry for rtf'ing it. Could you please clarify how to avoid the error condition? Would it be sufficient to go back to only one application for the webchecks run on the proxy? |
Comment by Stephan A. Klein [ 2012 Aug 22 ] |
Just deleted the second application, the error seems to be gone |
Comment by dimir [ 2012 Aug 22 ] |
Right, I could reproduce it easily with 2 applications and 2 web monitoring items. This will be fixed by adding host "name" to the list of things to send when synchronizing "applications". |
Comment by dimir [ 2012 Aug 22 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-5469 . |
Comment by dimir [ 2012 Aug 22 ] |
If you would like to try the fix you could take development branch from SVN or apply the patch to your sources tree and then you should be able to use different applications with one host. In order to test your own source tree with the patch:
Only the server needs to be rebuilt. Then clear proxy database and restart server and proxy. |
Comment by Alexander Vladishev [ 2012 Aug 23 ] |
Successfully tested! |
Comment by dimir [ 2012 Aug 23 ] |
Fixed in pre-2.0.3 r29762, pre-2.1.0 r29763. The fix enables possibility to use more than one application in proxy web monitoring for single host. Details: Table "applications" has foreign key "hostid"-"name". When sending 12345- which foreign key constraint would not allow to save. The fix is to enable sending application name to proxy by adding Before this fix:
After this fix:
|