Skip to content

Clean deletion of a Version #3743

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

Closed
humitos opened this issue Mar 6, 2018 · 4 comments
Closed

Clean deletion of a Version #3743

humitos opened this issue Mar 6, 2018 · 4 comments
Labels
Accepted Accepted issue on our roadmap Bug A bug
Milestone

Comments

@humitos
Copy link
Member

humitos commented Mar 6, 2018

When a Version is deleted, we are triggering clear_artifacts and symlink_project but the later is triggered before the object deletion; so, I think if the task is ran before it's effectively deleted the symlink won't be properly synced:

https://github.com/rtfd/readthedocs.org/blob/5472906a067adc60f42556108993255393408410/readthedocs/builds/models.py#L181-L187

To fix this we could chain some Celery task in this order:

  1. trigger clear_artifacts
  2. delete the Version object
  3. trigger symlink_projects

Take into account that the first and last have to be executed in a broadcast call but the second one should be executed just once since it affects the database.

This method Version.delete is not used in the codebase at all, so I'm not sure if this is a priority. I found that all the Versions are activated/deactivated but not deleted.

Ref: #3649 (comment)

@agjohnson
Copy link
Contributor

We can use Celery task chaining to accomplish this probably.

@agjohnson agjohnson added the Accepted Accepted issue on our roadmap label Sep 19, 2018
@agjohnson agjohnson added this to the 2.7 milestone Sep 19, 2018
@stsewd
Copy link
Member

stsewd commented Sep 26, 2018

This method Version.delete is not used in the codebase at all, so I'm not sure if this is a priority. I found that all the Versions are activated/deactivated but not deleted.

Actually, we delete the versions when syncing the versions

https://github.com/rtfd/readthedocs.org/blob/4fbe0afde6bd0fc9fc14baee79dd361d68f714cb/readthedocs/restapi/utils.py#L134-L154

https://github.com/rtfd/readthedocs.org/blob/4fbe0afde6bd0fc9fc14baee79dd361d68f714cb/readthedocs/restapi/views/model_views.py#L196-L196

I'm not sure about chaining the tasks. What I understand, is that we access to the versions from the symlink_project task, which is in a race condition with the deletion of the current version.

So at least that clear_artifacts is in a race condition with symlink_projects, we can just change the call order and that would be enough.

@agjohnson
Copy link
Contributor

which is in a race condition with the deletion of the current version.

What would the race condition here be? If we remove a version and try to symlink, does the symlink stay?

@stsewd
Copy link
Member

stsewd commented Sep 27, 2018

symlink_project access to all versions and a version is being deleted at the same time. So, probably the symlink would stay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Accepted issue on our roadmap Bug A bug
Projects
None yet
Development

No branches or pull requests

3 participants