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

"Cannot add or update ..." SQL error messages apper in master's node log file ("alerts<->events" related)

    XMLWordPrintable

    Details

    • Type: Incident report
    • Status: Closed
    • Priority: Critical
    • Resolution: Won't fix
    • Affects Version/s: 2.0.8rc1, 2.1.2
    • Fix Version/s: None
    • Component/s: Server (S)

      Description

      Function: process_history_tables
      static void process_history_tables(int master_nodeid, int nodeid)
      {
      const char *__function_name = "process_history_tables";
      const ZBX_TABLE *t;

      zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);

      for (t = tables; NULL != t->table; t++)

      In the "schema.tmpl -> dbschema.c" an "alerts" table located before an "events" table.

      That's why child node tries to sync alerts before events which is wrong.
      For every created alert on a child node we will see one record on master node:
      20615:20130813:081803.918 [Z3005] query failed: [1452] Cannot add or update a child row: a foreign key constraint fails (`zabbix20node1`.`alerts`, CONSTRAINT `c_alerts_2` FOREIGN KEY (`eventid`) REFERENCES `events` (`eventid`) ON DELETE CASCADE) [insert into alerts (alertid,actionid,eventid,userid,clock,mediatypeid,sendto,subject,message,status,retries,error,nextcheck,esc_step,alerttype) values (200000000000155,200200000000003,200200000000158,200200000000001,1376371079,200200000000001,'[email protected]','OK: Too many processes on Zabbix server','Trigger: Too many processes on Zabbix server

      I'm not very sure for below, but still:
      Looks like next such message will reference to next alert(s) records because in a previous sync attempt (10 seconds before) required event(s) has been synced and
      in current sync session previous alerts can be correctly synced.

      Solution: move the "alerts" table definition in "schema.tmpl" below the "events" table.

      See also an example in a comment below.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              zalex_ua Oleksii Zagorskyi
              Votes:
              7 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: