[ZBX-3085] Zabbix proxy stop to send data to Zabbix server in particular situation. Created: 2010 Oct 07  Updated: 2017 May 30  Resolved: 2010 Nov 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Proxy (P)
Affects Version/s: 1.6.9, 1.8.3
Fix Version/s: 1.8.4

Type: Incident report Priority: Major
Reporter: Takanori Suzuki Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Zabbix Server 1.8.3 with mysql: Linux i386
Zabbix Proxy 1.8.3 with mysql: Linux i386


Attachments: File zbx18-r14887-fix_auto_increment.patch     File zbx183-fix_auto_increment.patch    
Issue Links:
Duplicate

 Description   

If using Zabbix with mysql innodb, Zabbix proxy stop to send data to Zabbix server in particular situation.

In particular situation, "id" in "proxy_history" table is reset to 1, though "ids" table has incremented number.
So, Zabbix proxy stop to send data untill "id" in "proxy_history" become bigger than the number in "ids" table.
The reason of why it is reset to 1 is following.

Why it occurs:
"id" in "proxy_history" table has "auto_increment" attribute.
Usually, the table keeps the incremented number.
But if there is no data in the table and if you restart the mysql process, it is reset to 1.
reference)
"If the table is empty, InnoDB uses the value 1."
http://dev.mysql.com/doc/refman/5.0/en/innodb-auto-increment-handling.html

How to reproduce:
(1.) stop zabbix server process and zabbix proxy process
(2.) leave them ProxyOfflineBuffer hours. (default is 1 hour) Or change system time by "date" command.
(3.) start zabbix proxy process (housekeeper delete all data in "proxy_history" table)
(4.) stop zabbix proxy process
(5.) restart zabbix proxy's mysql process (mysql losts the incremented number of "id" in "proxy_history" table)
(6.) start zabbix server process and zabbix proxy process

Then, "id" in "proxy_history" table is reset to 1 and you cannot get data from proxy.

How to fix:
idea1: On starting zabbix proxy, if "proxy_history" table has no data, get incremented id from "ids" table and set AUTO_INCREMENT by "ALTER TABLE"
example:
"ALTER TABLE proxy_history AUTO_INCREMENT = 100"
http://mysql-tips.blogspot.com/2005/04/alter-table-autoincrement-examples.html
idea2: Avoid to delete all data in housekeeper process.

I think idea1 is better.



 Comments   
Comment by Takanori Suzuki [ 2010 Oct 07 ]

I'll write idea1 patch in this weekend.

Comment by Takanori Suzuki [ 2010 Oct 15 ]

Hi.
I made idea1 patchs for zabbix-1.8.3 and 1.8 branch(r14887).
I checked it works well.

"zbx183-fix_auto_increment.patch" is for 1.8.3.
"zbx18-r14887-fix_auto_increment.patch" is for 1.8 branch(r14887).

Comment by Takanori Suzuki [ 2010 Oct 15 ]

As far as I read the code in 1.8 branch(r14887), same problem still exists.
So, I attached the patch for 1.8 branch(r14887).

Comment by Aleksandrs Saveljevs [ 2010 Nov 16 ]

Other database engines do not seem to have this problem.

For instance, SQLite (http://www.sqlite.org/faq.html#q1): "To create keys that are unique over the lifetime of the table, add the AUTOINCREMENT keyword to the INTEGER PRIMARY KEY declaration. Then the key chosen will be one more than than the largest key that has ever existed in that table.". This is exactly what we do.

For other database engines, testing seems to show this problem does not exist.

Comment by Aleksandrs Saveljevs [ 2010 Nov 16 ]

Applied the patch in the development branch svn://svn.zabbix.com/branches/dev/ZBX-3085.

Comment by Alexander Vladishev [ 2010 Nov 17 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-3085

Comment by Alexander Vladishev [ 2010 Nov 17 ]

Fixed in version pre1.8.4, r15570.

Comment by Aleksandrs Saveljevs [ 2010 Nov 17 ]

The patch has a very interesting idea (thanks!), but unfortunately it does not cope with the case when MySQL server is restarted while Zabbix proxy is running. So we decided instead that the proxy housekeeper should always keep at least one row in the history tables.

Comment by Takanori Suzuki [ 2010 Nov 17 ]

I see. I understand the if-case.
I couldn't find the case then.
Thank you Saveljevs!!

Generated at Wed Jun 03 19:47:23 EEST 2026 using Jira 10.3.18#10030018-sha1:5642e4ad348b6c2a83ebdba689d04763a2393cab.