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

Destroy Dataset with a Mapped DataFile #6860

Merged
merged 1 commit into from
May 4, 2020

Conversation

landreev
Copy link
Contributor

What this PR does / why we need it:

Self-explanatory; see issue.

Which issue(s) this PR closes:

Closes #4093

Special notes for your reviewer:

It implements cascade delete on both the map layer and tokens; as in the original PR 2.5 yrs ago. In addition, the code is added to the DeleteDataFileCommand, that deletes any data associated with the layer that may exist on the WorldMap side.

Suggestions on how to test this:

Deploy on demo, destroy all those old, as of now un-destroyable datasets.

Does this PR introduce a user interface change?:
no
Is there a release notes update needed for this change?:
no
Additional documentation:

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm ready to move this to QA but I left a comment so I'll leave it in code review for now.

// We have the dedicatd command DeleteMapLayerMetadataCommand, but
// there's no need to use it explicitly, since the Dataverse-side
// MapLayerMetadata entity will be deleted by the database
// cascade on the DataFile. -- L.A. Apr. 2020
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had forgotten that there's a DeleteMapLayerMetadataCommand but this comment makes me wonder why we don't call it. I get that we don't need to call it thanks to the cascade, but would calling the command cause problems? Does it do more than we want? It seems to clean up thumbnails, for example. Also, there's tiny typo above: dedicatd.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still curious about these questions but there's no need to hold this up from QA so I moved it over. This pull request adds a lot of value.

Copy link
Contributor Author

@landreev landreev Apr 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, missed the original question 4 hours ago. I guess the answer is, the delete layer command is a more surgical tool; it's for a case where we just need to delete the layer, without touching the file.
Calling it in the context of trying to wipe everything, including the datafile and all its associated physical files, would not hurt, strictly speaking - but I couldn't think of why we would want to call it either; seeing how the cascade is more reliable? It does remove the map thumbnails - but then we run a full physical file cleanup after DeleteDataFileCommand, that will delete all aux files associated with the datafile, thumbnails and otherwise.
And then again there is the fact the command doesn't do everything we need, either. It does not attempt to go out and remove whatever possible data may be sitting on the WorldMap side. I could only assume that it was by design.
My attitude with this PR was to check in something ASAP that works and doesn't break things.
I generally sympathize with the goals of making things cleaner; calling commands instead of database queries and such. But in the case of WorldMap, the whole is a big hack - isn't it? Our attempt to "think about it some more" to see if we were doing everything right resulted in a 2.5 year delay, and a whole bunch of these un-destructible datasets still sitting in production...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed. I don't think this will break anything and it definitely adds value. Thanks for the explanation.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@djbrooke
Copy link
Contributor

Let's hold off on moving to QA pending the question/typo above

@kcondon kcondon self-assigned this May 4, 2020
@kcondon kcondon merged commit 1424ba8 into develop May 4, 2020
@kcondon kcondon deleted the 4093-destroy-mapped-files-again branch May 4, 2020 16:10
@djbrooke djbrooke added this to the Dataverse 5 milestone May 4, 2020
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.

Destroy Dataset: Cannot destroy a dataset that has a mapped shape file.
4 participants