Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
128003: server: add LeadSupportUntil to RaftState r=nvanbenschoten a=nvanbenschoten

Part of cockroachdb#125240.

This commit adds the new `LeadSupportUntil` field to the `serverpb.RaftState` proto, which is surfaced in a few places in the DB console.

Release note: None

128005: buildutil: allow `disallowed_imports_test` to execute remotely r=rail a=rickystewart

This has been tagged as `local` since it existed, apparently for no reason.

Epic: none
Release note: None
Release justification: Test-only code changes

Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Ricky Stewart <[email protected]>
  • Loading branch information
3 people committed Jul 31, 2024
3 parents 548c0d4 + f99fa7e + 8556bb3 commit 0aaf45c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
9 changes: 6 additions & 3 deletions docs/generated/http/full.md
Original file line number Diff line number Diff line change
Expand Up @@ -1267,11 +1267,12 @@ Closely mirrors the upstream definitions in github.com/etcd-io/raft.
| ----- | ---- | ----- | ----------- | -------------- |
| replica_id | [uint64](#cockroach.server.serverpb.RaftDebugResponse-uint64) | | | [reserved](#support-status) |
| hard_state | [raftpb.HardState](#cockroach.server.serverpb.RaftDebugResponse-raftpb.HardState) | | | [reserved](#support-status) |
| lead | [uint64](#cockroach.server.serverpb.RaftDebugResponse-uint64) | | Lead is part of Raft's SoftState. | [reserved](#support-status) |
| lead | [uint64](#cockroach.server.serverpb.RaftDebugResponse-uint64) | | Lead is part of Raft's HardState. However, it used to be part of SoftState, so we keep it here as a separate field for compatibility. | [reserved](#support-status) |
| state | [string](#cockroach.server.serverpb.RaftDebugResponse-string) | | State is part of Raft's SoftState. It's not an enum because this is primarily for ui consumption and there are issues associated with them. | [reserved](#support-status) |
| applied | [uint64](#cockroach.server.serverpb.RaftDebugResponse-uint64) | | | [reserved](#support-status) |
| progress | [RaftState.ProgressEntry](#cockroach.server.serverpb.RaftDebugResponse-cockroach.server.serverpb.RaftState.ProgressEntry) | repeated | | [reserved](#support-status) |
| lead_transferee | [uint64](#cockroach.server.serverpb.RaftDebugResponse-uint64) | | | [reserved](#support-status) |
| lead_support_until | [cockroach.util.hlc.Timestamp](#cockroach.server.serverpb.RaftDebugResponse-cockroach.util.hlc.Timestamp) | | | [reserved](#support-status) |



Expand Down Expand Up @@ -1515,11 +1516,12 @@ Closely mirrors the upstream definitions in github.com/etcd-io/raft.
| ----- | ---- | ----- | ----------- | -------------- |
| replica_id | [uint64](#cockroach.server.serverpb.RangesResponse-uint64) | | | [reserved](#support-status) |
| hard_state | [raftpb.HardState](#cockroach.server.serverpb.RangesResponse-raftpb.HardState) | | | [reserved](#support-status) |
| lead | [uint64](#cockroach.server.serverpb.RangesResponse-uint64) | | Lead is part of Raft's SoftState. | [reserved](#support-status) |
| lead | [uint64](#cockroach.server.serverpb.RangesResponse-uint64) | | Lead is part of Raft's HardState. However, it used to be part of SoftState, so we keep it here as a separate field for compatibility. | [reserved](#support-status) |
| state | [string](#cockroach.server.serverpb.RangesResponse-string) | | State is part of Raft's SoftState. It's not an enum because this is primarily for ui consumption and there are issues associated with them. | [reserved](#support-status) |
| applied | [uint64](#cockroach.server.serverpb.RangesResponse-uint64) | | | [reserved](#support-status) |
| progress | [RaftState.ProgressEntry](#cockroach.server.serverpb.RangesResponse-cockroach.server.serverpb.RaftState.ProgressEntry) | repeated | | [reserved](#support-status) |
| lead_transferee | [uint64](#cockroach.server.serverpb.RangesResponse-uint64) | | | [reserved](#support-status) |
| lead_support_until | [cockroach.util.hlc.Timestamp](#cockroach.server.serverpb.RangesResponse-cockroach.util.hlc.Timestamp) | | | [reserved](#support-status) |



Expand Down Expand Up @@ -3895,11 +3897,12 @@ Closely mirrors the upstream definitions in github.com/etcd-io/raft.
| ----- | ---- | ----- | ----------- | -------------- |
| replica_id | [uint64](#cockroach.server.serverpb.RangeResponse-uint64) | | | [reserved](#support-status) |
| hard_state | [raftpb.HardState](#cockroach.server.serverpb.RangeResponse-raftpb.HardState) | | | [reserved](#support-status) |
| lead | [uint64](#cockroach.server.serverpb.RangeResponse-uint64) | | Lead is part of Raft's SoftState. | [reserved](#support-status) |
| lead | [uint64](#cockroach.server.serverpb.RangeResponse-uint64) | | Lead is part of Raft's HardState. However, it used to be part of SoftState, so we keep it here as a separate field for compatibility. | [reserved](#support-status) |
| state | [string](#cockroach.server.serverpb.RangeResponse-string) | | State is part of Raft's SoftState. It's not an enum because this is primarily for ui consumption and there are issues associated with them. | [reserved](#support-status) |
| applied | [uint64](#cockroach.server.serverpb.RangeResponse-uint64) | | | [reserved](#support-status) |
| progress | [RaftState.ProgressEntry](#cockroach.server.serverpb.RangeResponse-cockroach.server.serverpb.RaftState.ProgressEntry) | repeated | | [reserved](#support-status) |
| lead_transferee | [uint64](#cockroach.server.serverpb.RangeResponse-uint64) | | | [reserved](#support-status) |
| lead_support_until | [cockroach.util.hlc.Timestamp](#cockroach.server.serverpb.RangeResponse-cockroach.util.hlc.Timestamp) | | | [reserved](#support-status) |



Expand Down
2 changes: 2 additions & 0 deletions pkg/server/serverpb/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ proto_library(
"//pkg/storage/enginepb:enginepb_proto",
"//pkg/ts/catalog:catalog_proto",
"//pkg/util:util_proto",
"//pkg/util/hlc:hlc_proto",
"//pkg/util/log/logpb:logpb_proto",
"//pkg/util/metric:metric_proto",
"//pkg/util/tracing/tracingpb:tracingpb_proto",
Expand Down Expand Up @@ -82,6 +83,7 @@ go_proto_library(
"//pkg/storage/enginepb",
"//pkg/ts/catalog",
"//pkg/util",
"//pkg/util/hlc",
"//pkg/util/log/logpb",
"//pkg/util/metric",
"//pkg/util/tracing/tracingpb",
Expand Down
5 changes: 4 additions & 1 deletion pkg/server/serverpb/status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import "storage/enginepb/rocksdb.proto";
import "kv/kvserver/kvserverpb/lease_status.proto";
import "kv/kvserver/kvserverpb/state.proto";
import "kv/kvserver/liveness/livenesspb/liveness.proto";
import "util/hlc/timestamp.proto";
import "util/log/logpb/log.proto";
import "util/unresolved_addr.proto";
import "util/tracing/tracingpb/tracing.proto";
Expand Down Expand Up @@ -376,7 +377,8 @@ message RaftState {

uint64 replica_id = 1 [ (gogoproto.customname) = "ReplicaID" ];
raftpb.HardState hard_state = 2 [ (gogoproto.nullable) = false ];
// Lead is part of Raft's SoftState.
// Lead is part of Raft's HardState. However, it used to be part of SoftState,
// so we keep it here as a separate field for compatibility.
uint64 lead = 3 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/raft/raftpb.PeerID"];
// State is part of Raft's SoftState.
// It's not an enum because this is primarily for ui consumption and there
Expand All @@ -385,6 +387,7 @@ message RaftState {
uint64 applied = 5;
map<uint64, Progress> progress = 6 [ (gogoproto.nullable) = false ];
uint64 lead_transferee = 7 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/raft/raftpb.PeerID"];
util.hlc.Timestamp lead_support_until = 8 [(gogoproto.nullable) = false];
}

// RangeProblems describes issues reported by a range. For internal use only.
Expand Down
15 changes: 8 additions & 7 deletions pkg/server/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -2413,13 +2413,14 @@ func (s *systemStatusServer) rangesHelper(
}

state := serverpb.RaftState{
ReplicaID: uint64(raftStatus.ID),
HardState: raftStatus.HardState,
Applied: raftStatus.Applied,
Lead: raftStatus.Lead,
State: raftStatus.RaftState.String(),
Progress: make(map[uint64]serverpb.RaftState_Progress),
LeadTransferee: raftStatus.LeadTransferee,
ReplicaID: uint64(raftStatus.ID),
HardState: raftStatus.HardState,
Applied: raftStatus.Applied,
Lead: raftStatus.Lead,
State: raftStatus.RaftState.String(),
Progress: make(map[uint64]serverpb.RaftState_Progress),
LeadTransferee: raftStatus.LeadTransferee,
LeadSupportUntil: raftStatus.LeadSupportUntil,
}

for id, progress := range raftStatus.Progress {
Expand Down
1 change: 0 additions & 1 deletion pkg/testutils/buildutil/buildutil.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,4 @@ def disallowed_imports_test(
name = src.strip(":") + "_disallowed_imports_test",
size = "small",
srcs = [":" + script],
tags = ["local"],
)

0 comments on commit 0aaf45c

Please sign in to comment.