Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12046

MySQL Database Failure During Id Selection Resets Id To 1

XMLWordPrintable

    • 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.

        1. log.txt
          133 kB
        2. reproduce.patch
          2 kB

            Unassigned Unassigned
            neogan Andrei Gushchin (Inactive)
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: