-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleted primary bitstream still referenced in the bundle #9099
Comments
This definitely sounds like a bug. Pulling this over to the 7.6.x maintenance board. Thanks for volunteering to look into it, @paulo-graca ! |
This would require a database change imho as we should have a foreign key in the bundle table to force the primary_bitstream_id column to reference an existing row in the bitstream table. Moreover we need a sql script to cleanup inconsistent data before to apply to constraint. This seems to force us to target this fix for DSpace 8. If we want to fix it in the 7.x maintenance branch we should avoid the database change and perform this extra step in the dspace 8 fix, do you agree @tdonohue ? |
@abollini : If we made this fix via a database change, then I agree that would need to wait for 8.0. We want to avoid DB changes in bug fix releases unless absolutely required. However, I see that @paulo-graca has a draft PR that doesn't involve a database change. Instead, he just unsets the primary bitstream if deleted: #9106 That seems like it could qualify for a bug fix release, as it's fixing code behavior (and it seems to be a possible one line fix -- although it's unclear if the proposed fix works yet) |
Sorry, I'm still working on it. I've had mini vacations last week (it was a National holiday here). I didn't had the time to make more progresses. Aside: @abollini Initially when I start reading your comment I was thinking you were suggesting a different thing, like to handle primary bitstream in another way. And that make me think that we could have primary bitstreams at bundle2bitstream (boolean field) that could eliminate this issue, but it has some pros and cons and would require a lot more effort and that would definitely be marked as 8.0. |
I want to mention that this issue is related to this long-standing issue: #7348 The foreign key in the bundle table already exists but when a bitstream is deleted it is actually a logical delete (they are marked as deleted). The table row is actually deleted afterwards, using the cleanup script and this could produce the exception reported in #7348 Fixing this bug will surely fix #7348 @paulo-graca In case it helps, investigating #7348 I have seen that there are two functions to mark the bitstreams as deleted, one in the BundleService and another in the BitstreamService. The primary bitstream relation is cleared if the BundleService implementation is used but calling directly the BitstreamService implementation the primary bitstream relation is not cleared. It could be the problem, I think that the API call uses directly the BistreamService implementation. Could be a good idea to clear this relation also in the BitstreamService implementation. |
@toniprieto thank you for your feedback! I can confirm that currently we already have that constrain:
|
Clear primary bistream when it's deleted- Fix issue #9099
[Port dspace-7_x] Clear primary bistream when it's deleted- Fix issue #9099
Describe the bug
Primary Bitstreams are used for Access Status calculations, but when the that bitstream is deleted, the bundle primary bitstream reference isn't changed. So, Access Status calculations will return wrong status.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Apparently nothing changes, but the deleted bitstream is still referenced as that bundle primary bitstream. It's hoped that, when a bitstream is deleted, also that bundle's primary bitstream reference is also removed. This issue is also present in older DSpace versions (like 5.X).
The text was updated successfully, but these errors were encountered: