Skip to content

Commit

Permalink
kv: Don't heartbeat transactions that are lacking an anchor key
Browse files Browse the repository at this point in the history
When running TPC-C 10k on a 30 node cluster without partitioning, range
1 was receiving thousands of qps while all other ranges were receiving
no more than low hundreds of qps (more details in cockroachdb#26608. Part of it was
context cancellations causing range descriptors to be evicted from the
range cache (cockroachdb#26764), but an even bigger part of it was HeartbeatTxns
being sent for transactions with no anchor key, accounting for thousands
of QPS even after cockroachdb#26764 was fixed.

This causes the same outcome as the old code without the load, because
without this change we'd just send the request and get back a
REASON_TXN_NOT_FOUND error, which would cause the function to return
true.

It's possible that we should instead avoid the heartbeat loop at all for
transactions without a key, or that we should put in more effort to
prevent such requests from even counting as transactions (a la cockroachdb#26741,
which perhaps makes this change unnecessary?). Advice would be great.

Release note: None
  • Loading branch information
a-robinson committed Jun 16, 2018
1 parent b3f1d17 commit 05156f0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kv/txn_coord_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,10 @@ func (tc *TxnCoordSender) heartbeat(ctx context.Context) bool {
return false
}

if txn.Key == nil {
return true
}

ba := roachpb.BatchRequest{}
ba.Txn = &txn

Expand Down

0 comments on commit 05156f0

Please sign in to comment.