[ZBX-4693] mysql database upgrade scripts cause: Cannot add or update a child row: a foreign key constraint fails... Created: 2012 Feb 24 Updated: 2017 May 30 Resolved: 2012 Feb 25 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Installation (I) |
Affects Version/s: | 1.9.9 (beta) |
Fix Version/s: | 2.0.0rc1 |
Type: | Incident report | Priority: | Major |
Reporter: | Robert Jerzak | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: | patch.sql |
Description |
I am not sure if this kind of issue fits bug tracker. I am upgrading mysql database from zabbix 1.8.10 to 1.9.9 with script patch.sql. My mysql database is size about 50GB. During an upgrade I get error: My second try: Temporary directory for mysql is about 65G free. Any sugestion how can I workaround this issue and convert all database? |
Comments |
Comment by dimir [ 2012 Feb 24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Could you attach the patch.sql that was used? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by Robert Jerzak [ 2012 Feb 24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This is script from zabbix-1.9.9. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by dimir [ 2012 Feb 24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Oh, right. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by dimir [ 2012 Feb 24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Please give me the output of these 2 sql queries: select maintenanceid from hosts where maintenanceid is not null; I think some host is referencing (is in maintenance status of) some non-existing maintenance. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by Robert Jerzak [ 2012 Feb 24 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> select maintenanceid from maintenances;
---------------
--------------- > select maintenanceid from hosts where maintenanceid is not null;
---------------
[…]
[…]
[…]
--------------- There is a lot of (~1600) rows with 'maintenanceid' = 0. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by dimir [ 2012 Feb 25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Please run next command before running an upgrade script: UPDATE hosts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by dimir [ 2012 Feb 25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-4693 . | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by Robert Jerzak [ 2012 Feb 27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It seems that your solution helped - script passes that section. I don't know if script has completed without error because it is still running - for about 31h (50 GB database):
But I dont think you can help me in this matter? <dimir> Could be some DB lock issue. It shouldn't be running for that long. You mean it's stuck on that query? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by Alexander Vladishev [ 2012 Feb 27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(1) please review my changes in r25619. <dimir> Perfect, tested with every DB! CLOSED | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by dimir [ 2012 Feb 27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fixed in pre-1.9.10 r25648. During db upgrade invalid maintenance references are set to NULL in hosts table. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by Robert Jerzak [ 2012 Feb 27 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> <dimir> Could be some DB lock issue. It shouldn't be running for that long. You mean it's stuck on that query? We can say that it is stuck, this query is running for about 37h. One processor core is utilized in 100% by mysqld process with this query, IO utilization is 0 percent - looks like there is no disk involved in this operation. Do you have any suggestion? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by richlv [ 2012 Mar 02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
so... is the query still running ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment by Robert Jerzak [ 2012 Mar 03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I have killed the process after 57h of running. I found a way to speed up an upgrade - "truncate events" and upgrade lasted almost 4h. In the events table I have almost 46000000 records - it is very time consuming. Events are less important for me than history and trends. |