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

query failed due to primary key constraint: [1062] Duplicate entry '183334929' for key 'PRIMARY'

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Won't fix
    • Icon: Trivial Trivial
    • None
    • 6.0.16
    • Server (S)
    • None
    • Debian 11
      Zabbix 6.2.7
      MariaDB 10.8.7

      Version is 6.2.7 was we haven't migrated to 6.4, yet.

      Steps to reproduce:

      1. In early January, while still being on Zabbix 6.0, we dropped our history and applied the primary keys DB patch:
      mysql -u root -p zabbix < /usr/share/zabbix-sql-scripts/mysql/history_pk_prepare.sql

      This worked without any issues (we know of)

      1. On 10.02.2023 we upgraded to 6.2.7 without any issues (we know of)
      2. On 07.04.2023 we had a planned downtime in our datacenter. The Zabbix VM and DB were powered off gracefully and powered on a few hours later.
      3. Issues started to appear after the downtime.

      Result:

      Since then, many, but not all trigger events, don't close anymore. Our event problems list grows bigger every day.

      Se the following examples of services that are of type 0 running, but the problem persists:

      In the Zabbix Server log, we see the following error a lot, and I suspect a connection:

        1261:20230412:105626.256 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183364615' for key 'PRIMARY'
        1260:20230412:105626.258 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183455685' for key 'PRIMARY'
        1261:20230412:105630.278 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183491625' for key 'PRIMARY'
        1259:20230412:105630.281 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183909559' for key 'PRIMARY'
        1260:20230412:105631.287 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183458684' for key 'PRIMARY'
        1258:20230412:105631.289 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183618546' for key 'PRIMARY'
        1260:20230412:105634.304 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183493894' for key 'PRIMARY'
        1261:20230412:105635.306 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183386042' for key 'PRIMARY'
        1260:20230412:105637.316 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183780765' for key 'PRIMARY'
        1258:20230412:105637.325 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183722694' for key 'PRIMARY'
        1259:20230412:105639.320 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183479570' for key 'PRIMARY'
        1259:20230412:105639.322 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183491625' for key 'PRIMARY'
        1261:20230412:105640.332 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183707372' for key 'PRIMARY'
        1258:20230412:105642.344 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183465442' for key 'PRIMARY'
        1260:20230412:105644.351 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183894241' for key 'PRIMARY'

      Expected:

      Problem Events should close as normal, when the condition is met.

      Notes:

      The very first time the issue was in the logs was here, one day before the planned datacenter downtime:

      14234:20230406:141103.642 [Z3008] query failed due to primary key constraint: [1062] Duplicate entry '183334929' for key 'PRIMARY'

      Since then, this error has been logged thousands of times.

      I know this might be much to ask, but the error message is not helpful at all. Could you please give us any hint, what to search for in the database, so we can start troubleshooting that issue?

            elina.kuzyutkina Elina Kuzyutkina (Inactive)
            starko Marco Hofmann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: