Skip to content

Commit

Permalink
Merge pull request cockroachdb#58500 from andreimatei/revert-backport…
Browse files Browse the repository at this point in the history
…-leader-lease

Revert "kvserver: don't allow raft forwarding of lease requests"
  • Loading branch information
andreimatei authored Jan 6, 2021
2 parents e8d950a + 49c8337 commit 9aaec62
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 558 deletions.
13 changes: 2 additions & 11 deletions pkg/kv/kvserver/client_raft_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package kvserver_test

import (
"context"
"fmt"

"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/roachpb"
Expand All @@ -23,9 +22,7 @@ import (
)

type unreliableRaftHandlerFuncs struct {
// If non-nil, can return false to avoid dropping the msg to
// unreliableRaftHandler.rangeID. If nil, all messages pertaining to the
// respective range are dropped.
// If non-nil, can return false to avoid dropping a msg to rangeID.
dropReq func(*kvserver.RaftMessageRequest) bool
dropHB func(*kvserver.RaftHeartbeat) bool
dropResp func(*kvserver.RaftMessageResponse) bool
Expand All @@ -50,7 +47,6 @@ func noopRaftHandlerFuncs() unreliableRaftHandlerFuncs {
// unreliableRaftHandler drops all Raft messages that are addressed to the
// specified rangeID, but lets all other messages through.
type unreliableRaftHandler struct {
name string
rangeID roachpb.RangeID
kvserver.RaftMessageHandler
unreliableRaftHandlerFuncs
Expand All @@ -72,14 +68,9 @@ func (h *unreliableRaftHandler) HandleRaftRequest(
}
} else if req.RangeID == h.rangeID {
if h.dropReq == nil || h.dropReq(req) {
var prefix string
if h.name != "" {
prefix = fmt.Sprintf("[%s] ", h.name)
}
log.Infof(
ctx,
"%sdropping r%d Raft message %s",
prefix,
"dropping r%d Raft message %s",
req.RangeID,
raft.DescribeMessage(req.Message, func([]byte) string {
return "<omitted>"
Expand Down
Loading

0 comments on commit 9aaec62

Please sign in to comment.