Uploaded image for project: 'Hippo Repository'
  1. Hippo Repository
  2. REPO-2179

Duplicate key name 'REPOSITORY_HIPPO_LOCK_idx_1' thrown when concurrently starting multiple instances on new MySQL database

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 13.0.0, 11.2.10-1, 12.6.0
    • Fix Version/s: 4.2.13, 5.6.2, 13.0.1, 13.1.0
    • Labels:
      None
    • Similar issues:
    • Processed by team:
      Platform
    • Sprint:
      Platform 203 - Beanless 1

      Description

      A race condition can occur the initial creation of the HIPPO_LOCK table when multiple instances are started at the same time, and specifically the handling in the MySQLDbLockManager can then fail during the (re)creation of the unique index on the lockKey column:

      Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate key name 'REPOSITORY_HIPPO_LOCK_idx_1'
              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_172]
              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_172]
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_172]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_172]
              at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1540) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.StatementImpl.executeBatchInternal(StatementImpl.java:1022) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:958) ~[mysql-connector-java-5.1.40.jar:5.1.40]
              at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:348) ~[tomcat-dbcp.jar:8.5.31]
              at org.apache.tomcat.dbcp.dbcp2.DelegatingStatement.executeBatch(DelegatingStatement.java:348) ~[tomcat-dbcp.jar:8.5.31]
              at org.onehippo.repository.lock.db.MySqlDbLockManager.correctTableScheme(MySqlDbLockManager.java:92) ~[hippo-repository-engine-5.3.0.jar:5.3.0]
              at org.onehippo.repository.lock.db.MySqlDbLockManager.createTableIfNeeded(MySqlDbLockManager.java:67) ~[hippo-repository-engine-5.3.0.jar:5.3.0]
              at org.onehippo.repository.lock.db.DbLockManager.<init>(DbLockManager.java:120) ~[hippo-repository-engine-5.3.0.jar:5.3.0]
              at org.onehippo.repository.lock.db.MySqlDbLockManager.<init>(MySqlDbLockManager.java:36) ~[hippo-repository-engine-5.3.0.jar:5.3.0]
              at org.onehippo.repository.lock.db.DbLockManagerFactory.create(DbLockManagerFactory.java:69) ~[hippo-repository-engine-5.3.0.jar:5.3.0]
              at org.onehippo.repository.lock.db.DbLockManagerFactory.create(DbLockManagerFactory.java:38) ~[hippo-repository-engine-5.3.0.jar:5.3.0]
              at com.onehippo.repository.HippoEnterpriseRepository.createRepositoryConfig(HippoEnterpriseRepository.java:156) ~[hippo-enterprise-repository-engine-5.3.0.jar:5.3.0]
              at org.hippoecm.repository.LocalHippoRepository.initialize(LocalHippoRepository.java:284) ~[hippo-repository-engine-5.3.0.jar:5.3.0]

      While there is specific retry logic in the #correctTableScheme method, it currently is checking against errors containing "duplicate entry" or "data truncated", not "duplicate key" like in the reported error.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                adouma Ate Douma
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: