Ad Widget

Collapse

This can't be true!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zabbixazzer
    Junior Member
    • Jul 2006
    • 15

    #1

    This can't be true!!!

    After updating (I've also applied patches) from 1.1beta7 to 1.1 final, I've got strange errors when the web frontend tries to manipulate the DB.

    errors like this:

    SQL error: Duplicate entry '0' for key 1
    Query: insert into profiles (userid,idx,value,valuetype) values (1,'web.latest.groupbyapp','1',0)

    if I use that command inside the console of mysql, it obviusly returns the same error, but if I use it inside the console using also the primary key, it works perfectly.
    For example:

    insert into zabbix.profiles (profileid,userid,idx,value,valuetype) values (11,1,'web.latest.groupbyapp','1',0);

    where "profileid" is the primary key and "11" is its value for this row.
    In this case the error is because of a UNIQUE KEY in the db.

    Obviously I could not insert all the commands by hand, so I did this: dropped the DB, modified the previous databease-dump (I have it backupped) by changing all "UNIQUE KEY" into simple "KEY", and then I re-created zabbix database and imported the modified dump.

    Result: now it works for some tables (and so some frontend webpages don't give errors anymore), but there are still some tables (for example 'alarms' and 'functions') that return that error (and so some frontend webpages still give errors), because the problem is the PRIMARY KEY.
    BUT, if I set all "PRIMARY KEY" to "KEY", when the web frontend puts new rows into database tables, obviously the index number ('alarmid', 'functionid', and so on) isn't increased, screwing up the database.

    What can I do? Why do I have this errors on unique/primary keys? Maybe I have not configured mysql properly?

    Thanks to anybody that will answer.

    PS: I've got Mysql 4.1.20 on CentOS 4.3
  • Zabbixazzer
    Junior Member
    • Jul 2006
    • 15

    #2
    PROBLEM SOLVED!!!

    It was because of a mysqldump bug.
    Before using zabbix db on Mysql4, I used it on Mysql5, then when i switched to Mysql4, I used a command like this:
    Code:
    mysqldump --compatible=mysql40  zabbix  > ./databasedump.sql
    Then after switching to Mysql4, I loaded the dump into a new empty "zabbix" database.

    But it gived me those errors because of this bug:
    MySQL Bugs: #14515: mysqldump omits 'auto_increment' in MySQL4.0 compatibility mode

    In my database dump 'auto_increment' was missing from all PRIMARY KEY columns...

    It seems that the error is fixed in MySQL 5.0.23, I was using 5.0.22...

    Now I restarted from an older dump and all works fine.
    I hope this helps somebody.

    Sorry for bothering.

    Comment

    • just2blue4u
      Senior Member
      • Apr 2006
      • 347

      #3
      Thanks for reporting this!
      Big ZABBIX is watching you!
      (... and my 48 hosts, 4513 items, 1280 triggers via zabbix v1.6 on CentOS 5.0)

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        Interesting story
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        Working...