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

Reuse node names when installing new k8s pods #398

Merged
merged 3 commits into from
May 15, 2023

Conversation

spilchen
Copy link
Collaborator

This corrects node name reuse when the operator installs new hosts in the admintools.conf. The old reuse logic was a bit too simple and could end up skip reusing a name under certain circumstances.

Note, there are two kinds of node names in vertica. The node name before a node is added to the cluster -- in the format of node####. And the vnode name, which is the name after its added to the cluster -- in the format of v__node####. This impacts only the first format.

@spilchen spilchen requested a review from roypaulin May 12, 2023 12:52
@spilchen spilchen self-assigned this May 12, 2023
// determines this by finding a free spot in the nodes slice.
func (f *FileWriter) getNextNodeNumber(nodes []bool) (nextNodeNumber int, newNodes []bool) {
for i := 0; i < len(nodes); i++ {
if !nodes[i] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand what's going on here. Same for buildNodeSlice(). I get what you are trying to do, but not the implementation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are picking the next available node number based on nodes[]. We update this slice as we go, which may involve extending it, so we always return a new copy of nodes[].

Any suggestions on how I can make it easier to understand?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think some "why" comments in buildNodeSlice() and getNextNodeNumber() would help. Especially where you extend the slice. And maybe adding, in buildNodeSlice() description, what we are going to do with the slice.

Copy link
Collaborator

@roypaulin roypaulin 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!

@spilchen spilchen merged commit a3ea8f5 into vertica:main May 15, 2023
@spilchen spilchen deleted the node-name-reuse branch May 15, 2023 12:20
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