-
Problem report
-
Resolution: Fixed
-
Trivial
-
None
-
Sprint 5, Sprint 6, Sprint 7, Sprint 8, Sprint 9
-
2
Symptoms in server log file:
- getting max ID for a specified table from database fails, for example:
29889:20170418:160502.612 [Z3005] query failed: [2006] MySQL server has gone away [select max(eventid) from events where eventid between 0 and 9223372036854775807]
- after max ID counting has been started from 1 it is impossible to insert new records in the specified table, for example:
18005:20170524:153922.246 [Z3005] query failed: [1062] Duplicate entry '2' for key 'PRIMARY' [insert into events (eventid,source,object,objectid,clock,ns,value) values (2,3,0,13502,1495629513,228672060,1);
When function DCget_nextid() reads the max ID number from a database for a specified table then some database errors can cause resetting ID number to 1.
In DCget_nextid() the DBselect()'s result is passed without checking into DBfetch(). If the latter returns NULL, a wrong conclusion is made that the max ID for the specified table does not yet exist and counting starts from the smallest ID. DBfetch() can return NULL in case of various errors while the requested record does exist in database.
- is duplicated by
-
ZBX-10231 EventID rolled over in DB for no reason
- Closed