Skip to content
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

Batch Delete: Batch delete of files fails for non super user if dataset has thumbnail. #4024

Closed
kcondon opened this issue Jul 26, 2017 · 4 comments
Assignees
Labels
Feature: File Upload & Handling Type: Bug a defect UX & UI: Design This issue needs input on the design of the UI and from the product owner

Comments

@kcondon
Copy link
Contributor

kcondon commented Jul 26, 2017

Reported by a user, see RT 251413

User reported that they could not delete all files from a dataset using the top select all checkbox.
This happens if the user is not a superuser and at least one of the files generates a thumbnail that becomes the dataset thumbnail, such as an image file or pdf. It can happen with a single image file if it is the one used for dataset thumbnail but will prevent the batch from deleting. The server log error is:

Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.postgresql.util.PSQLException: ERROR: update or delete on table "dvobject" violates foreign key constraint "fk_dataset_thumbnailfile_id" on table "dataset"
Detail: Key (id)=(216596) is still referenced from table "dataset".
Error Code: 0
Call: DELETE FROM DVOBJECT WHERE (ID = ?)
bind => [1 parameter bound]
Query: DeleteObjectQuery([DataFile id:216596 name:null])

Note, there is a workaround: mark all for delete, deselect the one file used as thumbnail, batch delete, then delete the last file.

@djbrooke
Copy link
Contributor

@rbhatta99 - going to move this back to not started for now, feel free to pick it up once the Primefaces spike is moved on!

@rbhatta99 rbhatta99 self-assigned this Aug 17, 2017
landreev added a commit that referenced this issue Aug 18, 2017
…g deleted; even though we keep it

in the previously published version, we don't want to keep it assigned as the dedicated dataset thumbnail)
(#4024)
@rbhatta99 rbhatta99 mentioned this issue Aug 18, 2017
5 tasks
@rbhatta99 rbhatta99 removed their assignment Aug 18, 2017
rbhatta99 added a commit that referenced this issue Aug 22, 2017
@djbrooke djbrooke assigned landreev and unassigned scolapasta Aug 24, 2017
@landreev
Copy link
Contributor

I've pulled this one back into dev., to quickly resolve the controversy with unintercepted exceptions, when things go wrong trying to delete physical files.

landreev added a commit that referenced this issue Aug 24, 2017
…though the physical file could

not be deleted for an unpublished datafile. (#4024)
@landreev
Copy link
Contributor

OK, I reorganized some old code on the inside.
Tested like this: added a file to a draft version; removed the write permission on the dataset directory; tried to delete the file on the dataset page. (it's important that the file is unpublished - otherwise we never try to remove the physical file - we'll be only removing it from the new draft...)

Now I'm getting a proper error message:

screen shot 2017-08-24 at 7 22 22 pm

@landreev
Copy link
Contributor

Back into code review it goes...

@landreev landreev assigned rbhatta99 and unassigned landreev Aug 24, 2017
@kcondon kcondon self-assigned this Aug 25, 2017
@kcondon kcondon closed this as completed Aug 28, 2017
@djbrooke djbrooke added this to the 4.8 - AWS S3 Support milestone Aug 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: File Upload & Handling Type: Bug a defect UX & UI: Design This issue needs input on the design of the UI and from the product owner
Projects
None yet
Development

No branches or pull requests

5 participants