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

kvserver: instrument RaftTransport workers with pprof labels #85909

Merged
merged 1 commit into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pkg/kv/kvserver/raft_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package kvserver
import (
"context"
"net"
"runtime/pprof"
"time"
"unsafe"

Expand Down Expand Up @@ -373,10 +374,7 @@ func (t *RaftTransport) Stop(storeID roachpb.StoreID) {
// lost and a new instance of processQueue will be started by the next message
// to be sent.
func (t *RaftTransport) processQueue(
nodeID roachpb.NodeID,
ch chan *kvserverpb.RaftMessageRequest,
stream MultiRaft_RaftMessageBatchClient,
class rpc.ConnectionClass,
ch chan *kvserverpb.RaftMessageRequest, stream MultiRaft_RaftMessageBatchClient,
) error {
errCh := make(chan error, 1)

Expand Down Expand Up @@ -566,11 +564,14 @@ func (t *RaftTransport) startProcessNewQueue(
return
}

if err := t.processQueue(toNodeID, ch, stream, class); err != nil {
if err := t.processQueue(ch, stream); err != nil {
log.Warningf(ctx, "while processing outgoing Raft queue to node %d: %s:", toNodeID, err)
}
}
err := t.stopper.RunAsyncTask(ctx, "storage.RaftTransport: sending messages", worker)
err := t.stopper.RunAsyncTask(ctx, "storage.RaftTransport: sending/receiving messages",
func(ctx context.Context) {
pav-kv marked this conversation as resolved.
Show resolved Hide resolved
pprof.Do(ctx, pprof.Labels("remote_node_id", toNodeID.String()), worker)
})
if err != nil {
t.queues[class].Delete(int64(toNodeID))
return false
Expand Down