mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
DS-712 : DSpace Fails to Check if a Handle is already assigned before assigning a new handle
The resolution to this problem is not to for DSpace to query all handles when assigning a new one (which can be taxing for large installs). Rather this fix changes the 'update-sequences.sql' scripts (for both Postgres & Oracle) such that the Handle sequence number will always be updated to ensure DSpace will assign a unique handle on the next handle request. I've also documented in the AIP backup/restore docs (DS-466) that update-sequence.sql script should always be run after a full AIP restore (which is the primary scenario where DSpace may encounter handle assignment issues). git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5691 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -72,7 +72,6 @@ SELECT setval('community2collection_seq', max(id)) FROM community2collection;
|
||||
SELECT setval('collection2item_seq', max(id)) FROM collection2item;
|
||||
SELECT setval('resourcepolicy_seq', max(policy_id)) FROM resourcepolicy;
|
||||
SELECT setval('epersongroup2eperson_seq', max(id)) FROM epersongroup2eperson;
|
||||
SELECT setval('handle_seq', max(handle_id)) FROM handle;
|
||||
SELECT setval('workspaceitem_seq', max(workspace_item_id)) FROM workspaceitem;
|
||||
SELECT setval('workflowitem_seq', max(workflow_id)) FROM workflowitem;
|
||||
SELECT setval('tasklistitem_seq', max(tasklist_id)) FROM tasklistitem;
|
||||
@@ -84,4 +83,20 @@ SELECT setval('metadatafieldregistry_seq', max(metadata_field_id)) FROM metadata
|
||||
SELECT setval('metadatavalue_seq', max(metadata_value_id)) FROM metadatavalue;
|
||||
SELECT setval('metadataschemaregistry_seq', max(metadata_schema_id)) FROM metadataschemaregistry;
|
||||
SELECT setval('harvested_collection_seq', max(id)) FROM harvested_collection;
|
||||
SELECT setval('harvested_item_seq', max(id)) FROM harvested_item;
|
||||
SELECT setval('harvested_item_seq', max(id)) FROM harvested_item;
|
||||
|
||||
-- Handle Sequence is a special case. Since Handles minted by DSpace use the 'handle_seq',
|
||||
-- we need to ensure the next assigned handle will *always* be unique. So, 'handle_seq'
|
||||
-- always needs to be set to the value of the *largest* handle suffix. That way when the
|
||||
-- next handle is assigned, it will use the next largest number. This query does the following:
|
||||
-- For all 'handle' values which have a number in their suffix (after '/'), find the maximum
|
||||
-- suffix value, convert it to a 'bigint' type, and set the 'handle_seq' to that max value.
|
||||
SELECT setval('handle_seq',
|
||||
CAST (
|
||||
max(
|
||||
to_number(regexp_replace(handle, '.*/', ''), '999999999999')
|
||||
)
|
||||
AS BIGINT)
|
||||
)
|
||||
FROM handle
|
||||
WHERE handle SIMILAR TO '%/[0123456789]*';
|
Reference in New Issue
Block a user