Skip to content

[server] Always GC snapshots for workspaces #13121

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

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Sep 20, 2022

Description

Those snapshots would not be accessible anyway after we've garbage collected the Workspace.

Related Issue(s)

Fixes #

How to test

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@easyCZ easyCZ requested a review from a team September 20, 2022 11:36
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Sep 20, 2022
@@ -69,8 +69,7 @@ export class WorkspaceDeletionService {
const span = TraceContext.startSpan("garbageCollectWorkspace", ctx);

try {
const deleteSnapshots = ws.softDeleted === "user";
Copy link
Member Author

Choose a reason for hiding this comment

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

Look at git history, this has been there since the initial gitpod public repo commit.

@geropl
Copy link
Member

geropl commented Sep 20, 2022

Those snapshots would not be accessible anyway after we've garbage collected the Workspace.

Note that this is not true: As long as you have a snapshot link is still expected to work. 😕

A complete fix for this would be to promote the "snapshot" concept to be user-manageable: #11968

💡 The biggest problem is that snapshots "silently" stop working when their parent workspace gets GC'ed. We could try to work-around that by using the concept of "pinned" workspace. Those are excluded from GC. Whenever we createSnapshot, we could pin the underlying workspace.
We could even think about marking it as "pinnedForSnapshot", for maybe that's not necessary.

WDYT?

@easyCZ
Copy link
Member Author

easyCZ commented Sep 20, 2022

/hold for discussion

This is a bit more out of my immediate context so not really sure what the best solution here is so happy to follow your lead.
I'm somewhat unhappy with how scattered our Workspace Lifecycle handling is, including the GC. This feels more as a structural problem than a logic one :)

I mostly put up the PR as a drive-by but happy to leave it as is.

@svenefftinge
Copy link
Member

svenefftinge commented Sep 23, 2022

I agree with @geropl that we need to surface snapshot handling more in the dashboard, but as it stands this change seem to make sense, as we can't start workspaces for snapshots where the workspace was deleted [code]. So whould we merge this change and continue the more general discussion in #11968?

@geropl
Copy link
Member

geropl commented Sep 23, 2022

as we can't start workspaces for snapshots where the workspace was deleted [code]

Whoops, that's news to me. Thanks for digging it out!

@easyCZ let's un-hold 👍

@easyCZ
Copy link
Member Author

easyCZ commented Sep 23, 2022

/unhold

Copy link
Contributor

@jankeromnes jankeromnes left a comment

Choose a reason for hiding this comment

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

After the insightful discussion, this code change looks good to me, thanks! (Had already started to review yesterday, but held off due to being uncertain about snapshot vs deleted workspace behavior.)

as we can't start workspaces for snapshots where the workspace was deleted [code]

Whoops, that's news to me. Thanks for digging it out!

This was also news to me too. Many thanks for linking to the code. 🙏

@@ -69,8 +69,7 @@ export class WorkspaceDeletionService {
const span = TraceContext.startSpan("garbageCollectWorkspace", ctx);

try {
const deleteSnapshots = ws.softDeleted === "user";
const successfulDeleted = await this.deleteWorkspaceStorage({ span }, ws, deleteSnapshots);
const successfulDeleted = await this.deleteWorkspaceStorage({ span }, ws, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

On a side note, this.deleteWorkspaceStorage could be refactored to not take a 3rd argument that's always true.

@roboquat roboquat merged commit 72ff293 into main Sep 23, 2022
@roboquat roboquat deleted the mp/server-gc-workspace-storage branch September 23, 2022 09:18
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/XS team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants