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

ui, server: prevent decommissioned nodes from displaying in ui as live #86252

Merged
merged 1 commit into from
Aug 22, 2022

Conversation

Santamaura
Copy link
Contributor

@Santamaura Santamaura commented Aug 16, 2022

This change resolves an issue where decommissioned nodes would
in rare cases display as live in the admin ui. The changes
are on both the frontend and backend:

  • The ui has been changed so that the way live nodes are
    filtered is now based on MembershipStatus which matches
    the way decommissioned nodes are filtered.
  • The server now uses GetLivenessesFromKV instead of
    GetLivenesses because the latter retrieves livenesses
    known to gossip which could be stale reads from in-memory cache
    while the former is read directly from the KV layer.

Part of #85445

Release justification: low risk, high benefit changes to existing functionality.

Release note (ui change, api change): Filter live nodes based on
MembershipStatus and retrieve livenesses directly from kv.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@Santamaura Santamaura changed the title ui, server: prevent decommissioned nodes from displaying in ui ui, server: prevent decommissioned nodes from displaying in ui as live Aug 16, 2022
@Santamaura Santamaura marked this pull request as ready for review August 16, 2022 21:51
@Santamaura Santamaura requested a review from a team August 16, 2022 21:51
@Santamaura Santamaura requested a review from a team as a code owner August 16, 2022 21:51
Copy link
Collaborator

@koorosh koorosh left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @Santamaura and @zachlite)


pkg/server/admin.go line 2055 at r1 (raw file):

"known to gossip."
nit. Can you update comment to reflect current changes?


pkg/server/admin.go line 2066 at r1 (raw file):

		return nil, serverError(ctx, err)
	}
	livenesses, err := s.server.nodeLiveness.GetLivenessesFromKV(ctx)

We call GetLivenessesFromKV function twice (one time in getLivenessStatusMap func and also here). My concern that now it does hit KV layer instead of cached in-memory values. Can it be refactored to call this function once (Probably introduce auxiliary function that returns both liveness and livenessStatusMap)?

This change resolves an issue where decommissioned nodes would
in rare cases display as live in the admin ui. The changes
are on both the frontend and backend:
- The ui has been changed so that the way live nodes are
filtered is now based on MembershipStatus which matches
the way decommissioned nodes are filtered.
- The server now uses GetLivenessesFromKV instead of
GetLivenesses because the latter retrieves livenesses
known to gossip which could be stale reads from in-memory cache
while the former is read directly from the KV layer.

Release justification: low risk, high benefit changes to
existing functionality.

Release note (ui change, api change): Filter live nodes based on
MembershipStatus and retrieve livenesses directly from kv.
Copy link
Contributor Author

@Santamaura Santamaura left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @koorosh and @zachlite)


pkg/server/admin.go line 2055 at r1 (raw file):

Previously, koorosh (Andrii Vorobiov) wrote…

"known to gossip."
nit. Can you update comment to reflect current changes?

Done


pkg/server/admin.go line 2066 at r1 (raw file):

Previously, koorosh (Andrii Vorobiov) wrote…

We call GetLivenessesFromKV function twice (one time in getLivenessStatusMap func and also here). My concern that now it does hit KV layer instead of cached in-memory values. Can it be refactored to call this function once (Probably introduce auxiliary function that returns both liveness and livenessStatusMap)?

Done

Copy link
Collaborator

@koorosh koorosh left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @zachlite)

@Santamaura
Copy link
Contributor Author

bors r+

@Santamaura
Copy link
Contributor Author

bors cancel

@craig
Copy link
Contributor

craig bot commented Aug 18, 2022

Canceled.

Copy link
Collaborator

@nkodali nkodali left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 4 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @zachlite)

@Santamaura
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 19, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 19, 2022

Build failed (retrying...):

@Santamaura
Copy link
Contributor Author

bors retry

@craig
Copy link
Contributor

craig bot commented Aug 19, 2022

Already running a review

@craig
Copy link
Contributor

craig bot commented Aug 19, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 20, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 20, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Aug 20, 2022

Build failed:

@Santamaura
Copy link
Contributor Author

bors retry

@craig
Copy link
Contributor

craig bot commented Aug 22, 2022

Build succeeded:

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.

None yet

4 participants