[Archivesspace_Users_Group] Error message when saving record
Fortney, Kyle
kyle.fortney at okstate.edu
Tue Jan 10 15:25:57 EST 2017
We have recently worked through this problem on our 1.4.2 production server and our 1.5.1 test server. It more than likely means that the parent child sequence does not exist in your sequence table.
I'm sorry if my grammar is a little confusing (this was tough to figure out), but the following is what we experienced on our servers -
The error message is misleading. The uniq_ao_position is a combined index of the parent_name and position fields. The real issue lies with the sequence table. The sequence for a specific parent child grouping or relationship doesn't exist or the value of the sequence is less than the number of child objects within that parent. When a record is saved it checks against the sequence table. If a sequence for a parent child grouping exists it checks the value of that sequence. If you have one child object the value would be 0 (because an index starts at 0) and if you have five child objects the value would be 4. When saving a record where the sequence value is too low it will return an error similar to below with the current sequence value where you see 0 below. To solve this issue, set your sequence value higher than the highest child position WITHIN your specific parent child grouping. What was recommended to us to fix this issue was:
"Recommend database backup. Develop query to (re)set appropriate sequence values (or just set all sequence values arbitrarily high -- WARN, TEST THIS and review related code!)."
SELECT max(position) FROM archival_object;
# 416
UPDATE sequence SET value = 417;
# set all sequence values > than highest possible position to satisfy invariant
# not presently aware of a downside to this but BEWARE and TEST thoroughly
The bigger issue is when the sequence for a parent child grouping doesn't exist. These are harder to find and we have been doing them on a case by case basis. When you see the error message below and have done the above, there are a few ways to do this; Lyrasis highly recommends using the API (no idea how to do this), you can manually create the sequence in the SQL instance, OR the most common and straightforward way, which is to save the first child within a parent child grouping creating the sequence automatically. In any of those instances the newly created sequence will have a value of 0, so if you have more than one child object already present you will need to update the sequence value for the parent child grouping to at least the number of present children objects.
I hope this helps.
Thanks,
Kyle Fortney
Computer Specialist
Library Systems
308 Edmon Low Library, OSU
(405) 744-7924
From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Fleming, Jason
Sent: Tuesday, January 10, 2017 12:39 PM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: [Archivesspace_Users_Group] Error message when saving record
We recently upgraded to 1.5.2 and we came across this error after saving a modification to the title of one of our archival objects
translation missing: en.no key - translation missing: en.validation_errors.database_integrity_constraint_conflict__java__commysqljdbcexceptionsjdbc4__mysqlintegrityconstraintviolationexception__duplicate_entry__12276 at archival_object-0__for_key__uniq_ao_pos_<mailto:en.validation_errors.database_integrity_constraint_conflict__java__commysqljdbcexceptionsjdbc4__mysqlintegrityconstraintviolationexception__duplicate_entry__12276 at archival_object-0__for_key__uniq_ao_pos_>
I looked through the listserv and the closest thing I could find seemed to be a bug fixed several versions back in 2014
Has anyone seen something similar or have any suggestions of where to look to fix this problem?
I have already tried rebooting the server but that didn't change anything
-Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20170110/e1ea77a3/attachment.html>
More information about the Archivesspace_Users_Group
mailing list