[ZBX-9111] Upgrade zabbix from 2.2.1 to 2.4.1 Created: 2014 Dec 04  Updated: 2017 May 30  Resolved: 2016 Feb 26

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 2.4.1
Fix Version/s: None

Type: Incident report Priority: Blocker
Reporter: Mick Michalski Assignee: Unassigned
Resolution: Won't fix Votes: 1
Labels: upgrade
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File schema.dump.gz    

 Description   

Hello, I try upgrade my zabbix from 2.2.1 to 2.4.1 but I have problem with database upgrade, after update all of components of zabbix when I try login i see this error:

Database error
The frontend does not match Zabbix database. Current database version (mandatory/optional): 2030004/2030004. Required mandatory version: 2040000. Contact your system administrator.

I update with Yum all zabbix components ( zabbix-server, zabbix-web, zabbix-agent, zabbix-java-gateway), after this when I try start zabbix-server I cannot do this. In this link there is log file from zabbix server

2144:20140720:211643.756 Starting Zabbix Server. Zabbix 2.4.2 (revision 50419).
  2144:20140720:211643.759 ****** Enabled features ******
  2144:20140720:211643.759 SNMP monitoring:           YES
  2144:20140720:211643.759 IPMI monitoring:           YES
  2144:20140720:211643.759 WEB monitoring:            YES
  2144:20140720:211643.759 VMware monitoring:         YES
  2144:20140720:211643.760 Jabber notifications:      YES
  2144:20140720:211643.760 Ez Texting notifications:  YES
  2144:20140720:211643.760 ODBC:                      YES
  2144:20140720:211643.760 SSH2 support:              YES
  2144:20140720:211643.760 IPv6 support:              YES
  2144:20140720:211643.760 ******************************
  2144:20140720:211643.760 using configuration file: /etc/zabbix/zabbix_server.conf
  2144:20140720:211643.760 In load_modules()
  2144:20140720:211643.760 End of load_modules():SUCCEED
  2144:20140720:211643.760 In init_database_cache()
  2144:20140720:211643.761 In zbx_mem_required_size() size:0 chunks_num:4 descr:'history cache' param:'HistoryCacheSize'
  2144:20140720:211643.761 End of zbx_mem_required_size() size:543
  2144:20140720:211643.761 In zbx_mem_create() descr:'history cache' param:'HistoryCacheSize' size:8388583
  2144:20140720:211643.761 zbx_shmget() removing existing shm_id:688128
  2144:20140720:211643.761 valid user addresses: [0x7f33e0d87170, 0x7f33e1586fd8] total size: 8388200
  2144:20140720:211643.761 End of zbx_mem_create()
  2144:20140720:211643.762 In zbx_mem_required_size() size:0 chunks_num:1 descr:'history text cache' param:'HistoryTextCacheSize'
  2144:20140720:211643.762 End of zbx_mem_required_size() size:435
  2144:20140720:211643.762 In zbx_mem_create() descr:'history text cache' param:'HistoryTextCacheSize' size:16777216
  2144:20140720:211643.762 zbx_shmget() removing existing shm_id:720897
  2144:20140720:211643.762 valid user addresses: [0x7f33dfd87178, 0x7f33e0d86ff0] total size: 16776824
  2144:20140720:211643.762 End of zbx_mem_create()
  2144:20140720:211643.762 In init_trend_cache()
  2144:20140720:211643.762 In zbx_mem_required_size() size:0 chunks_num:1 descr:'trend cache' param:'TrendCacheSize'
  2144:20140720:211643.763 End of zbx_mem_required_size() size:422
  2144:20140720:211643.763 In zbx_mem_create() descr:'trend cache' param:'TrendCacheSize' size:4194304
  2144:20140720:211643.763 zbx_shmget() removing existing shm_id:753666
  2144:20140720:211643.763 valid user addresses: [0x7f33df987170, 0x7f33dfd86ff0] total size: 4193920
  2144:20140720:211643.763 End of zbx_mem_create()
  2144:20140720:211643.763 End of init_trend_cache()
  2144:20140720:211643.763 End of init_database_cache()
  2144:20140720:211643.764 In init_configuration_cache() size:8388608
  2144:20140720:211643.764 In zbx_mem_create() descr:'configuration cache' param:'CacheSize' size:7130317
  2144:20140720:211643.764 zbx_shmget() removing existing shm_id:786435
  2144:20140720:211643.764 valid user addresses: [0x7f33df2ba170, 0x7f33df986cc0] total size: 7129936
  2144:20140720:211643.764 End of zbx_mem_create()
  2144:20140720:211643.765 In zbx_strpool_create()
  2144:20140720:211643.765 In zbx_mem_create() descr:'string pool' param:'CacheSize' size:1258291
  2144:20140720:211643.765 zbx_shmget() removing existing shm_id:819204
  2144:20140720:211643.765 valid user addresses: [0x7f33df186168, 0x7f33df2b9328] total size: 1257920
  2144:20140720:211643.766 End of zbx_mem_create()
  2144:20140720:211643.766 End of zbx_strpool_create()
  2144:20140720:211643.766 End of init_configuration_cache()
  2144:20140720:211643.766 In init_selfmon_collector()
  2144:20140720:211643.766 init_selfmon_collector() size:7072
  2144:20140720:211643.766 zbx_shmget() removing existing shm_id:851973
  2144:20140720:211643.766 End of init_selfmon_collector() collector:0x7f33df184000
  2144:20140720:211643.766 In zbx_vc_init()
  2144:20140720:211643.766 In zbx_mem_required_size() size:0 chunks_num:1 descr:'value cache size' param:'ValueCacheSize'
  2144:20140720:211643.767 End of zbx_mem_required_size() size:427
  2144:20140720:211643.767 In zbx_mem_create() descr:'value cache size' param:'ValueCacheSize' size:8388608
  2144:20140720:211643.767 zbx_shmget() removing existing shm_id:884742
  2144:20140720:211643.767 valid user addresses: [0x7f33de984170, 0x7f33df183ff0] total size: 8388224
  2144:20140720:211643.767 End of zbx_mem_create()
  2144:20140720:211643.767 End of zbx_vc_init()
  2144:20140720:211643.768 In zbx_db_get_database_type()
  2144:20140720:211643.768 In DBconnect() flag:0
  2144:20140720:211643.773 query [txnlev:0] [set names utf8]
  2144:20140720:211643.773 End of DBconnect():0
  2144:20140720:211643.773 query [txnlev:0] [select userid from users limit 1]
  2144:20140720:211643.774 there is at least 1 record in "users" table
  2144:20140720:211643.774 End of zbx_db_get_database_type():ZBX_DB_SERVER
  2144:20140720:211643.774 In DBcheck_version()
  2144:20140720:211643.774 In DBconnect() flag:0
  2144:20140720:211643.775 query [txnlev:0] [set names utf8]
  2144:20140720:211643.776 End of DBconnect():0
  2144:20140720:211643.776 query [txnlev:0] [show tables like 'dbversion']
  2144:20140720:211643.777 query [txnlev:0] [select mandatory,optional from dbversion]
  2144:20140720:211643.778 current database version (mandatory/optional): 02030006/02030006
  2144:20140720:211643.778 required mandatory version: 02040000
  2144:20140720:211643.778 starting automatic database upgrade
  2144:20140720:211643.778 query [txnlev:1] [begin;]
  2144:20140720:211643.778 query [txnlev:1] [alter table trigger_discovery add constraint c_trigger_discovery_1 foreign key (triggerid) references triggers (triggerid) on delete cascade]
  2144:20140720:211643.852 [Z3005] query failed: [1005] Can't create table 'zabbix.#sql-6e2_bd' (errno: 150) [alter table trigger_discovery add constraint c_trigger_discovery_1 foreign key (triggerid) references triggers (triggerid) on delete cascade]
  2144:20140720:211643.853 query [alter table trigger_discovery add constraint c_trigger_discovery_1 foreign key (triggerid) references triggers (triggerid) on delete cascade] failed, setting transaction as failed
  2144:20140720:211643.853 query [txnlev:1] [rollback;]
  2144:20140720:211643.853 database upgrade failed
  2144:20140720:211643.853 End of DBcheck_version():FAIL

Regards
Mick



 Comments   
Comment by Alexander Vladishev [ 2014 Dec 16 ]

Please attach the database schema dump before an upgrade.

mysqldump -d <database_name> | gzip -c > schema.dump.gz
Comment by Mick Michalski [ 2014 Dec 16 ]

You think about attach my database schema to the ticket ?

Comment by Igors Homjakovs (Inactive) [ 2014 Dec 17 ]

Mick, yes. Please attach it to the ticket so we can investigate what causes the problem. With -d flag no table content will be written, and therefore no personal information will be exposed.

Comment by Mick Michalski [ 2014 Dec 17 ]

Hello, database schema dump there is in attachment.

Regards
Maciej

Comment by Alexander Vladishev [ 2015 Jan 03 ]

I can't find any problems with attached database scheme. Upgrade process also is working fine.
Probably the first upgrade process was terminated incorrectly.

Try to remove 'c_trigger_discovery_1' constraint and run Zabbix server again.

I close the issue as "Won't fix". Feel free to reopen!

Comment by Vadim Nesterov [ 2015 Jan 04 ]

Mick, for convenience switch to LogLevel=3 it will be enough for upgrade.
When zabbix is starting upgrade from 2.2 to 2.4 it runs functions step by step and you will see what it does in src code.
Extract sources to dir then go to zabbix-2.4.3\src\libs\zbxdbupgrade:dbupgrade_2030

In your step you will see that zabbix has droped table trigger_discovery,
then it creates again, then it adds index and then it is trying to add constrait but fails with error.

I had the same error, but I use TokuDB not InnoDB for zabbix database.
Zabbix recreates the table trigger_discover in InnoDB but table triggers uses TokuDB engine, so constrait can be applied to different storage engines.

When zabbix fails during upgrade process, go to your database and say show create table trigger_discovery and engine must be ENGINE=InnoDB.

In my case, when zabbix fails with upgrade I just went to database and ALTER TABLE trigger_discovery ENGINE=TokuDB and then restarts zabbix, and it begins from step on which it fails.

Comment by Oleksii Zagorskyi [ 2016 Feb 26 ]

Was reopened by user one year ago without any comment.
Closing now again.

Generated at Wed Jul 09 12:37:05 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.