On Mon, Jun 12, 2023 at 10:58:26PM -0700, Technologiczny Informator wrote:
> I reported this problem at the end of December last year, but no one
> responded. That's why I'm writing again, because the problem has not
> disappeared after updating to DSpace 7.5.
> Not only that ... I had the opportunity to update to version 7.5 on a
> completely different database than mine. Her assetstore folder is over 170
> GB. The owner of this DSpace wanted to split the database into two separate
> instances. This is what happened and in each of them a large number of
> items had to be removed (over 24,000 in one of them). After this operation,
> I wanted to clean the database with the cleanup option, but the effect so
> far - I only post the error message this time::
>
> Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on
> table "bitstream" violates foreign key constraint
> "bundle_primary_bitstream_id_fkey" on table "bundle"
> Detail: Key (uuid)=(02caead4-de93-4011-8105-0e6921f286d8) is still
> referenced from table "bundle".
I get those sometimes. Here are the notes that I made for myself
about manually resolving the situation:
DSpace 6+:
\set a BITSTREAM-UUID
SELECT uuid AS b FROM bundle WHERE primary_bitstream_id = :'a';
\gset
SELECT * FROM bundle2bitstream WHERE bundle_id = :'b';
-- Is bitstream A in bundle B? Yes: problem?
SELECT deleted FROM bitstream WHERE uuid = :'a';
-- Deleted? No: problem?
UPDATE bundle SET primary_bitstream_id = null WHERE uuid = :'b';
where BITSTREAM-UUID is replaced by the actual UUID. I type the first
'\set' in by hand and paste the UUID; after that I just copy/paste
each command and watch for errors, including those noted in the
comments. This procedure isn't *quite* right yet to be scripted, but
it works for me.
I sometimes find that there are multiple bitstreams with this problem.
Unfortunately, the cleanup tool exits after the first one (aborting
its single transaction, alas!), so sometimes I need to run cleanup
several times, fixing one bitstream at a time.
--
Mark H. Wood
Lead Technology Analyst
University Library
Indiana University - Purdue University Indianapolis
755 W. Michigan Street
Indianapolis, IN 46202
317-274-0749
www.ulib.iupui.edu