Hi,

> if you can confirm that Brian's solution indeed works, then
we can file this as a bug.

OK, I’ve been investigating and testing and this approach does appear to work 
for me – the following cleared the primary_bitstream_id from the bundles that 
had primary bitstreams that were marked for deletion in the bitstream table:

Update bundle set primary_bitstream_id = NULL where bundle_id in (select 
bundle_id from bundle, bitstream where deleted = TRUE and primary_bitstream_id 
= bitstream_id)

Before running this (on my DEV system), following the clean up yesterday, I 
picked things apart to see what needed to happen.

There were 16 bitstreams that caused errors during my cleanup of my DEV system 
yesterday – to get around these errors, I reset the deleted value for each of 
these to FALSE so cleanup would skip them, but I had the foresight to take a 
note of them, so I knew the bitstream IDs of the problem bitstreams – so, 
visually checking the bundle table, I could see that these were all listed in 
the (mostly empty) primary_bitstream_id column.

I then reset the deleted value back to “TRUE” for the bitstreams  in question 
and checked the bundles again via SQL, using the following to return bundles 
that had a primary bitstream that had “deleted=TRUE”:

select bundle_id from bundle, bitstream where deleted = TRUE and 
primary_bitstream_id = bitstream_id

- and, cross checking from the other side, bitstreams that had “deleted=TRUE” 
that were also primary bitstreams:

select bitstream_id from bitstream, bundle where deleted = TRUE and 
primary_bitstream_id = bitstream_id

As all this data seemed to cross check, I then ran the Update SQL suggested by 
Brian (with a couple of minor syntactic tweaks) which fixed up the problem 
primary_bitstream_ids in the bundle table.

I then ran the cleanup script again, and it happily removed the previously 
problematic bitstreams (and their records in the bitstream table) – excellent!

This is all with DSpace v1.6.2 on Postgres . . .

Hope that helps.

Mike
Michael White
eLearning Liaison and Development (eLD)
Information Services
S8, Library
University of Stirling
Stirling SCOTLAND
FK9 4LA
Email: [email protected]<mailto:[email protected]>
Tel: +44 (0) 1786 466877
Fax: +44 (0) 1786 466880
http://www.stir.ac.uk/is/staff/about/teams/aldt/#eld

From: Hilton Gibson [mailto:[email protected]]
Sent: 14 March 2013 13:11
To: Ivan Masár
Cc: Michael White; Brian Freels-Stendel; [email protected]
Subject: Re: [Dspace-tech] DSpace cleanup error

Nope. It does not work on a new test system using DSpace 1.8.2.
My "bundle" table has blanks for "primary_bitstream_id".
See attached.


On 14 March 2013 13:58, helix84 <[email protected]<mailto:[email protected]>> 
wrote:
Michael, if you can confirm that Brian's solution indeed works, then
we can file this as a bug. This problem never occurred to me. It is
also possible that those items with a primary bitstream set (that
wasn't cleared when they were deleted or during the cleanup run) come
from an older version of DSpace, in which case we still should check
for it in the cleanup code.


Regards,
~~helix84

Compulsory reading: DSpace Mailing List Etiquette
https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette



--
Hilton Gibson
Systems Administrator
JS Gericke Library
Room 1025D
Stellenbosch University
Private Bag X5036
Stellenbosch
7599
South Africa

Tel: +27 21 808 4100 | Cell: +27 84 646 4758
http://library.sun.ac.za
http://scholar.sun.ac.za
http://ar1.sun.ac.za
http://aj1.sun.ac.za

-- 
The University of Stirling is ranked in the top 50 in the world in The Times 
Higher Education 100 Under 50 table, which ranks the world's best 100 
universities under 50 years old.
The University of Stirling is a charity registered in Scotland, 
 number SC 011159.

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to