Skip to content

Commit 8a15c13

Browse files
craig[bot]kyle-a-wong
andcommitted
Merge #152548
152548: log,*: require explicit channel selection for logging API r=kyle-a-wong a=kyle-a-wong Updated the deprecation comment on the generated logging APIS to adhere to the golang documentation. As a result, usage of these APIs will now cause lint failures due to lint check: SA1019. Epic: [CRDB-53410](https://cockroachlabs.atlassian.net/browse/CRDB-53410) Release note: None Co-authored-by: Kyle Wong <[email protected]>
2 parents 91b3eee + 65d6d9c commit 8a15c13

File tree

17 files changed

+51
-147
lines changed

17 files changed

+51
-147
lines changed

pkg/acceptance/cluster/docker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ func (c *Container) WaitUntilNotRunning(ctx context.Context) error {
317317
// NB: TEST_UNDECLARED_OUTPUTS_DIR is set for remote Bazel tests.
318318
undeclaredOutsDir := os.Getenv("TEST_UNDECLARED_OUTPUTS_DIR")
319319
if undeclaredOutsDir != "" {
320-
log.Shoutf(ctx, severity.INFO, "command left-over files in %s",
320+
log.Dev.Shoutf(ctx, severity.INFO, "command left-over files in %s",
321321
strings.Replace(volumesDir, undeclaredOutsDir, "outputs.zip", 1))
322322
} else {
323-
log.Shoutf(ctx, severity.INFO, "command left-over files in %s", volumesDir)
323+
log.Dev.Shoutf(ctx, severity.INFO, "command left-over files in %s", volumesDir)
324324
}
325325
}
326326

pkg/backup/restore_job.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func restoreWithRetry(
259259
ctx, txn, "error", fmt.Sprintf("restore encountered error: %v", err),
260260
)
261261
}); err != nil {
262-
log.Warningf(ctx, "failed to record job error message: %v", err)
262+
log.Dev.Warningf(ctx, "failed to record job error message: %v", err)
263263
}
264264
}
265265

@@ -330,7 +330,7 @@ func maybeResetRetry(
330330
// If the previous persisted spans are different than the current, it
331331
// implies that further progress has been persisted.
332332
rt.Reset()
333-
log.Infof(ctx, "restored frontier has advanced since last retry, resetting retry counter")
333+
log.Dev.Infof(ctx, "restored frontier has advanced since last retry, resetting retry counter")
334334
}
335335
return currProgress
336336
}

pkg/ccl/changefeedccl/schemafeed/table_event_filter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ func (filter tableEventFilter) shouldFilter(
128128
et := classifyTableEvent(e)
129129

130130
if log.V(2) {
131-
log.Infof(ctx, "table event %v classified as %v", e, et)
131+
log.Dev.Infof(ctx, "table event %v classified as %v", e, et)
132132
defer func() {
133-
log.Infof(ctx, "should filter table event %v: %t", e, ok)
133+
log.Dev.Infof(ctx, "should filter table event %v: %t", e, ok)
134134
}()
135135
}
136136

pkg/cli/cli.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ func debugSignalSetup() func() {
356356
case <-exit:
357357
return
358358
case <-debugSignalCh:
359-
log.Shout(ctx, severity.INFO, "setting up localhost debugging endpoint...")
359+
log.Dev.Shout(ctx, severity.INFO, "setting up localhost debugging endpoint...")
360360
mux := http.NewServeMux()
361361
mux.HandleFunc("/debug/pprof/", pprof.Index)
362362
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
@@ -367,7 +367,7 @@ func debugSignalSetup() func() {
367367
listenAddr := "localhost:0"
368368
listener, err := net.Listen("tcp", listenAddr)
369369
if err != nil {
370-
log.Shoutf(ctx, severity.WARNING, "debug server could not start listening on %s: %v", listenAddr, err)
370+
log.Dev.Shoutf(ctx, severity.WARNING, "debug server could not start listening on %s: %v", listenAddr, err)
371371
continue
372372
}
373373

@@ -377,7 +377,7 @@ func debugSignalSetup() func() {
377377
log.Dev.Warningf(ctx, "debug server: %v", err)
378378
}
379379
}()
380-
log.Shoutf(ctx, severity.INFO, "debug server listening on %s", listener.Addr())
380+
log.Dev.Shoutf(ctx, severity.INFO, "debug server listening on %s", listener.Addr())
381381
<-exit
382382
if err := server.Shutdown(ctx); err != nil {
383383
log.Dev.Warningf(ctx, "error shutting down debug server: %s", err)

pkg/cli/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ func setupAndInitializeLoggingAndProfiling(
14721472
"to databases, the --locality flag must contain a \"region\" tier.\n" +
14731473
"For more information, see:\n\n" +
14741474
"- %s"
1475-
log.Shoutf(ctx, severity.WARNING, warningString,
1475+
log.Dev.Shoutf(ctx, severity.WARNING, warningString,
14761476
redact.Safe(docs.URL("cockroach-start.html#locality")))
14771477
}
14781478
}

pkg/crosscluster/logical/logical_replication_job.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (r *logicalReplicationResumer) ingest(
348348
case <-t.C:
349349
newDest, err := reloadDest(ctx, ingestionJob.ID(), jobExecCtx.ExecCfg())
350350
if err != nil {
351-
log.Warningf(ctx, "failed to check for updated configuration: %v", err)
351+
log.Dev.Warningf(ctx, "failed to check for updated configuration: %v", err)
352352
} else if newDest != resolvedDest {
353353
return errors.Mark(errors.Newf("replan due to detail change: old=%s, new=%s", resolvedDest, newDest), sql.ErrPlanChanged)
354354
}

pkg/kv/kvclient/rangefeed/rangefeedcache/watcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func (s *Watcher[E]) Run(ctx context.Context) error {
312312
rangefeed.WithDiff(s.withPrevValue),
313313
rangefeed.WithRowTimestampInInitialScan(s.withRowTSInInitialScan),
314314
rangefeed.WithOnInitialScanError(func(ctx context.Context, err error) (shouldFail bool) {
315-
log.VInfof(ctx, 1, "initial scan error: %s", err)
315+
log.Dev.VInfof(ctx, 1, "initial scan error: %s", err)
316316
// TODO(irfansharif): Consider if there are other errors which we
317317
// want to treat as permanent. This was cargo culted from the
318318
// settings watcher.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,9 +966,9 @@ func (a *Allocator) ComputeAction(
966966
// priority inversion. If the priority is not -1, the range might be re-queued
967967
// to be processed with the correct priority.
968968
if priority == -1 && buildutil.CrdbTestBuild {
969-
log.Fatalf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
969+
log.Dev.Fatalf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
970970
} else {
971-
log.Warningf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
971+
log.Dev.Warningf(ctx, "allocator returned -1 priority for range %s: %v", desc, action)
972972
}
973973
return action, priority
974974
}

pkg/kv/kvserver/batcheval/cmd_add_sstable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ func computeSSTStatsDiffWithFallback(
475475
stats, err := storage.ComputeSSTStatsDiff(
476476
ctx, sst, readWriter, nowNanos, start, end)
477477
if errors.IsAny(err, storage.ComputeSSTStatsDiffReaderHasRangeKeys, storage.ComputeStatsDiffViolation) {
478-
log.Warningf(ctx, "computing SST stats as estimates because of ComputeSSTStatsDiff error: %s", err)
478+
log.Dev.Warningf(ctx, "computing SST stats as estimates because of ComputeSSTStatsDiff error: %s", err)
479479
sstStats, err := computeSSTStats(ctx, sst, nowNanos)
480480
if err != nil {
481481
return enginepb.MVCCStats{}, errors.Wrap(err, "error computing SST stats during fallback")

pkg/server/import_ts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ func maybeImportTS(ctx context.Context, s *topLevelServer) (returnErr error) {
128128
}
129129
storeToNode[roachpb.StoreID(si)] = roachpb.NodeID(ni)
130130
}
131-
log.Infof(ctx, "Using embedded store-to-node mapping from the tsdump file itself. "+
131+
log.Dev.Infof(ctx, "Using embedded store-to-node mapping from the tsdump file itself. "+
132132
"Skipped check for explicit store-to-node mapping file.")
133133
} else {
134134
// Reset file to beginning for subsequent decoding.
135135
if _, err := f.Seek(0, io.SeekStart); err != nil {
136136
return err
137137
}
138138
dec = gob.NewDecoder(f)
139-
log.Infof(ctx, "Embedded metadata not found in the tsdump file. "+
139+
log.Dev.Infof(ctx, "Embedded metadata not found in the tsdump file. "+
140140
"Reading from the store-to-node mapping file.")
141141

142142
// Fallback to explicit YAML mapping file.

0 commit comments

Comments
 (0)