Skip to content

Commit 95ad271

Browse files
committed
kv: add more tracing on the commit path
References #148523 Epic: none Release note: None
1 parent 1fc8830 commit 95ad271

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/kv/kvclient/kvcoord/dist_sender.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,7 @@ func (ds *DistSender) divideAndSendParallelCommit(
14721472
}
14731473
if swapIdx == -1 {
14741474
// No pre-commit QueryIntents. Nothing to split.
1475+
log.VEvent(ctx, 3, "no pre-commit QueryIntents found, sending batch as-is")
14751476
return ds.divideAndSendBatchToRanges(ctx, ba, rs, isReverse, true /* withCommit */, batchIdx)
14761477
}
14771478

@@ -1504,6 +1505,7 @@ func (ds *DistSender) divideAndSendParallelCommit(
15041505
qiResponseCh := make(chan response, 1)
15051506

15061507
sendPreCommit := func(ctx context.Context) {
1508+
log.VEvent(ctx, 3, "sending split out pre-commit QueryIntent batch")
15071509
// Map response index to the original un-swapped batch index.
15081510
// Remember that we moved the last QueryIntent in this batch
15091511
// from swapIdx to the end.
@@ -1562,7 +1564,9 @@ func (ds *DistSender) divideAndSendParallelCommit(
15621564

15631565
// Wait for the QueryIntent-only batch to complete and stitch
15641566
// the responses together.
1567+
log.VEvent(ctx, 3, "waiting for pre-commit QueryIntent batch response")
15651568
qiReply := <-qiResponseCh
1569+
log.VEventf(ctx, 3, "received pre-commit QueryIntent batch response")
15661570

15671571
// Handle error conditions.
15681572
if pErr != nil {

pkg/kv/kvclient/kvcoord/txn_interceptor_committer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ func (tc *txnCommitter) SendLocked(
195195
// so interceptors above the txnCommitter in the stack don't need to be
196196
// made aware that the record is staging.
197197
pErr = maybeRemoveStagingStatusInErr(pErr)
198+
log.VEventf(ctx, 2, "batch with EndTxn(commit=true) failed: %v", pErr)
198199
return nil, pErr
199200
}
200201

@@ -216,6 +217,7 @@ func (tc *txnCommitter) SendLocked(
216217
// the EndTxn request, either because canCommitInParallel returned false
217218
// or because there were no unproven in-flight writes (see txnPipeliner)
218219
// and there were no writes in the batch request.
220+
log.VEventf(ctx, 2, "parallel commit attempt for transaction %s resulted in explicit commit", br.Txn)
219221
return br, nil
220222
default:
221223
return nil, kvpb.NewErrorf("unexpected response status without error: %v", br.Txn)
@@ -296,6 +298,8 @@ func (tc *txnCommitter) validateEndTxnBatch(ba *kvpb.BatchRequest) error {
296298
func (tc *txnCommitter) sendLockedWithElidedEndTxn(
297299
ctx context.Context, ba *kvpb.BatchRequest, et *kvpb.EndTxnRequest,
298300
) (br *kvpb.BatchResponse, pErr *kvpb.Error) {
301+
log.VEventf(ctx, 2, "eliding EndTxn request for read-only, non-locking transaction")
302+
299303
// Send the batch without its final request, which we know to be the EndTxn
300304
// request that we're eliding. If this would result in us sending an empty
301305
// batch, mock out a reply instead of sending anything.

0 commit comments

Comments
 (0)