hashicorp / hashicorp/memberlist

Checking the state of the Node in NotifyLeave

Open
#293 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
4.1k
Forks
478
Avg merge
15h 58m
Merged PRs (30d)
3

Description

I would like to check whether the service was stopped gracefully in `NotifyLeave`. The callback accepts a `Node` with a `State` field, but it is always equal to `StateAlive`.

Having looked at the code, I believe that the problem is that the `State` field is simultaneously declared in both `Node` and `nodeState` structs, while `Node` is nested in `nodeState`. Could someone explain if there are reasons to do this?

I see several solutions, but unfortunately they are not backwards compatible:
- add a getter and setter for `nodeState`, which will also change `Node.State`. At the same time, make the `State` field private.
- remove `State` field from `nodeState`
- remove the `State` field from `Node`, and add a separate parameter with the state to `NotifyLeave`

Contributor guide

Open the contributing guide

Research direction

Start with NotifyLeave and the Node and nodeState definitions, then trace how State is populated before the callback. Confirm why the callback observes StateAlive and review the backwards-compatibility impact of the proposed API directions; done requires an agreed resolution to the state-reporting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.