Hi All
The query that ran is as follows:
*update bundle set primary_bitstream_id = NULL where bundle_id in (select
b.bundle_id from bundle b, bitstream bs where bs.deleted = true and
b.primary_bitstream_id = bs.bitstream_id);*
*commit;*
The query found 63 items with a primary bitstream reference that did not
exist.
I had help from one of campus developers in building the query so I cannot
answer questions about its make-up.
Cheers
hg
On 14 March 2013 17:25, Michael White <[email protected]> wrote:
> 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]
> 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]> 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.
>
--
*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
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
_______________________________________________
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