Skip to content

Commit 3476899

Browse files
craig[bot]tbg
andcommitted
Merge #153946
153946: kvserver: move off Dev logging channel in subpackages r=tbg a=tbg First two commits are from #153945. ---- Starting from `rg -l 'log.Dev' pkg/kv/kvserver/ | sed -E 's/[^/]+$//g' | sort | uniq -c | sort -r -n`, I went through each package and wholesale replaced `log.Dev.*` either with the KvDistribution or KvExec log channel. As of this PR, the only `log.Dev` logging in the `kvserver` tree is in the `kvserver` package itself: ``` $ rg -l 'log.Dev' pkg/kv/kvserver/ | sed -E 's/[^/]+$//g' | sort | uniq -c | sort -r -n 81 pkg/kv/kvserver/ ``` This will be addressed separately. Epic: none Co-authored-by: Tobias Grieger <[email protected]>
2 parents c8c2809 + 71593d9 commit 3476899

File tree

101 files changed

+493
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+493
-493
lines changed

pkg/kv/kvserver/allocator/allocatorimpl/allocator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,9 +986,9 @@ func (a *Allocator) ComputeAction(
986986
// to be processed with the correct priority.
987987
if priority == -1 {
988988
if buildutil.CrdbTestBuild {
989-
log.Dev.Fatalf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
989+
log.KvDistribution.Fatalf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
990990
} else {
991-
log.Dev.Warningf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
991+
log.KvDistribution.Warningf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
992992
}
993993
}
994994
return action, priority

pkg/kv/kvserver/allocator/allocatorimpl/allocator_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,7 @@ func TestAllocatorRebalanceDifferentLocalitySizes(t *testing.T) {
28522852
}
28532853

28542854
for i, tc := range testCases2 {
2855-
log.Dev.Infof(ctx, "case #%d", i)
2855+
log.KvDistribution.Infof(ctx, "case #%d", i)
28562856
var rangeUsageInfo allocator.RangeUsageInfo
28572857
result, _, details, ok := a.RebalanceVoter(
28582858
ctx,
@@ -8764,13 +8764,13 @@ func (ts *testStore) rebalance(ots *testStore, bytes int64, qps float64, do Disk
87648764
// almost out of disk. (In a real allocator this is, for example, in
87658765
// rankedCandidateListFor{Allocation,Rebalancing}).
87668766
if !do.maxCapacityCheck(ots.StoreDescriptor) {
8767-
log.Dev.Infof(
8767+
log.KvDistribution.Infof(
87688768
context.Background(),
87698769
"s%d too full to accept snapshot from s%d: %v", ots.StoreID, ts.StoreID, ots.Capacity,
87708770
)
87718771
return
87728772
}
8773-
log.Dev.Infof(context.Background(), "s%d accepting snapshot from s%d", ots.StoreID, ts.StoreID)
8773+
log.KvDistribution.Infof(context.Background(), "s%d accepting snapshot from s%d", ots.StoreID, ts.StoreID)
87748774
ts.Capacity.RangeCount--
87758775
ts.Capacity.QueriesPerSecond -= qps
87768776
if ts.immediateCompaction {
@@ -8801,7 +8801,7 @@ func Example_rangeCountRebalancing() {
88018801
alloc.ScorerOptions(ctx),
88028802
)
88038803
if ok {
8804-
log.Dev.Infof(ctx, "rebalancing to %v; details: %s", target, details)
8804+
log.KvDistribution.Infof(ctx, "rebalancing to %v; details: %s", target, details)
88058805
ts.rebalance(
88068806
&testStores[int(target.StoreID)],
88078807
alloc.randGen.Int63n(1<<20),
@@ -8916,7 +8916,7 @@ func qpsBasedRebalanceFn(
89168916
opts,
89178917
)
89188918
if ok {
8919-
log.Dev.Infof(ctx, "rebalancing from %v to %v; details: %s", remove, add, details)
8919+
log.KvDistribution.Infof(ctx, "rebalancing from %v to %v; details: %s", remove, add, details)
89208920
candidate.rebalance(&testStores[int(add.StoreID)], alloc.randGen.Int63n(1<<20), jitteredQPS, opts.BaseScorerOptions.DiskCapacity)
89218921
}
89228922
}

pkg/kv/kvserver/allocator/mmaprototype/allocator_state.go

Lines changed: 59 additions & 59 deletions
Large diffs are not rendered by default.

pkg/kv/kvserver/allocator/mmaprototype/cluster_state.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ func makeRebalanceReplicaChanges(
353353
}
354354
}
355355
if remove == (StoreIDAndReplicaState{}) {
356-
log.Dev.Fatalf(context.Background(), "remove target %s not in existing replicas", removeTarget)
356+
log.KvDistribution.Fatalf(context.Background(), "remove target %s not in existing replicas", removeTarget)
357357
}
358358

359359
addState := ReplicaState{
@@ -1169,7 +1169,7 @@ func (cs *clusterState) processStoreLoadMsg(ctx context.Context, storeMsg *Store
11691169
// corresponding delta adjustment as the reported load already contains the
11701170
// effect.
11711171
for _, change := range ss.computePendingChangesReflectedInLatestLoad(storeMsg.LoadTime) {
1172-
log.Dev.VInfof(ctx, 2, "s%d not-pending %v", storeMsg.StoreID, change)
1172+
log.KvDistribution.VInfof(ctx, 2, "s%d not-pending %v", storeMsg.StoreID, change)
11731173
delete(ss.adjusted.loadPendingChanges, change.ChangeID)
11741174
}
11751175

@@ -1179,7 +1179,7 @@ func (cs *clusterState) processStoreLoadMsg(ctx context.Context, storeMsg *Store
11791179
// replicas.
11801180
cs.applyChangeLoadDelta(change.ReplicaChange)
11811181
}
1182-
log.Dev.VInfof(ctx, 2, "processStoreLoadMsg for store s%v: %v",
1182+
log.KvDistribution.VInfof(ctx, 2, "processStoreLoadMsg for store s%v: %v",
11831183
storeMsg.StoreID, ss.adjusted.load)
11841184
}
11851185

@@ -1279,7 +1279,7 @@ func (cs *clusterState) processStoreLeaseholderMsgInternal(
12791279
// rs.pendingChanges is the union of remainingChanges and enactedChanges.
12801280
// These changes are also in cs.pendingChanges.
12811281
if len(enactedChanges) > 0 {
1282-
log.Dev.Infof(ctx, "enactedChanges %v", enactedChanges)
1282+
log.KvDistribution.Infof(ctx, "enactedChanges %v", enactedChanges)
12831283
}
12841284
for _, change := range enactedChanges {
12851285
// Mark the change as enacted. Enacting a change does not remove the
@@ -1301,7 +1301,7 @@ func (cs *clusterState) processStoreLeaseholderMsgInternal(
13011301
// effect is also incorporated into the storeStates, but not in the range
13021302
// membership (since we undid that above).
13031303
if len(remainingChanges) > 0 {
1304-
log.Dev.Infof(ctx, "remainingChanges %v", remainingChanges)
1304+
log.KvDistribution.Infof(ctx, "remainingChanges %v", remainingChanges)
13051305
// Temporarily set the rs.pendingChanges to nil, since
13061306
// preCheckOnApplyReplicaChanges returns false if there are any pending
13071307
// changes, and these are the changes that are pending. This is hacky
@@ -1324,7 +1324,7 @@ func (cs *clusterState) processStoreLeaseholderMsgInternal(
13241324
// changes, so we need to drop them. This should be rare, but can happen
13251325
// if the leaseholder executed a change that MMA was completely unaware
13261326
// of.
1327-
log.Dev.Infof(ctx, "remainingChanges %v are no longer valid due to %v",
1327+
log.KvDistribution.Infof(ctx, "remainingChanges %v are no longer valid due to %v",
13281328
remainingChanges, reason)
13291329
if metrics != nil {
13301330
metrics.DroppedDueToStateInconsistency.Inc(1)
@@ -1556,7 +1556,7 @@ func (cs *clusterState) gcPendingChanges(now time.Time) {
15561556
}
15571557
if len(replicaChanges) > 0 {
15581558
if valid, reason := cs.preCheckOnUndoReplicaChanges(replicaChanges); !valid {
1559-
log.Dev.Infof(context.Background(), "did not undo change %v: due to %v", removeChangeIds, reason)
1559+
log.KvDistribution.Infof(context.Background(), "did not undo change %v: due to %v", removeChangeIds, reason)
15601560
return
15611561
}
15621562
for _, rmChange := range removeChangeIds {
@@ -1664,7 +1664,7 @@ func (cs *clusterState) createPendingChanges(changes ...ReplicaChange) []*pendin
16641664
cs.pendingChanges[cid] = pendingChange
16651665
storeState.adjusted.loadPendingChanges[cid] = pendingChange
16661666
rangeState.pendingChanges = append(rangeState.pendingChanges, pendingChange)
1667-
log.Dev.VInfof(context.Background(), 3, "createPendingChanges: change_id=%v, range_id=%v, change=%v", cid, change.rangeID, change)
1667+
log.KvDistribution.VInfof(context.Background(), 3, "createPendingChanges: change_id=%v, range_id=%v, change=%v", cid, change.rangeID, change)
16681668
pendingChanges = append(pendingChanges, pendingChange)
16691669
}
16701670
return pendingChanges
@@ -1691,7 +1691,7 @@ func (cs *clusterState) preCheckOnApplyReplicaChanges(
16911691
return false, "range does not exist in cluster state"
16921692
}
16931693
if len(curr.pendingChanges) > 0 {
1694-
log.Dev.VInfof(context.Background(), 2, "range %d has pending changes: %v",
1694+
log.KvDistribution.VInfof(context.Background(), 2, "range %d has pending changes: %v",
16951695
rangeID, curr.pendingChanges)
16961696
return false, "range has pending changes"
16971697
}
@@ -1792,7 +1792,7 @@ func (cs *clusterState) applyReplicaChange(change ReplicaChange, applyLoadChange
17921792
panic(fmt.Sprintf("range %v not found in cluster state", change.rangeID))
17931793
}
17941794

1795-
log.Dev.VInfof(context.Background(), 2, "applying replica change %v to range %d on store %d",
1795+
log.KvDistribution.VInfof(context.Background(), 2, "applying replica change %v to range %d on store %d",
17961796
change, change.rangeID, change.target.StoreID)
17971797
if change.isRemoval() {
17981798
delete(storeState.adjusted.replicas, change.rangeID)
@@ -1823,7 +1823,7 @@ func (cs *clusterState) applyReplicaChange(change ReplicaChange, applyLoadChange
18231823
}
18241824

18251825
func (cs *clusterState) undoReplicaChange(change ReplicaChange) {
1826-
log.Dev.Infof(context.Background(), "undoing replica change %v to range %d on store %d",
1826+
log.KvDistribution.Infof(context.Background(), "undoing replica change %v to range %d on store %d",
18271827
change, change.rangeID, change.target.StoreID)
18281828
rangeState := cs.ranges[change.rangeID]
18291829
storeState := cs.stores[change.target.StoreID]
@@ -1987,11 +1987,11 @@ func (cs *clusterState) canShedAndAddLoad(
19871987
var reason strings.Builder
19881988
defer func() {
19891989
if canAddLoad {
1990-
log.Dev.VInfof(ctx, 3, "can add load to n%vs%v: %v targetSLS[%v] srcSLS[%v]",
1990+
log.KvDistribution.VInfof(ctx, 3, "can add load to n%vs%v: %v targetSLS[%v] srcSLS[%v]",
19911991
targetNS.NodeID, targetSS.StoreID, canAddLoad, targetSLS, srcSLS)
19921992
} else {
1993-
log.Dev.VInfof(ctx, 2, "cannot add load to n%vs%v: due to %s", targetNS.NodeID, targetSS.StoreID, reason.String())
1994-
log.Dev.VInfof(ctx, 2, "[target_sls:%v,src_sls:%v]", targetSLS, srcSLS)
1993+
log.KvDistribution.VInfof(ctx, 2, "cannot add load to n%vs%v: due to %s", targetNS.NodeID, targetSS.StoreID, reason.String())
1994+
log.KvDistribution.VInfof(ctx, 2, "[target_sls:%v,src_sls:%v]", targetSLS, srcSLS)
19951995
}
19961996
}()
19971997
if targetSLS.highDiskSpaceUtilization {
@@ -2078,7 +2078,7 @@ func (cs *clusterState) canShedAndAddLoad(
20782078
}
20792079
// The use of 33% is arbitrary.
20802080
if dimFractionIncrease > overloadedDimFractionIncrease/3 {
2081-
log.Dev.Infof(ctx, "%v: %f > %f/3", dim, dimFractionIncrease, overloadedDimFractionIncrease)
2081+
log.KvDistribution.Infof(ctx, "%v: %f > %f/3", dim, dimFractionIncrease, overloadedDimFractionIncrease)
20822082
otherDimensionsBecameWorseInTarget = true
20832083
break
20842084
}

pkg/kv/kvserver/allocator/mmaprototype/load.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,10 @@ func loadSummaryForDimension(
510510
defer func() {
511511
if log.V(2) {
512512
if storeID == 0 {
513-
log.Dev.Infof(ctx, "n%d[%v]: load=%d, mean_load=%d, fraction above=%.2f, load_summary=%v",
513+
log.KvDistribution.Infof(ctx, "n%d[%v]: load=%d, mean_load=%d, fraction above=%.2f, load_summary=%v",
514514
nodeID, dim, load, meanLoad, fractionAbove, summary)
515515
} else {
516-
log.Dev.Infof(ctx, "s%d[%v]: load=%d, mean_load=%d, fraction above=%.2f, load_summary=%v",
516+
log.KvDistribution.Infof(ctx, "s%d[%v]: load=%d, mean_load=%d, fraction above=%.2f, load_summary=%v",
517517
storeID, dim, load, meanLoad, fractionAbove, summary)
518518
}
519519
}
@@ -575,7 +575,7 @@ func loadSummaryForDimension(
575575

576576
func highDiskSpaceUtilization(load LoadValue, capacity LoadValue) bool {
577577
if capacity == UnknownCapacity {
578-
log.Dev.Errorf(context.Background(), "disk capacity is unknown")
578+
log.KvDistribution.Errorf(context.Background(), "disk capacity is unknown")
579579
return false
580580
}
581581
fractionUsed := float64(load) / float64(capacity)

pkg/kv/kvserver/allocator/mmaprototype/top_k_replicas.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (t *topKReplicas) addReplica(
4040
msgStoreID roachpb.StoreID,
4141
) {
4242
if loadValue < t.threshold {
43-
log.Dev.VInfof(ctx, 3, "(r%d,s%d,lhs%d): load%v<threshold%v, skipping for dim %s",
43+
log.KvDistribution.VInfof(ctx, 3, "(r%d,s%d,lhs%d): load%v<threshold%v, skipping for dim %s",
4444
rangeID, replicaStoreID, msgStoreID, loadValue, t.threshold, t.dim)
4545
return
4646
}

pkg/kv/kvserver/allocator/storepool/store_pool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ func (sp *StorePool) storeGossipUpdate(_ string, content roachpb.Value, _ int64)
487487

488488
if err := content.GetProto(&storeDesc); err != nil {
489489
ctx := sp.AnnotateCtx(context.TODO())
490-
log.Dev.Errorf(ctx, "%v", err)
490+
log.KvDistribution.Errorf(ctx, "%v", err)
491491
return
492492
}
493493

@@ -930,7 +930,7 @@ func (sp *StorePool) liveAndDeadReplicasWithLiveness(
930930
liveReplicas = append(liveReplicas, repl)
931931
}
932932
default:
933-
log.Dev.Fatalf(context.TODO(), "unknown store status %d", status)
933+
log.KvDistribution.Fatalf(context.TODO(), "unknown store status %d", status)
934934
}
935935
}
936936
return
@@ -1278,11 +1278,11 @@ func (sp *StorePool) Throttle(reason ThrottleReason, why string, storeID roachpb
12781278
detail.ThrottledUntil = sp.clock.Now().AddDuration(timeout)
12791279
if log.V(2) {
12801280
ctx := sp.AnnotateCtx(context.TODO())
1281-
log.Dev.Infof(ctx, "snapshot failed (%s), s%d will be throttled for %s until %s",
1281+
log.KvDistribution.Infof(ctx, "snapshot failed (%s), s%d will be throttled for %s until %s",
12821282
why, storeID, timeout, detail.ThrottledUntil)
12831283
}
12841284
default:
1285-
log.Dev.Warningf(sp.AnnotateCtx(context.TODO()), "unknown throttle reason %v", reason)
1285+
log.KvDistribution.Warningf(sp.AnnotateCtx(context.TODO()), "unknown throttle reason %v", reason)
12861286
}
12871287
}
12881288

pkg/kv/kvserver/asim/assertion/assert.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (sa SteadyStateAssertion) Assert(
108108
m := h.Recorded
109109
ticks := len(m)
110110
if sa.Ticks > ticks {
111-
log.Dev.VInfof(ctx, 2,
111+
log.KvDistribution.VInfof(ctx, 2,
112112
"The history to run assertions against (%d) is shorter than "+
113113
"the assertion duration (%d)", ticks, sa.Ticks)
114114
return true, ""
@@ -213,7 +213,7 @@ func (ba BalanceAssertion) Assert(
213213
m := h.Recorded
214214
ticks := len(m)
215215
if ba.Ticks > ticks {
216-
log.Dev.VInfof(ctx, 2,
216+
log.KvDistribution.VInfof(ctx, 2,
217217
"The history to run assertions against (%d) is shorter than "+
218218
"the assertion duration (%d)", ticks, ba.Ticks)
219219
return true, ""
@@ -235,7 +235,7 @@ func (ba BalanceAssertion) Assert(
235235
max, _ := stats.Max(tickStats)
236236
maxMeanRatio := max / mean
237237

238-
log.Dev.VInfof(ctx, 2,
238+
log.KvDistribution.VInfof(ctx, 2,
239239
"Balance assertion: stat=%s, max/mean=%.2f, threshold=%+v raw=%v",
240240
ba.Stat, maxMeanRatio, ba.Threshold, tickStats)
241241
if ba.Threshold.isViolated(maxMeanRatio) {
@@ -276,7 +276,7 @@ func (sa StoreStatAssertion) Assert(
276276
m := h.Recorded
277277
ticks := len(m)
278278
if sa.Ticks > ticks {
279-
log.Dev.VInfof(ctx, 2,
279+
log.KvDistribution.VInfof(ctx, 2,
280280
"The history to run assertions against (%d) is shorter than "+
281281
"the assertion duration (%d)", ticks, sa.Ticks)
282282
return true, ""

pkg/kv/kvserver/asim/event/mutation_event.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (sne SetNodeLivenessEvent) String() string {
164164

165165
func (sce SetCapacityOverrideEvent) Func() EventFunc {
166166
return MutationFunc(func(ctx context.Context, s state.State) {
167-
log.Dev.Infof(ctx, "setting capacity override %v", sce.CapacityOverride)
167+
log.KvDistribution.Infof(ctx, "setting capacity override %v", sce.CapacityOverride)
168168
s.SetCapacityOverride(sce.StoreID, sce.CapacityOverride)
169169
})
170170
}
@@ -175,7 +175,7 @@ func (sce SetCapacityOverrideEvent) String() string {
175175

176176
func (sne SetNodeLocalityEvent) Func() EventFunc {
177177
return MutationFunc(func(ctx context.Context, s state.State) {
178-
log.Dev.Infof(ctx, "setting node locality %v", sne.LocalityString)
178+
log.KvDistribution.Infof(ctx, "setting node locality %v", sne.LocalityString)
179179
if sne.LocalityString != "" {
180180
var locality roachpb.Locality
181181
if err := locality.Set(sne.LocalityString); err != nil {

pkg/kv/kvserver/asim/metrics/cluster_tracker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ func (m *ClusterMetricsTracker) Listen(ctx context.Context, sms []StoreMetrics)
103103
record = append(record, fmt.Sprintf("%d", totalBytesRebalanced))
104104

105105
if err := m.write(record); err != nil {
106-
log.Dev.Errorf(ctx, "Error writing cluster metrics %s", err.Error())
106+
log.KvDistribution.Errorf(ctx, "Error writing cluster metrics %s", err.Error())
107107
}
108108
}

0 commit comments

Comments
 (0)