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

Version sync: exclude external versions when deleting #7742

Merged
merged 1 commit into from Dec 14, 2020

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Dec 9, 2020

We weren't hitting this before bc we were excluding active versions.
But now, external versions can also be inactive.

Close #7738

@stsewd stsewd requested a review from a team December 9, 2020 23:01
Copy link
Member

@humitos humitos left a comment

Choose a reason for hiding this comment

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

I'm not sure to understand what's the issue we want to fix here. What was happening? What should happen? What are these scenarios?

Also, I think this should have a test so we don't hit this again and we are sure that we are doing what we expect here.

@stsewd
Copy link
Member Author

stsewd commented Dec 10, 2020

I'm not sure to understand what's the issue we want to fix here. What was happening? What should happen? What are these scenarios?

The problem is explained in the linked issue, when a PR is closed and the branch is deleted we delete the external version, but we need to keep it. I'll add a test.

We weren't hitting this before bc we were excluding active versions.
But now, external versions can also be inactive.
@stsewd stsewd requested a review from a team December 10, 2020 15:05
@ericholscher
Copy link
Member

@stsewd hrm, this is tricky. It makes me think that we probably want to keep Version objects around for non-external versions too? I feel like we probably want to think more about this, and not delete any versions that have Builds, or that are active or built? Keeping external versions around but deleting normal versions in the same situation feels weird.

@stsewd
Copy link
Member Author

stsewd commented Dec 14, 2020

It makes me think that we probably want to keep Version objects around for non-external versions too?

We want to keep the build log of normal versions, keeping the versions will lead to have weird slugs like v2_a, this doesn't happen in PRs as the identifier (PR number) is unique.

I feel like we probably want to think more about this, and not delete any versions that have Builds, or that are active or built?

This doesn't delete active versions, only inactive ones.

to_delete_qs = (
_get_deleted_versions_qs(project, version_data)
.exclude(active=True)
)

@ericholscher
Copy link
Member

So external versions are not marked as active when they are built? Or is there some other bug that is causing this? I don't fully understand why this behavior is only necessary for external versions.

@stsewd
Copy link
Member Author

stsewd commented Dec 14, 2020

So external versions are not marked as active when they are built? Or is there some other bug that is causing this? I don't fully understand why this behavior is only necessary for external versions.

External versions are marked as active and built as normal versions, but we want to delete external version after 90 days, not immediately, so we exclude external versions from this query set

@ericholscher
Copy link
Member

ericholscher commented Dec 14, 2020

Sure, but won't we still end up deleting normal versions that have Build's? The goal is to never delete those Build objects, and to remove the files from storage once they are deleted. So the proposed logic is this?:

  • PR builds will have Version objects 90 days after the branch is deleted, then we will remove the Version, and also delete th files from storage. Build objects for these will last forever?
  • Normal builds will delete Version objects immediately upon the branch being deleted, including removing all updated files, and Build objects?

@stsewd
Copy link
Member Author

stsewd commented Dec 14, 2020

@ericholscher we want to keep build logs for both, but that's another PR #7679, this is to fix a bug in the first part of the implementation (delete external versions after 90 days)

@stsewd stsewd merged commit f50003e into master Dec 14, 2020
3 checks passed
@stsewd stsewd deleted the exclude-external-versions branch December 14, 2020 19:19
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.

External versions are being deleted when the branch is deleted
3 participants