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

Deletion of resource before purging #4867

Closed
wants to merge 7 commits into from
Closed

Deletion of resource before purging #4867

wants to merge 7 commits into from

Conversation

iamarnavgarg
Copy link
Contributor

Fixes #4705

Proposed fixes:

While purging of the dataset, the resources associated with them are deleted first and then the dataset.

The procedure followed is as below:
a)We need to have/retrieve the package id.
b) Using the package id,we will then retrieve the list of resources associated the dataset.
c) Now, we will delete the resources associated with the datasets.
d)Now,when the resources are deleted, the flow of purging will resume its normal flow afterwards.

@amercader amercader self-assigned this Jun 25, 2019
@amercader
Copy link
Member

Hi @iamarnavgarg, thanks for submitting this. I'm not clear how this code helps with the original issue flagged in #4705. IIUC that issue states that if a dataset and its resources are purged, the actual data files hosted on the FileStore and the data tables hosted on the DataStore should be deleted as well.

But I don't see how your code implements that, although I might be missing something. Do you mind expand on the changes?

@iamarnavgarg
Copy link
Contributor Author

Hi @amercader,

please find the below explanation regarding the changes:
a) during purge operation of a dataset, I gather the package ID of a dataset through which I can now access the resources associated with that dataset which is in trash.

c)Thus, from the package ID, I delete the resource associated with the datasets. By doing this, the resource is first deleted and then we could perform the purging of the datasets.

d) After the resource has been completely deleted from the datastore and package is also updated. We can perform the normal flow/execution of purging of the dataset.

davidread pushed a commit that referenced this pull request Jul 12, 2019
Fixes #4705

@dassolkim is concerned that IResourceController.before_delete event is
not firing at any point when a dataset is deleted and then purged
(either with package_purge or the admin.Trash page). PR #4867 seeks to
implement the event in the admin.Trash page. But this PR proposes the
alternative, which is to actually delete the resource when the dataset
is deleted and fire the event then.

It seems an anomaly that we don't delete resources with the dataset. It
makes sense that the dataset and resources are both state=deleted.
However there is an argument that we shouldn't, because a sysadmin can still
see the deleted dataset, but with this PR it will have no resources.
@chandradeep11
Copy link
Contributor

@amercader
Hi, Please close the issue #4705 If there is no issue in PR.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems when deleting resources
4 participants