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

raft: add MsgFortify and MsgFortifyResp #125261

Closed
arulajmani opened this issue Jun 6, 2024 · 1 comment · Fixed by #128984
Closed

raft: add MsgFortify and MsgFortifyResp #125261

arulajmani opened this issue Jun 6, 2024 · 1 comment · Fixed by #128984
Assignees
Labels
A-kv Anything in KV that doesn't belong in a more specific category. A-kv-replication Relating to Raft, consensus, and coordination. A-leader-leases Related to the introduction of leader leases C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-kv KV Team

Comments

@arulajmani
Copy link
Collaborator

arulajmani commented Jun 6, 2024

Part of #123847

For leader leases, leaders need the ability to fortify their leadership by sending out MsgFortify requests. Followers are expected to provide/decline fortification support for leaders using MsgFortifyResponse based on whether or not they support the leader's store in store liveness.

Jira issue: CRDB-39352

Epic CRDB-37522

@arulajmani arulajmani added C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) A-kv-replication Relating to Raft, consensus, and coordination. A-kv Anything in KV that doesn't belong in a more specific category. A-leader-leases Related to the introduction of leader leases labels Jun 6, 2024
Copy link

blathers-crl bot commented Jun 6, 2024

cc @cockroachdb/replication

@arulajmani arulajmani self-assigned this Jun 20, 2024
@exalate-issue-sync exalate-issue-sync bot added T-kv KV Team and removed T-kv-replication labels Jun 28, 2024
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 7, 2024
This commit adds two new messages to raft -- MsgFortifyLeader and
MsgFortifyLeaderResp. A candidate attempts to fortify its leadership
term after winning an election. It does so by broadcasting a
MsgFortifyLeader to all followers.

Currently, the handling of MsgFortify is a no-op; requests are trivially
rejected. In subsequent patches, we'll hook into store liveness and
correctly respond.

Informs cockroachdb#125261

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 7, 2024
This commit adds two new messages to raft -- MsgFortifyLeader and
MsgFortifyLeaderResp. A candidate attempts to fortify its leadership
term after winning an election. It does so by broadcasting a
MsgFortifyLeader to all followers.

Currently, the handling of MsgFortify is a no-op; requests are trivially
rejected. In subsequent patches, we'll hook into store liveness and
correctly respond.

While here, we also add metrics for MsgFortify and MsgFortifyResp.

Informs cockroachdb#125261
Closes cockroachdb#124498

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 7, 2024
This commit adds two new messages to raft -- MsgFortifyLeader and
MsgFortifyLeaderResp. A candidate attempts to fortify its leadership
term after winning an election. It does so by broadcasting a
MsgFortifyLeader to all followers.

Currently, the handling of MsgFortify is a no-op; requests are trivially
rejected. In subsequent patches, we'll hook into store liveness and
correctly respond.

While here, we also add metrics for MsgFortify and MsgFortifyResp.

Informs cockroachdb#125261
Closes cockroachdb#124498

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 7, 2024
This commit adds two new messages to raft -- MsgFortifyLeader and
MsgFortifyLeaderResp. A candidate attempts to fortify its leadership
term after winning an election. It does so by broadcasting a
MsgFortifyLeader to all followers.

Currently, the handling of MsgFortify is a no-op; requests are trivially
rejected. In subsequent patches, we'll hook into store liveness and
correctly respond.

While here, we also add metrics for MsgFortify and MsgFortifyResp.

Informs cockroachdb#125261
Closes cockroachdb#124498

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 8, 2024
This commit adds two new messages to raft -- MsgFortifyLeader and
MsgFortifyLeaderResp. A candidate attempts to fortify its leadership
term after winning an election. It does so by broadcasting a
MsgFortifyLeader to all followers. Fow now, the broadcast is a no-op;
we'll meaningfully implement it in an upcoming patch.

Informs cockroachdb#125261

Release note: None
craig bot pushed a commit that referenced this issue Aug 8, 2024
128426: raft: add no-op MsgFortifyLeader and MsgFortifyLeaderResp  r=nvanbenschoten a=arulajmani

See individual commits

----

This commit adds two new messages to raft -- MsgFortifyLeader and
MsgFortifyLeaderResp. A candidate attempts to fortify its leadership
term after winning an election. It does so by broadcasting a
MsgFortifyLeader to all followers.

Currently, the handling of MsgFortify is a no-op; requests are trivially
rejected. In subsequent patches, we'll hook into store liveness and
correctly respond.

Informs #125261

Release note: None

Co-authored-by: Arul Ajmani <[email protected]>
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 9, 2024
With this patch, raft leaders broadcast a MsgFortifyLeader to all peers
after being successfully elected as leader. We added most of the
structure for this in
cockroachdb#128426. However, we never
actually sent messages to fortify leadership because doing so needed to
be predicated on a cluster version check. This patch simply adds the
cluster version check and updates tests.

We're not handling MsgFortifyLeader or MsgFortifyLeaderResp just yet.
That'll happen in a subsequent patch.

Informs cockroachdb#125261

Release note: None
craig bot pushed a commit that referenced this issue Aug 9, 2024
128647: raft: start sending MsgFortify requests on becoming leader r=nvanbenschoten a=arulajmani

With this patch, raft leaders broadcast a MsgFortifyLeader to all peers
after being successfully elected as leader. We added most of the
structure for this in
#128426. However, we never
actually sent messages to fortify leadership because doing so needed to
be predicated on a cluster version check. This patch simply adds the
cluster version check and updates tests.

We're not handling MsgFortifyLeader or MsgFortifyLeaderResp just yet.
That'll happen in a subsequent patch.

Informs #125261

Release note: None

Co-authored-by: Arul Ajmani <[email protected]>
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 12, 2024
This patch partially implements the handling of MsgFortify on peers.
In particular, peers (including the leader) now check whether they
support the leader when handling a fortification request. They persist
the leadEpoch from the StoreLiveness fabric if they do. For now, the
fortification request is trivially rejected regardless; this will change
shortly.

Most of this patch is building out some of the test infra we'll use to
set up the underlying StoreLiveness fabric.

Informs cockroachdb#125261

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 13, 2024
This patch partially implements the handling of MsgFortify on peers.
In particular, peers (including the leader) now check whether they
support the leader when handling a fortification request. They persist
the leadEpoch from the StoreLiveness fabric if they do. For now, the
fortification request is trivially rejected regardless; this will change
shortly.

Most of this patch is building out some of the test infra we'll use to
set up the underlying StoreLiveness fabric.

Informs cockroachdb#125261

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 13, 2024
This patch partially implements the handling of MsgFortify on peers.
In particular, peers (including the leader) now check whether they
support the leader when handling a fortification request. They persist
the leadEpoch from the StoreLiveness fabric if they do. For now, the
fortification request is trivially rejected regardless; this will change
shortly.

Most of this patch is building out some of the test infra we'll use to
set up the underlying StoreLiveness fabric.

Informs cockroachdb#125261

Release note: None
arulajmani added a commit to arulajmani/cockroach that referenced this issue Aug 14, 2024
This patch partially implements the handling of MsgFortify on peers.
In particular, peers (including the leader) now check whether they
support the leader when handling a fortification request. They persist
the leadEpoch from the StoreLiveness fabric if they do. For now, the
fortification request is trivially rejected regardless; this will change
shortly.

Most of this patch is building out some of the test infra we'll use to
set up the underlying StoreLiveness fabric.

Informs cockroachdb#125261

Release note: None
craig bot pushed a commit that referenced this issue Aug 14, 2024
128845: raft: update LeadEpoch in response to MsgFortify  r=nvanbenschoten a=arulajmani

This patch partially implements the handling of MsgFortify on peers.
In particular, peers (including the leader) now check whether they
support the leader when handling a fortification request. They persist
the leadEpoch from the StoreLiveness fabric if they do. For now, the
fortification request is trivially rejected regardless; this will change
shortly.

Most of this patch is building out some of the test infra we'll use to
set up the underlying StoreLiveness fabric.

Informs #125261

Release note: None

Co-authored-by: Arul Ajmani <[email protected]>
craig bot pushed a commit that referenced this issue Aug 14, 2024
128935: sql/sem/builtins: validate engine keys in storage builtins r=RaduBerinde a=jbowens

Ensure that the user-provided engine keys are valid before using them to seek,
in storage's SQL builtins.  The Comparer will now panic if there's an attempt
to compare using an invalid key. These built-ins now attempt to decode and
validate the keys as engine keys. If they validate, it uses them as-is.
Otherwise it encodes them as version-less keys.

Epic: none
Fix #128757.
Release note: none

128984: raft: consult StoreLiveness when handling MsgFortify r=nvanbenschoten a=arulajmani

Previously, we were always rejecting fortification requests. This patch correctly returns a fortification response by including the leader's supported store liveness epcoh in the MsgFortifyLeaderResp if the follower supports the leader in its StoreLiveness fabric.

Closes #125261

Release note: None

Co-authored-by: Jackson Owens <[email protected]>
Co-authored-by: Arul Ajmani <[email protected]>
@craig craig bot closed this as completed in 1a0a4c9 Aug 14, 2024
@github-project-automation github-project-automation bot moved this to Incoming in KV Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-kv Anything in KV that doesn't belong in a more specific category. A-kv-replication Relating to Raft, consensus, and coordination. A-leader-leases Related to the introduction of leader leases C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) T-kv KV Team
Projects
No open projects
Status: Incoming
Development

Successfully merging a pull request may close this issue.

1 participant