VTUL / vtechworks

DSpace at Virginia Tech
http://vtechworks.lib.vt.edu
Other
6 stars 8 forks source link

Collection deletion problem #805

Closed pyc1 closed 2 years ago

pyc1 commented 2 years ago

I'm unable to delete the original collection in CAUS, Higher Education Policy for Minorities, https://vtechworks.lib.vt.edu/handle/10919/82860. I've deleted several other collections after I've moved them as part of the university reorganization with no problem. Yesterday afternoon and this morning I'm getting the "Page Currently Unavailable" message whenever I try to delete this collection. I've moved all items and removed all roles and the collection description. Can you try?

The new collection in CLAHS is here: https://vtechworks.lib.vt.edu/handle/10919/111122. Thanks

alawvt commented 2 years ago

I am also getting the "Page Currently Unavailable" message. I downloaded the metadata of the new collection and all those items look fine with only the new collection handle in the handle column. I exported the metadata for the old collection and it only has a header row: id, collection. I exported the old collection and the email was,

"The item export you requested was not completed, due to the following reason: The DSpaceObject that you specified has no items."

I renamed the collection, "Legacy collection to delete" and the subcommunity that contains it, "Legacy sub-community to delete." I renamed the old SPIA community "Legacy community to delete" and added a note about the move in the CAAD page, https://vtechworks.lib.vt.edu/handle/10919/5538.

keithgee commented 2 years ago

I have found this issue in the log and it may be related: 2022-07-06 12:11:01,243 ERROR org.hibernate.engine.jdbc.spi.SqlExceptionHelper @ ERROR: update or delete on table "item" violates foreign key constraint "requestitem_item_id_fkey" on table "requestitem"

(I was looking during stand up meeting today - other times with the same message match previous attempts)

alawvt commented 2 years ago

@keithgee, thank you very much for thinking about the DSpace log. In the Storage Layer, https://wiki.lyrasis.org/display/DSDOC6x/Storage+Layer?preview=/68069687/78157937/dspace6.png, It looks like the requestitem table contains information from the request-a-copy form. I wonder if there were outstanding request for items from that collection if that could cause this error. Although it seems like the request should be attached to an item and not a collection.

alawvt commented 2 years ago

I found one item in this collection that was withdrawn and moved it to the new collection. It still won't delete the legacy collection. I will check for other items. There were some request-a-copies for items in this collection. Maybe some are still outstanding.

keithgee commented 2 years ago

@keithgee, thank you very much for thinking about the DSpace log. In the Storage Layer, https://wiki.lyrasis.org/display/DSDOC6x/Storage+Layer?preview=/68069687/78157937/dspace6.png, It looks like the requestitem table contains information from the request-a-copy form. I wonder if there were outstanding request for items from that collection if that could cause this error. Although it seems like the request should be attached to an item and not a collection.

Anne, it looks there was indeed an outstanding request for an item from that collection. The item was requested on June 22, 2020. However, that item was withdrawn on May 13th 2020 but somehow still discoverable. The request is still pending today.

I'm guessing that deleting a collection does a cascading delete on all of the items that the collection owns. Then this particular item can't be deleted because of the foreign key constraint referenced in the error message:

"requestitem_item_id_fkey" FOREIGN KEY (item_id) REFERENCES item(uuid)

So deleting the collection also fails.

I have more information about the withdrawn item, the pending request-a-copy etc. if useful. I didn't include it here because I thought there might be privacy implications for the requestor and/or the author of the withdrawn item.

keithgee commented 2 years ago

Okay let me pop on slack and we can compare notes.

alawvt commented 2 years ago

I found that second item that was withdrawn and moved it to the new collection. Then I was able to delete the legacy collection, sub-community, and community -- Victory!

Lesson: moving items via a spreadsheet doesn't move withdrawn items in that collection.

keithgee commented 2 years ago

Btw, here's a link to instructions for a tool about moving communities in a hierarchy, although it seems not to apply to collections: Community-Filiator https://wiki.lyrasis.org/display/DSDOC7x/Managing+Community+Hierarchy

keithgee commented 2 years ago

Thank you for resolving this issue so quickly, @alawvt !

alawvt commented 2 years ago

Thank you, @keithgee!

alawvt commented 2 years ago

I tested on dev: an item that is in Withdrawn that hasn't been requested will be deleted when its owning collection is deleted.