Skip to content

Commit 3827686

Browse files
committed
kvclient: move all TxnCoordSender logs from Dev to KvExec
Epic: none Release note: None
1 parent 6f29e54 commit 3827686

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

pkg/kv/kvclient/kvcoord/txn_coord_sender.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,10 @@ func newRootTxnCoordSender(
239239
txn.AssertInitialized(context.TODO())
240240

241241
if txn.Status != roachpb.PENDING {
242-
log.Dev.Fatalf(context.TODO(), "unexpected non-pending txn in RootTransactionalSender: %s", txn)
242+
log.KvExec.Fatalf(context.TODO(), "unexpected non-pending txn in RootTransactionalSender: %s", txn)
243243
}
244244
if txn.Sequence != 0 {
245-
log.Dev.Fatalf(context.TODO(), "cannot initialize root txn with seq != 0: %s", txn)
245+
log.KvExec.Fatalf(context.TODO(), "cannot initialize root txn with seq != 0: %s", txn)
246246
}
247247

248248
tcs := &TxnCoordSender{
@@ -380,7 +380,7 @@ func newLeafTxnCoordSender(
380380
txn.AssertInitialized(context.TODO())
381381

382382
if txn.Status != roachpb.PENDING {
383-
log.Dev.Fatalf(context.TODO(), "unexpected non-pending txn in LeafTransactionalSender: %s", tis)
383+
log.KvExec.Fatalf(context.TODO(), "unexpected non-pending txn in LeafTransactionalSender: %s", tis)
384384
}
385385

386386
tcs := &TxnCoordSender{
@@ -537,7 +537,7 @@ func (tc *TxnCoordSender) Send(
537537

538538
// Associate the txnID with the trace.
539539
if tc.mu.txn.ID == (uuid.UUID{}) {
540-
log.Dev.Fatalf(ctx, "cannot send transactional request through unbound TxnCoordSender")
540+
log.KvExec.Fatalf(ctx, "cannot send transactional request through unbound TxnCoordSender")
541541
}
542542
if sp.IsVerbose() {
543543
sp.SetTag("txnID", attribute.StringValue(tc.mu.txn.ID.String()))
@@ -674,7 +674,7 @@ func (tc *TxnCoordSender) Send(
674674
// docs/RFCS/20200811_non_blocking_txns.md.
675675
func (tc *TxnCoordSender) maybeCommitWait(ctx context.Context, deferred bool) error {
676676
if tc.mu.txn.Status != roachpb.PREPARED && tc.mu.txn.Status != roachpb.COMMITTED {
677-
log.Dev.Fatalf(ctx, "maybeCommitWait called when not prepared/committed")
677+
log.KvExec.Fatalf(ctx, "maybeCommitWait called when not prepared/committed")
678678
}
679679
if tc.mu.commitWaitDeferred && !deferred {
680680
// If this is an automatic commit-wait call and the user of this
@@ -787,7 +787,7 @@ func (tc *TxnCoordSender) maybeRejectClientLocked(
787787
// unexpected for it to find the transaction already in a txnFinalized
788788
// state. This may be a bug, so log a stack trace.
789789
stack := debugutil.Stack()
790-
log.Dev.Errorf(ctx, "%s. stack:\n%s", msg, stack)
790+
log.KvExec.Errorf(ctx, "%s. stack:\n%s", msg, stack)
791791
}
792792
reason := kvpb.TransactionStatusError_REASON_UNKNOWN
793793
if tc.mu.txn.Status == roachpb.COMMITTED {
@@ -1028,7 +1028,7 @@ func (tc *TxnCoordSender) updateStateLocked(
10281028
if errTxnID != txnID {
10291029
// KV should not return errors for transactions other than the one in
10301030
// the BatchRequest.
1031-
log.Dev.Fatalf(ctx, "retryable error for the wrong txn. ba.Txn: %s. pErr: %s",
1031+
log.KvExec.Fatalf(ctx, "retryable error for the wrong txn. ba.Txn: %s. pErr: %s",
10321032
ba.Txn, pErr)
10331033
}
10341034
return kvpb.NewError(tc.handleRetryableErrLocked(ctx, pErr))
@@ -1095,7 +1095,7 @@ func sanityCheckErrWithTxn(
10951095
Detail: "you have encountered a known bug in CockroachDB, please consider " +
10961096
"reporting on the Github issue or reach out via Support.",
10971097
}))
1098-
log.Dev.Warningf(ctx, "%v", err)
1098+
log.KvExec.Warningf(ctx, "%v", err)
10991099
return err
11001100
}
11011101

@@ -1479,7 +1479,7 @@ func (tc *TxnCoordSender) UpdateRootWithLeafFinalState(
14791479
defer tc.mu.Unlock()
14801480

14811481
if tc.mu.txn.ID == (uuid.UUID{}) {
1482-
log.Dev.Fatalf(ctx, "cannot UpdateRootWithLeafFinalState on unbound TxnCoordSender. input id: %s", tfs.Txn.ID)
1482+
log.KvExec.Fatalf(ctx, "cannot UpdateRootWithLeafFinalState on unbound TxnCoordSender. input id: %s", tfs.Txn.ID)
14831483
}
14841484

14851485
// Sanity check: don't combine if the tfs is for a different txn ID.

pkg/kv/kvclient/kvcoord/txn_interceptor_heartbeater.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ func (h *txnHeartbeater) closeLocked() {
317317
// startHeartbeatLoopLocked starts a heartbeat loop in a different goroutine.
318318
func (h *txnHeartbeater) startHeartbeatLoopLocked(ctx context.Context) {
319319
if h.loopInterval < 0 {
320-
log.Dev.Infof(ctx, "coordinator heartbeat loop disabled")
320+
log.KvExec.Infof(ctx, "coordinator heartbeat loop disabled")
321321
return
322322
}
323323
if h.mu.loopStarted {
324-
log.Dev.Fatal(ctx, "attempting to start a second heartbeat loop")
324+
log.KvExec.Fatal(ctx, "attempting to start a second heartbeat loop")
325325
}
326326
log.VEventf(ctx, 2, kvbase.SpawningHeartbeatLoopMsg)
327327
h.mu.loopStarted = true
@@ -459,15 +459,15 @@ func (h *txnHeartbeater) heartbeatLocked(ctx context.Context) bool {
459459
// client needs to send a rollback.
460460
return false
461461
case roachpb.COMMITTED:
462-
log.Dev.Fatalf(ctx, "txn committed but heartbeat loop hasn't been signaled to stop: %s", h.mu.txn)
462+
log.KvExec.Fatalf(ctx, "txn committed but heartbeat loop hasn't been signaled to stop: %s", h.mu.txn)
463463
default:
464-
log.Dev.Fatalf(ctx, "unexpected txn status in heartbeat loop: %s", h.mu.txn)
464+
log.KvExec.Fatalf(ctx, "unexpected txn status in heartbeat loop: %s", h.mu.txn)
465465
}
466466

467467
// Clone the txn in order to put it in the heartbeat request.
468468
txn := h.mu.txn.Clone()
469469
if txn.Key == nil {
470-
log.Dev.Fatalf(ctx, "attempting to heartbeat txn without anchor key: %v", txn)
470+
log.KvExec.Fatalf(ctx, "attempting to heartbeat txn without anchor key: %v", txn)
471471
}
472472
ba := &kvpb.BatchRequest{}
473473
ba.Txn = txn
@@ -632,7 +632,7 @@ func (h *txnHeartbeater) abortTxnAsyncLocked(ctx context.Context) {
632632
TaskName: taskName,
633633
})
634634
if err != nil {
635-
log.Dev.Warningf(ctx, "%v", err)
635+
log.KvExec.Warningf(ctx, "%v", err)
636636
h.metrics.AsyncRollbacksFailed.Inc(1)
637637
return
638638
}

pkg/kv/kvclient/kvcoord/txn_interceptor_pipeliner.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,10 @@ func (tp *txnPipeliner) attachLocksToEndTxn(
490490

491491
if log.V(3) {
492492
for _, intent := range et.LockSpans {
493-
log.Dev.Infof(ctx, "intent: [%s,%s)", intent.Key, intent.EndKey)
493+
log.KvExec.Infof(ctx, "intent: [%s,%s)", intent.Key, intent.EndKey)
494494
}
495495
for _, write := range et.InFlightWrites {
496-
log.Dev.Infof(ctx, "in-flight: %d:%s (%s)", write.Sequence, write.Key, write.Strength)
496+
log.KvExec.Infof(ctx, "in-flight: %d:%s (%s)", write.Sequence, write.Key, write.Strength)
497497
}
498498
}
499499
return ba, nil
@@ -736,7 +736,7 @@ func (tp *txnPipeliner) updateLockTracking(
736736
// fine for now, but we add some observability to be aware of this happening.
737737
if tp.ifWrites.byteSize() > maxBytes {
738738
if tp.inflightOverBudgetEveryN.ShouldLog() || log.ExpensiveLogEnabled(ctx, 2) {
739-
log.Dev.Warningf(ctx, "a transaction's in-flight writes and locking reads have "+
739+
log.KvExec.Warningf(ctx, "a transaction's in-flight writes and locking reads have "+
740740
"exceeded the intent tracking limit (kv.transaction.max_intents_bytes). "+
741741
"in-flight writes and locking reads size: %d bytes, txn: %s, ba: %s",
742742
tp.ifWrites.byteSize(), ba.Txn, ba.Summary())
@@ -748,7 +748,7 @@ func (tp *txnPipeliner) updateLockTracking(
748748
// number of ranged locking reads before sending the request.
749749
if rejectTxnMaxCount > 0 && tp.writeCount > rejectTxnMaxCount {
750750
if tp.inflightOverBudgetEveryN.ShouldLog() || log.ExpensiveLogEnabled(ctx, 2) {
751-
log.Dev.Warningf(ctx, "a transaction has exceeded the maximum number of writes "+
751+
log.KvExec.Warningf(ctx, "a transaction has exceeded the maximum number of writes "+
752752
"allowed by kv.transaction.max_intents_and_locks: "+
753753
"count: %d, txn: %s, ba: %s", tp.writeCount, ba.Txn, ba.Summary())
754754
}
@@ -782,7 +782,7 @@ func (tp *txnPipeliner) updateLockTracking(
782782
condensed := tp.lockFootprint.maybeCondense(ctx, tp.riGen, locksBudget)
783783
if condensed && !alreadyCondensed {
784784
if tp.condensedIntentsEveryN.ShouldLog() || log.ExpensiveLogEnabled(ctx, 2) {
785-
log.Dev.Warningf(ctx,
785+
log.KvExec.Warningf(ctx,
786786
"a transaction has hit the intent tracking limit (kv.transaction.max_intents_bytes); "+
787787
"is it a bulk operation? Intent cleanup will be slower. txn: %s ba: %s",
788788
ba.Txn, ba.Summary())
@@ -878,7 +878,7 @@ func (tp *txnPipeliner) updateLockTrackingInner(
878878
// Record any writes that were performed asynchronously. We'll
879879
// need to prove that these succeeded sometime before we commit.
880880
if span.EndKey != nil {
881-
log.Dev.Fatalf(ctx, "unexpected multi-key intent pipelined")
881+
log.KvExec.Fatalf(ctx, "unexpected multi-key intent pipelined")
882882
}
883883
tp.ifWrites.insert(span.Key, seq, str)
884884
} else {

pkg/kv/kvclient/kvcoord/txn_interceptor_write_buffer.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func (twb *txnWriteBuffer) adjustError(
601601
// For requests that were not transformed, attributing an error to them
602602
// shouldn't confuse the client.
603603
if baIdx == pErr.Index.Index && record.transformed {
604-
log.Dev.Warningf(ctx, "error index %d is part of a transformed request", pErr.Index.Index)
604+
log.KvExec.Warningf(ctx, "error index %d is part of a transformed request", pErr.Index.Index)
605605
pErr.Index = nil
606606
return pErr
607607
} else if baIdx == pErr.Index.Index {
@@ -626,7 +626,7 @@ func (twb *txnWriteBuffer) adjustErrorUponFlush(
626626
if pErr.Index.Index < int32(numBuffered) {
627627
// If the error belongs to a request because part of the buffer flush, nil
628628
// out the index.
629-
log.Dev.Warningf(ctx, "error index %d is part of the buffer flush", pErr.Index.Index)
629+
log.KvExec.Warningf(ctx, "error index %d is part of the buffer flush", pErr.Index.Index)
630630
pErr.Index = nil
631631
} else {
632632
// Otherwise, adjust the error index to hide the impact of any flushed
@@ -1313,7 +1313,7 @@ func (twb *txnWriteBuffer) mergeResponseWithRequestRecords(
13131313
ctx context.Context, rr requestRecords, br *kvpb.BatchResponse,
13141314
) (_ *kvpb.BatchResponse, pErr *kvpb.Error) {
13151315
if rr.Empty() && br == nil {
1316-
log.Dev.Fatal(ctx, "unexpectedly found no transformations and no batch response")
1316+
log.KvExec.Fatal(ctx, "unexpectedly found no transformations and no batch response")
13171317
} else if rr.Empty() {
13181318
return br, nil
13191319
}
@@ -1325,7 +1325,7 @@ func (twb *txnWriteBuffer) mergeResponseWithRequestRecords(
13251325
brResp := kvpb.ResponseUnion{}
13261326
if !record.stripped {
13271327
if len(br.Responses) == 0 {
1328-
log.Dev.Fatal(ctx, "unexpectedly found a non-stripped request and no batch response")
1328+
log.KvExec.Fatal(ctx, "unexpectedly found a non-stripped request and no batch response")
13291329
}
13301330
// If the request wasn't stripped from the batch we sent to KV, we
13311331
// received a response for it, which then needs to be combined with

0 commit comments

Comments
 (0)