Uploaded image for project: 'OpenNMS'
  1. OpenNMS
  2. NMS-8754

DB installer blows up with unique constraint violation on monitoringlocations_pkey

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 19.0.0
    • Fix Version/s: 19.0.1
    • Component/s: Installation
    • Security Level: Default (Default Security Scheme)
    • Labels:
      None
    • Environment:
      Not going to lie, this happened on a Frankensystem, so it may be nothing. I want to capture it before blowing away the DB and moving along in case it turns out to be something. Build looks to have been done on 02 Sep 2016.

      Description

      ==============================================================================
      OpenNMS Installer
      ==============================================================================
      
      Configures PostgreSQL tables, users, and other miscellaneous settings.
      
      DEBUG: Platform is IPv6 ready: true
      - searching for libjicmp.so:
        - trying to load /libjicmp.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/libjicmp.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/linux64/libjicmp.so: NO
        - trying to load /usr/java/packages/lib/amd64/libjicmp.so: NO
        - trying to load /usr/lib64/libjicmp.so: OK
      - searching for libjicmp6.so:
        - trying to load /libjicmp6.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/libjicmp6.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/linux64/libjicmp6.so: NO
        - trying to load /usr/java/packages/lib/amd64/libjicmp6.so: NO
        - trying to load /usr/lib64/libjicmp6.so: OK
      - searching for libjrrd.so:
        - trying to load /libjrrd.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/libjrrd.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/linux64/libjrrd.so: NO
        - trying to load /usr/java/packages/lib/amd64/libjrrd.so: NO
        - trying to load /usr/lib64/libjrrd.so: OK
      - searching for libjrrd2.so:
        - trying to load /libjrrd2.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/libjrrd2.so: NO
        - trying to load /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/linux64/libjrrd2.so: NO
        - trying to load /usr/java/packages/lib/amd64/libjrrd2.so: NO
        - trying to load /usr/lib64/libjrrd2.so: NO
        - trying to load /lib64/libjrrd2.so: NO
        - trying to load /lib/libjrrd2.so: NO
        - trying to load /usr/lib/libjrrd2.so: NO
        - trying to load /usr/lib/jni/libjrrd2.so: NO
        - trying to load /usr/lib/libjrrd2.so: NO
        - trying to load /usr/local/lib/libjrrd2.so: NO
        - trying to load /opt/NMSjicmp/lib/32/libjrrd2.so: NO
        - trying to load /opt/NMSjicmp/lib/64/libjrrd2.so: NO
        - trying to load /opt/NMSjicmp6/lib/32/libjrrd2.so: NO
        - trying to load /opt/NMSjicmp6/lib/64/libjrrd2.so: NO
      - Failed to load the optional jrrd2 library.
        - This error is not fatal, since jrrd2 is only required for optional features.
        - For more information, see http://www.opennms.org/index.php/jrrd2
      - using SQL directory... /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/etc
      - using create.sql... /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/etc/create.sql
      10:22:02.730 [Main] INFO  org.opennms.core.schema.Migrator - validating database version
      * using 'postgres' as the PostgreSQL user for OpenNMS
      * using 'opennms' as the PostgreSQL database name for OpenNMS
      10:22:02.822 [Main] INFO  org.opennms.core.schema.Migrator - validating database version
      10:22:02.837 [Main] INFO  org.opennms.core.schema.Migrator - adding PL/PgSQL support to the database, if necessary
      10:22:02.843 [Main] INFO  org.opennms.core.schema.Migrator - PL/PgSQL call handler exists
      10:22:02.844 [Main] INFO  org.opennms.core.schema.Migrator - PL/PgSQL language exists
      - checking if database "opennms" is unicode... ALREADY UNICODE
      - Creating imports directory (/home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/etc/imports... OK
      - Checking for old import files in /home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/etc... DONE
      - Running migration for changelog: URL [jar:file:/home/jeffg/git/horizon-work/target/opennms-19.0.0-SNAPSHOT/lib/org.opennms.core.schema-19.0.0-SNAPSHOT-liquibase.jar!/changelog.xml]
      INFO 9/23/16 10:22 AM:liquibase: Successfully acquired change log lock
      INFO 9/23/16 10:22 AM:liquibase: Reading from databasechangelog
      INFO 9/23/16 10:22 AM:liquibase: Reading from databasechangelog
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-add-scanreports-tables::ranger ran successfully in 112ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-add-scanreportlogs-table::ranger ran successfully in 36ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-bsm-initialize::bsm-team ran successfully in 126ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-bsm-highest-severity-above::mvrueden ran successfully in 5ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-bsm-most-critical-to-highest-severity::fooker ran successfully in 1ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-bsm-friendlynames::cpape ran successfully in 7ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-bsm-map-reduce-cleanup::mvrueden ran successfully in 1ms
      INFO 9/23/16 10:22 AM:liquibase: ChangeSet 18.0.0/changelog.xml::18.0.0-bsm-unique-names::fooker ran successfully in 30ms
      SEVERE 9/23/16 10:22 AM:liquibase: Change Set 19.0.0/changelog.xml::19.0.0-insert-default-monitoringlocation::seth failed.  Error: Error executing SQL INSERT INTO monitoringlocations (id, monitoringarea) VALUES ('localhost', 'localhost'): ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.
      liquibase.exception.DatabaseException: Error executing SQL INSERT INTO monitoringlocations (id, monitoringarea) VALUES ('localhost', 'localhost'): ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.
      	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
      	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
      	at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1091)
      	at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1075)
      	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
      	at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
      	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
      	at liquibase.Liquibase.update(Liquibase.java:114)
      	at org.opennms.core.schema.Migrator.migrate(Migrator.java:477)
      	at org.opennms.install.Installer.install(Installer.java:273)
      	at org.opennms.install.Installer.main(Installer.java:989)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.opennms.bootstrap.Bootstrap$4.run(Bootstrap.java:460)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
      	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:321)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313)
      	at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
      	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
      	... 16 more
      INFO 9/23/16 10:22 AM:liquibase: Successfully released change log lock
      java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.opennms.bootstrap.Bootstrap$4.run(Bootstrap.java:460)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: org.opennms.core.schema.MigrationException: unable to migrate the database
      	at org.opennms.core.schema.Migrator.migrate(Migrator.java:479)
      	at org.opennms.install.Installer.install(Installer.java:273)
      	at org.opennms.install.Installer.main(Installer.java:989)
      	... 6 more
      Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set 19.0.0/changelog.xml::19.0.0-insert-default-monitoringlocation::seth:
           Reason: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO monitoringlocations (id, monitoringarea) VALUES ('localhost', 'localhost'): ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.:
                Caused By: Error executing SQL INSERT INTO monitoringlocations (id, monitoringarea) VALUES ('localhost', 'localhost'): ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.:
                Caused By: ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.
      	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:347)
      	at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27)
      	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58)
      	at liquibase.Liquibase.update(Liquibase.java:114)
      	at org.opennms.core.schema.Migrator.migrate(Migrator.java:477)
      	... 8 more
      Caused by: liquibase.exception.DatabaseException: Error executing SQL INSERT INTO monitoringlocations (id, monitoringarea) VALUES ('localhost', 'localhost'): ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.
      	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
      	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:104)
      	at liquibase.database.AbstractDatabase.execute(AbstractDatabase.java:1091)
      	at liquibase.database.AbstractDatabase.executeStatements(AbstractDatabase.java:1075)
      	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:317)
      	... 12 more
      Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "monitoringlocations_pkey"
        Detail: Key (id)=(localhost) already exists.
      	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2284)
      	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2003)
      	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:200)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:424)
      	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:321)
      	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313)
      	at liquibase.executor.jvm.JdbcExecutor$1ExecuteStatementCallback.doInStatement(JdbcExecutor.java:92)
      	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55)
      	... 16 more
      

        Attachments

          Activity

            People

            • Assignee:
              jeffg Jeff Gehlbach
              Reporter:
              jeffg Jeff Gehlbach
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: