[Archivesspace_Users_Group] Database troubles upgrading from 1.4.2 to 1.5.1

Lora Davis ljdavis at jhu.edu
Fri Dec 2 17:24:11 EST 2016


Hi Brent,

I would suspect this is NOT your issue, but having recently found myself hitting my head against the wall trying to complete our own local test upgrade, I figured I'd chime in.  My steps were essentially a mirror of yours (though using MySQL) - generate a dump of production 1.4.2 (with container management plugin); restore dump and confirm all is well with a new, local 1.4.2 VM (with container management plugin); install 1.5.1 and copy required directories from new, local 1.4.2 to 1.5.1; attempt to run 1.5.1 setup-database.sh (with container management still in config).  This resulted in the same exact error you quote below.  I tried following the wisdom here<https://archivesspace.atlassian.net/browse/AR-1404>, here<http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/2016-August/003846.html>, and here<http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/2016-August/003847.html> all to no avail.

So, what WAS the issue?  Somewhere along the lines our 1.4.2 container management plugin was named "container_management-master" (*head scratch* some odd git cloning?) in the production environment deployed by our Systems folks.  I never knew/cared/considered this since, well, it worked.  It took a few weeks of hunting before I realized that 1. Our plugin, as copied over from production, had a special snowflake name, and 2. That the relevant migrator<https://github.com/archivesspace/archivesspace/blob/master/common/db/migrations/060_top_container_migration.rb> (which James Bullen linked to in an earlier reply today) specifically looks for a plugin named "container_management" (NOT "container_management-master") when deciding whether or not to run this set of migrations.

I went into my local VM and changed the name of the plugin directory and the name of the plugin as called in config.rb from "container_management-master" to "container_management" and voila!  Success!

Best,

Lora

Lora J. Davis
Digital Archivist
The Sheridan Libraries
Johns Hopkins University
3400 North Charles Street
Baltimore, MD     21228
(410) 516-5898
ljdavis at jhu.edu<mailto:ljdavis at jhu.edu>

From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Brent Ellingson
Sent: Thursday, December 01, 2016 3:27 PM
To: Archivesspace Users Group (archivesspace_users_group at lyralists.lyrasis.org) (archivesspace_users_group at lyralists.lyrasis.org) <archivesspace_users_group at lyralists.lyrasis.org>
Subject: [Archivesspace_Users_Group] Database troubles upgrading from 1.4.2 to 1.5.1

We are trying to upgrade a test instance of ArchivesSpace from 1.4.2 to 1.5.1 and we have run into some SQL errors that have prevented the upgrade. We are using a copy of the production data.

Some help or suggestions would be greatly appreciated.

Here is basically what we have done.
* Get a MySQL dump of the production DB
* Copy the DB to a new server (now running MariaDB)
* Installed ArchivesSpace 1.4.2
* Started & indexed the 1.4.2 instance
* Tested the 1.4.2 instance and it was running fine
* Started the upgrade process for 1.5.1
* Stopped the 1.4.2 instance
* Unzipped the 1.5.1 archive to a new place
* Copied the data files to the 1.5.1/data directory
* Copied the config.rb
* Copied the mysql jdbc jar to lib
* Copied the plugins (we don't have any that I know of)
* Checked the en.yml files
* Ran the setup-database.sh script
* Setup stopped due to a Database error

Here is the text of the error we are seeing from the log file:
**** Begin error log output ****
Loading ArchivesSpace configuration file from path: /opt/archivesspace-1.5.1/archivesspace/config/config.rb
Loading ArchivesSpace configuration file from path: /opt/archivesspace-1.5.1/archivesspace/config/config.rb
Running migrations against jdbc:mysql://[DB_SERVER]:3306/[DB_NAME]?user=[REDACTED]&password=[REDACTED]&useUnicode=true&characterEncoding=UTF-8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

     3


     Database migration error.
     Your upgrade has encountered a problem.
     You must resolve these issues before the database migration can complete.


     Error:
     #<Sequel::UniqueConstraintViolation: Java::ComMysqlJdbcExceptionsJdbc4::MySQLIntegrityConstraintViolationException: Duplicate entry 'restriction_type' for key 'name'>
     Java::ComMysqlJdbcExceptionsJdbc4::MySQLIntegrityConstraintViolationException: Duplicate entry 'restriction_type' for key 'name'
     java.lang.reflect.Constructor.newInstance(java/lang/reflect/Constructor.java:423)
com.mysql.jdbc.Util.handleNewInstance(com/mysql/jdbc/Util.java:425)
com.mysql.jdbc.Util.getInstance(com/mysql/jdbc/Util.java:408)
com.mysql.jdbc.SQLError.createSQLException(com/mysql/jdbc/SQLError.java:935)
com.mysql.jdbc.MysqlIO.checkErrorPacket(com/mysql/jdbc/MysqlIO.java:3970)
com.mysql.jdbc.MysqlIO.checkErrorPacket(com/mysql/jdbc/MysqlIO.java:3906)
com.mysql.jdbc.MysqlIO.sendCommand(com/mysql/jdbc/MysqlIO.java:2524)
com.mysql.jdbc.MysqlIO.sqlQueryDirect(com/mysql/jdbc/MysqlIO.java:2677)
com.mysql.jdbc.ConnectionImpl.execSQL(com/mysql/jdbc/ConnectionImpl.java:2545)
com.mysql.jdbc.StatementImpl.executeUpdateInternal(com/mysql/jdbc/StatementImpl.java:1540)
com.mysql.jdbc.StatementImpl.executeLargeUpdate(com/mysql/jdbc/StatementImpl.java:2603)
com.mysql.jdbc.StatementImpl.executeUpdate(com/mysql/jdbc/StatementImpl.java:1604)
java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:498)
RUBY.execute_statement_insert(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc/mysql.rb:68)
RUBY.execute(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:256)
RUBY.log_yield(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/database/logging.rb:33)
RUBY.execute(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:256)
RUBY.statement(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:646)
RUBY.execute(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:245)
RUBY.hold(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/connection_pool/threaded.rb:98)
RUBY.synchronize(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/database/connecting.rb:255)
RUBY.execute(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:244)
RUBY.execute_insert(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:276)
RUBY.execute_insert(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/dataset/actions.rb:927)
RUBY.insert(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/dataset/actions.rb:336)
RUBY.create_enum(/opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/migrations/utils.rb:45)
RUBY.create_editable_enum(/opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/migrations/utils.rb:38)
RUBY.(root)(/opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/migrations/060_top_container_migration.rb:15)
org.jruby.RubyBasicObject.instance_eval(org/jruby/RubyBasicObject.java:1574)
RUBY.apply(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:100)
RUBY.run(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:528)
RUBY.checked_transaction(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:466)
RUBY.run(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:527)
org.jruby.RubyArray.each(org/jruby/RubyArray.java:1613)
RUBY.run(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:524)
RUBY.run(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:391)
RUBY.setup_database(file:/opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/db_migrator.rb:185)
$_dot_dot_.scripts.rb.migrate_db.(root)(../scripts/rb/migrate_db.rb:43)
$_dot_dot_.scripts.rb.migrate_db.(root)($_dot_dot_/scripts/rb/../scripts/rb/migrate_db.rb:43)
RUBY.connect(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/database/connecting.rb:69)
RUBY.connect(/opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/core.rb:95)
$_dot_dot_.scripts.rb.migrate_db.(root)(../scripts/rb/migrate_db.rb:28)
$_dot_dot_.scripts.rb.migrate_db.(root)($_dot_dot_/scripts/rb/../scripts/rb/migrate_db.rb:28)


     3
Sequel::UniqueConstraintViolation: Java::ComMysqlJdbcExceptionsJdbc4::MySQLIntegrityConstraintViolationException: Duplicate entry 'restriction_type' for key 'name'
           raise_error at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/database/misc.rb:423
             statement at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:648
               execute at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:245
                  hold at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/connection_pool/threaded.rb:98
           synchronize at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/database/connecting.rb:255
               execute at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:244
        execute_insert at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/adapters/jdbc.rb:276
        execute_insert at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/dataset/actions.rb:927
                insert at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/dataset/actions.rb:336
           create_enum at /opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/migrations/utils.rb:45
  create_editable_enum at /opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/migrations/utils.rb:38
                (root) at /opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/migrations/060_top_container_migration.rb:15
         instance_eval at org/jruby/RubyBasicObject.java:1574
                 apply at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:100
                   run at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:528
   checked_transaction at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:466
                   run at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:527
                  each at org/jruby/RubyArray.java:1613
                   run at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:524
                   run at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/extensions/migration.rb:391
        setup_database at file:/opt/archivesspace-1.5.1/archivesspace/lib/common.jar!/db/db_migrator.rb:185
                (root) at ../scripts/rb/migrate_db.rb:43
               connect at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/database/connecting.rb:69
               connect at /opt/archivesspace-1.5.1/archivesspace/gems/gems/sequel-4.20.0/lib/sequel/core.rb:95
                (root) at ../scripts/rb/migrate_db.rb:28
**** End error log output ****

Thank you for your time.

Regards,
__________________________
Brent Ellingson
Sr. Software Engineer
2750 Harold B. Lee Library
Brigham Young University
(801)422-6148

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20161202/3805c711/attachment.html>


More information about the Archivesspace_Users_Group mailing list