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

Remove sandbox and subclusters from vdb at the same time #959

Merged
merged 8 commits into from
Oct 17, 2024

Conversation

roypaulin
Copy link
Collaborator

This fixes the issue that happens when you remove a sandbox and all its subclusters at the same time from the vdb, the pods will be down but will never get deleted.
Now, as soon as unsandbox is done the operator will find the statefulset make it rejoin the main cluster where it will be removed.

vdb.Spec.Subclusters = vdb.Spec.Subclusters[1:]
vdb.Spec.Subclusters = vdb.Spec.Subclusters[:2]
scNames = append(scNames[0:1], scNames[3])
verifySubclusters(ctx, vdb, scNames, []int32{0, 0}, sbName, FindNotInVdbAcrossSandboxes)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the size is set to {0, 0}?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because when the operator constructs subclusters no longer in vdb from their statefulsets, it gives them size 0 as they will soon be removed.

// find subclusters that are sandboxed in old vdb but removed in new vdb
// checkSandboxSubclustersRemoved checks subclusters that are sandboxed in old vdb but removed in new vdb
func (v *VerticaDB) checkSandboxSubclustersRemoved(allErrs field.ErrorList, oldObj *VerticaDB, oldScIndexMap map[string]int,
oldScMap, newScMap map[string]*Subcluster, path *field.Path) field.ErrorList {
oldScInSandbox := oldObj.GenSubclusterSandboxMap()
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should modify this to: newScInSandbox := v.GenSubclusterSandboxMap(). Then in line 1647, verify the removed sc isn't in newScInSandbox. The check in line 1650(if v.GetSandbox(sb) == nil) is not accurate since the sc could be in a new sandbox of new vdb.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I see, I always add the impression that moving a subcluster from one sandbox to another would not work. Then I need to change my definition of zombie subcluster as it will also cover the case where sandbox still exists.

Copy link
Collaborator

@cchen-vertica cchen-vertica left a comment

Choose a reason for hiding this comment

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

In your next PR: you can remove the timeout you added in the e2e tests.

@roypaulin roypaulin merged commit 0870228 into main Oct 17, 2024
37 checks passed
@roypaulin roypaulin deleted the roypaulin/terminate branch October 17, 2024 16:14
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.

2 participants