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

Database upgrade failed from 03030184 to 04000000

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Commercial support required
    • Icon: Critical Critical
    • None
    • 4.0.0
    • Server (S)
    • Ubuntu 18 LTS, PostgreSQL 10, zabbix-release (1:4.0-2+bionic)

      This is what happened when I tried to upgrade to 4.0 LTS:

      3701:20181009:125519.908 completed 59% of database upgrade
      3701:20181009:125519.908 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR:  relation "items_7" already exists [create index items_7 on items (master_itemid)]
      3701:20181009:125519.909 database upgrade failed
      3908:20181009:125529.975 Starting Zabbix Server. Zabbix 4.0.0 (revision 85308).
        3908:20181009:125529.975 ****** Enabled features ******
        3908:20181009:125529.975 SNMP monitoring:           YES
        3908:20181009:125529.975 IPMI monitoring:           YES
        3908:20181009:125529.975 Web monitoring:            YES
        3908:20181009:125529.975 VMware monitoring:         YES
        3908:20181009:125529.975 SMTP authentication:       YES
        3908:20181009:125529.975 Jabber notifications:      YES
        3908:20181009:125529.975 Ez Texting notifications:  YES
        3908:20181009:125529.975 ODBC:                      YES
        3908:20181009:125529.975 SSH2 support:              YES
        3908:20181009:125529.975 IPv6 support:              YES
        3908:20181009:125529.975 TLS support:               YES
        3908:20181009:125529.975 ******************************
        3908:20181009:125529.975 using configuration file: /etc/zabbix/zabbix_server.conf
      3908:20181009:125530.017 current database version (mandatory/optional): 03030184/03030184
      3908:20181009:125530.017 required mandatory version: 04000000
      3908:20181009:125530.017 starting automatic database upgrade
      3908:20181009:125530.018 [Z3005] query failed: [0] PGRES_FATAL_ERROR:ERROR:  relation "items_7" already exists [create index items_7 on items (master_itemid)]
      3908:20181009:125530.018 database upgrade failed
      3934:20181009:125540.223 Starting Zabbix Server. Zabbix 4.0.0 (revision 85308).
      ...

      It is stuck now trying to complete upgrade in a loop.

      The items table that is referenced in error message has the following structure:

                                              Table "public.items"
      
              Column         |          Type           | Collation | Nullable |          Default          
      
      -----------------------+-------------------------+-----------+----------+---------------------------
      
      itemid                | bigint                  |           | not null |
      
      type                  | integer                 |           | not null | 0
      
      snmp_community        | character varying(64)   |           | not null | ''::character varying
      
      snmp_oid              | character varying(512)  |           | not null | ''::character varying
      
      hostid                | bigint                  |           | not null |
      
      name                  | character varying(255)  |           | not null | ''::character varying
      
      key_                  | character varying(255)  |           | not null | ''::character varying
      
      delay                 | character varying(1024) |           | not null | '0'::character varying
      
      history               | character varying(255)  |           | not null | '90d'::character varying
      
      trends                | character varying(255)  |           | not null | '365d'::character varying
      
      status                | integer                 |           | not null | 0
      
      value_type            | integer                 |           | not null | 0
      
      trapper_hosts         | character varying(255)  |           | not null | ''::character varying
      
      units                 | character varying(255)  |           | not null | ''::character varying
      
      snmpv3_securityname   | character varying(64)   |           | not null | ''::character varying
      
      snmpv3_securitylevel  | integer                 |           | not null | 0
      
      snmpv3_authpassphrase | character varying(64)   |           | not null | ''::character varying
      
      snmpv3_privpassphrase | character varying(64)   |           | not null | ''::character varying
      
      formula               | character varying(255)  |           | not null | ''::character varying
      
      error                 | character varying(2048) |           | not null | ''::character varying
      
      lastlogsize           | numeric(20,0)           |           | not null | (0)::numeric
      
      logtimefmt            | character varying(64)   |           | not null | ''::character varying
      
      templateid            | bigint                  |           |          |
      
      valuemapid            | bigint                  |           |          |
      
      params                | text                    |           | not null | ''::text
      
      ipmi_sensor           | character varying(128)  |           | not null | ''::character varying
      
      authtype              | integer                 |           | not null | 0
      
      username              | character varying(64)   |           | not null | ''::character varying
      
      password              | character varying(64)   |           | not null | ''::character varying
      
      publickey             | character varying(64)   |           | not null | ''::character varying
      
      privatekey            | character varying(64)   |           | not null | ''::character varying
      
      mtime                 | integer                 |           | not null | 0
      
      flags                 | integer                 |           | not null | 0
      
      interfaceid           | bigint                  |           |          |
      
      port                  | character varying(64)   |           | not null | ''::character varying
      
      description           | text                    |           | not null | ''::text
      
      inventory_link        | integer                 |           | not null | 0
      
      lifetime              | character varying(255)  |           | not null | '30d'::character varying
      
      snmpv3_authprotocol   | integer                 |           | not null | 0
      
      snmpv3_privprotocol   | integer                 |           | not null | 0
      
      state                 | integer                 |           | not null | 0
      
      snmpv3_contextname    | character varying(255)  |           | not null | ''::character varying
      
      evaltype              | integer                 |           | not null | 0
      
      jmx_endpoint          | character varying(255)  |           | not null | ''::character varying
      
      master_itemid         | bigint                  |           |          |
      
      Indexes:
      
          "items_pkey" PRIMARY KEY, btree (itemid)
      
          "items_1" UNIQUE, btree (hostid, key_)
      
          "items_3" btree (status)
      
          "items_4" btree (templateid)
      
          "items_5" btree (valuemapid)
      
          "items_6" btree (interfaceid)
      
          "items_7" btree (value_type)
      
          "items_8" btree (name)
      Foreign-key constraints:
      
          "c_items_1" FOREIGN KEY (hostid) REFERENCES hosts(hostid) ON DELETE CASCADE
      
          "c_items_2" FOREIGN KEY (templateid) REFERENCES items(itemid) ON DELETE CASCADE
      
          "c_items_3" FOREIGN KEY (valuemapid) REFERENCES valuemaps(valuemapid)
      
          "c_items_4" FOREIGN KEY (interfaceid) REFERENCES interface(interfaceid)
      
      Referenced by:
      
          TABLE "application_prototype" CONSTRAINT "c_application_prototype_1" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "functions" CONSTRAINT "c_functions_1" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "graphs" CONSTRAINT "c_graphs_2" FOREIGN KEY (ymin_itemid) REFERENCES items(itemid)
      
          TABLE "graphs" CONSTRAINT "c_graphs_3" FOREIGN KEY (ymax_itemid) REFERENCES items(itemid)
      
          TABLE "graphs_items" CONSTRAINT "c_graphs_items_2" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "host_discovery" CONSTRAINT "c_host_discovery_3" FOREIGN KEY (parent_itemid) REFERENCES items(itemid)
      
          TABLE "httpstepitem" CONSTRAINT "c_httpstepitem_2" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "httptestitem" CONSTRAINT "c_httptestitem_2" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "item_application_prototype" CONSTRAINT "c_item_application_prototype_2" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "item_condition" CONSTRAINT "c_item_condition_1" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "item_discovery" CONSTRAINT "c_item_discovery_1" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "item_discovery" CONSTRAINT "c_item_discovery_2" FOREIGN KEY (parent_itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "item_preproc" CONSTRAINT "c_item_preproc_1" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "items" CONSTRAINT "c_items_2" FOREIGN KEY (templateid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "items_applications" CONSTRAINT "c_items_applications_2" FOREIGN KEY (itemid) REFERENCES items(itemid) ON DELETE CASCADE
      
          TABLE "widget_field" CONSTRAINT "c_widget_field_4" FOREIGN KEY (value_itemid) REFERENCES items(itemid) ON DELETE CASCADE

            Unassigned Unassigned
            iliv Ivan Lezhnjov IV
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: