[Archivesspace_Users_Group] Database troubles upgrading from 1.4.2 to 1.5.1

James Bullen james at hudmol.com
Thu Dec 1 18:44:07 EST 2016


Hi Brent,

It’s hard to be sure what’s going on here, but my guess is that at some point your 1.4.2 instance was running the container management plugin, but that it isn’t currently. That would explain what you’re seeing.

If my guess is right then a fix would be to add container management to your list of plugins just while you run setup-database.sh, something like this in config.rb:

	AppConfig[:plugins] = [‘other’, ’stuff’, ‘container_management']

That would cause it to skip the container management migration - which would have run when the plugin was installed. It’s blowing up on trying to add a duplicate entry to the enumeration table (name has a unique constraint).

You can confirm this by looking at the tables in your database. If you see ‘top_container’ then the container management migration has been run.

It’s possible you’ve landed in a bad state, so if it continues to fail, try starting again and just do the AppConfig tweak just before running setup-database.sh, and then remove it after.

Here’s the relevant migration:
https://github.com/archivesspace/archivesspace/blob/master/common/db/migrations/060_top_container_migration.rb

If this doesn't fix it then my guess is wrong - entirely possible! - and we’ll need to dig a little deeper.


Good luck!


Cheers,
James


> On Dec 2, 2016, at 7:27 AM, Brent Ellingson <brent_ellingson at byu.edu> wrote:
> 
> 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 <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
>  
> !DSPAM:584087b749981951751292! _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org <mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group <http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group>
> 
> 
> !DSPAM:584087b749981951751292!

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


More information about the Archivesspace_Users_Group mailing list