Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cmd/release/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestPostBlockers(t *testing.T) {
}

for _, test := range tests {
t.Run(fmt.Sprintf(test.testCase), func(t *testing.T) {
t.Run(test.testCase, func(t *testing.T) {
var expectedMessage *message
defer hookGlobal(
&sendmail,
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/test_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,6 @@ func shout(
format += "\n"
}
msg := fmt.Sprintf(format, args...)
l.PrintfCtxDepth(ctx, 2 /* depth */, msg)
l.PrintfCtxDepth(ctx, 2 /* depth */, "%s", msg)
fmt.Fprint(stdout, msg)
}
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/test_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ func (r *testRunner) runWorker(
msg = "test failed: %s (run %d)"
}
msg = fmt.Sprintf(msg, t.Name(), testToRun.runNum)
l.PrintfCtx(ctx, msg)
l.PrintfCtx(ctx, "%s", msg)
}
testL.Close()
if err != nil || t.Failed() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func runEarlyExitInConnectionWait(ctx context.Context, t test.Test, c cluster.Cl
drainEndTimestamp := timeutil.Now()
actualDrainDuration := drainEndTimestamp.Sub(drainStartTimestamp)

t.L().Printf("the draining lasted %f seconds", actualDrainDuration)
t.L().Printf("the draining lasted %f seconds", actualDrainDuration.Seconds())

totalWaitDuration := drainWaitDuration + connectionWaitDuration + queryWaitDuration
if actualDrainDuration >= totalWaitDuration-10*time.Second {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/roachtest/tests/drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func registerDrop(r registry.Registry) {
}

nodeSpaceUsed := fmt.Sprintf("Node %d space after deletion used: %s\n", j, humanizeutil.IBytes(int64(size)))
t.L().Printf(nodeSpaceUsed)
t.L().Printf("%s", nodeSpaceUsed)

// Return if the size of the directory is less than 100mb
if size > maxSizeBytes {
Expand All @@ -149,7 +149,7 @@ func registerDrop(r registry.Registry) {
if !allNodesSpaceCleared {
sizeReport += fmt.Sprintf("disk space usage has not dropped below %s on all nodes.",
humanizeutil.IBytes(int64(maxSizeBytes)))
t.Fatalf(sizeReport)
t.Fatalf("%s", sizeReport)
}

return nil
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/roachtest/tests/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ SELECT string_agg(source_id::TEXT || ':' || target_id::TEXT, ',')
return false
}

for i := range liveNodes {
if liveNodes[i] != expLiveNodes[i] {
t.L().Printf("%d: gossip not ok (mismatched view of live nodes); expected %s, got %s (%.0fs)\n",
for j := range liveNodes {
if liveNodes[j] != expLiveNodes[j] {
t.L().Printf("%d: gossip not ok (mismatched view of live nodes: %s); expected %v, got %v (%.0fs)\n",
i, gossipNetwork, expLiveNodes, liveNodes, timeutil.Since(start).Seconds())
return false
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/kvbench.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ func runKVBench(ctx context.Context, t test.Test, c cluster.Cluster, b kvBenchSp
splitCmd.WriteString(`;`)
}
if _, err := db.Exec(splitCmd.String()); err != nil {
t.L().Printf(splitCmd.String())
t.L().Printf("%s", splitCmd.String())
return err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ SELECT $1::INT = ALL (
"--url", url, "--certs-dir", certsDir, "-e", "'SELECT 1'")

// Report the results of execution.
t.L().Printf("server %d, attempt %d, result:\n%s\n", server, attempt, b)
t.L().Printf("server %d, attempt %d, result:\n%+v\n", server, attempt, b)
// Indicate, to the main goroutine, that we have at least one connection
// attempt completed.
atomic.AddUint32(&numConns, 1)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/replicagc.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (h *replicagcTestHelper) isolateDeadNodes(ctx context.Context, runNode int)
"RANGE default", "RANGE meta", "RANGE system", "RANGE liveness", "DATABASE system", "TABLE system.jobs",
} {
stmt := `ALTER ` + change + ` CONFIGURE ZONE = 'constraints: {"-` + deadNodeAttr + `"}'`
h.t.L().Printf(stmt + "\n")
h.t.L().Printf("%s\n", stmt)
if _, err := db.ExecContext(ctx, stmt); err != nil {
h.t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/reset_quorum.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ OR
if buf.Len() == 0 {
break
}
t.L().Printf("still waiting:\n" + buf.String())
t.L().Printf("still waiting:\n%s", buf.String())
time.Sleep(5 * time.Second)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (hc *HealthChecker) Runner(ctx context.Context) (err error) {
rr = append(rr, a)
}
if len(rr) > 0 {
logger.Printf(rr.String() + "\n")
logger.Printf("%s\n", rr.String())
// TODO(tschottdorf): see method comment.
// return errors.New(rr.String())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/sqlsmith.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ INSERT INTO seed_mr_table DEFAULT VALUES;`, regionList[0]),
sb.WriteString(errStr)
sb.WriteString(hintStr)

t.Fatalf(sb.String())
t.Fatalf("%s", sb.String())
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions pkg/cmd/roachtest/tests/tpchvec.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ func (p *tpchVecPerfTest) postTestRunHook(
vecOffTime := findMedian(vecOffTimes)
if vecOffTime < vecOnTime {
t.L().Printf(
fmt.Sprintf("[q%d] vec OFF was faster by %.2f%%: "+
"[q%d] vec OFF was faster by %.2f%%: "+
"%.2fs ON vs %.2fs OFF --- WARNING\n"+
"vec ON times: %v\t vec OFF times: %v",
queryNum, 100*(vecOnTime-vecOffTime)/vecOffTime,
vecOnTime, vecOffTime, vecOnTimes, vecOffTimes))
queryNum, 100*(vecOnTime-vecOffTime)/vecOffTime,
vecOnTime, vecOffTime, vecOnTimes, vecOffTimes)
} else {
t.L().Printf(
fmt.Sprintf("[q%d] vec ON was faster by %.2f%%: "+
"[q%d] vec ON was faster by %.2f%%: "+
"%.2fs ON vs %.2fs OFF\n"+
"vec ON times: %v\t vec OFF times: %v",
queryNum, 100*(vecOffTime-vecOnTime)/vecOnTime,
vecOnTime, vecOffTime, vecOnTimes, vecOffTimes))
queryNum, 100*(vecOffTime-vecOnTime)/vecOnTime,
vecOnTime, vecOffTime, vecOnTimes, vecOffTimes)
}
if vecOnTime >= tpchVecPerfSlownessThreshold*vecOffTime {
// For some reason, the vectorized engine executed the query a lot
Expand Down Expand Up @@ -407,19 +407,19 @@ func (b *tpchVecBenchTest) postTestRunHook(
bestSetupIdx = setupIdx
}
}
t.L().Printf(fmt.Sprintf("[q%d] best setup is %s", queryNum, runConfig.setupNames[bestSetupIdx]))
t.L().Printf("[q%d] best setup is %s", queryNum, runConfig.setupNames[bestSetupIdx])
for setupIdx, setupName := range runConfig.setupNames {
setupTime := findAvgTime(b.timeByQueryNum[setupIdx][queryNum])
scores[setupIdx] += setupTime / bestTime
t.L().Printf(fmt.Sprintf("[q%d] setup %s took %.2fs", queryNum, setupName, setupTime))
t.L().Printf("[q%d] setup %s took %.2fs", queryNum, setupName, setupTime)
}
}
t.Status("----- scores of the setups -----")
bestScore := math.MaxFloat64
var bestSetupIdx int
for setupIdx, setupName := range runConfig.setupNames {
score := scores[setupIdx]
t.L().Printf(fmt.Sprintf("score of %s is %.2f", setupName, score))
t.L().Printf("score of %s is %.2f", setupName, score)
if bestScore > score {
bestScore = score
bestSetupIdx = setupIdx
Expand Down Expand Up @@ -474,7 +474,7 @@ func baseTestRun(
runConfig.numRunsPerQuery, queryNum)
result, err := c.RunWithDetailsSingleNode(ctx, t.L(), firstNode, cmd)
workloadOutput := result.Stdout + result.Stderr
t.L().Printf(workloadOutput)
t.L().Printf("%s", workloadOutput)
if err != nil {
// Note: if you see an error like "exit status 1", it is likely caused
// by the erroneous output of the query.
Expand Down
2 changes: 1 addition & 1 deletion pkg/geo/geomfn/make_geometry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func TestMakePolygon(t *testing.T) {
}
polygon, err := MakePolygon(outer, interior...)
if tc.err != nil {
require.Errorf(t, err, tc.err.Error())
require.Errorf(t, err, "%s", tc.err.Error())
require.EqualError(t, err, tc.err.Error())
} else {
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/concurrency/concurrency_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func TestConcurrencyManagerBasic(t *testing.T) {
mon.runSync("update txn", func(ctx context.Context) {
log.Eventf(ctx, "%s %s", verb, txnName)
if err := c.updateTxnRecord(txn.ID, status, ts); err != nil {
d.Fatalf(t, err.Error())
d.Fatalf(t, "%s", err.Error())
}
})
return c.waitAndCollect(t, mon)
Expand Down
12 changes: 6 additions & 6 deletions pkg/kv/kvserver/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type raftLogger struct {

func (r *raftLogger) Debug(v ...interface{}) {
if log.V(3) {
log.InfofDepth(r.ctx, 1, "", v...)
log.InfofDepth(r.ctx, 1, "%s", fmt.Sprint(v...))
}
}

Expand All @@ -71,7 +71,7 @@ func (r *raftLogger) Debugf(format string, v ...interface{}) {

func (r *raftLogger) Info(v ...interface{}) {
if log.V(2) {
log.InfofDepth(r.ctx, 1, "", v...)
log.InfofDepth(r.ctx, 1, "%s", fmt.Sprint(v...))
}
}

Expand All @@ -82,15 +82,15 @@ func (r *raftLogger) Infof(format string, v ...interface{}) {
}

func (r *raftLogger) Warning(v ...interface{}) {
log.WarningfDepth(r.ctx, 1, "", v...)
log.WarningfDepth(r.ctx, 1, "%s", fmt.Sprint(v...))
}

func (r *raftLogger) Warningf(format string, v ...interface{}) {
log.WarningfDepth(r.ctx, 1, format, v...)
}

func (r *raftLogger) Error(v ...interface{}) {
log.ErrorfDepth(r.ctx, 1, "", v...)
log.ErrorfDepth(r.ctx, 1, "%s", fmt.Sprint(v...))
}

func (r *raftLogger) Errorf(format string, v ...interface{}) {
Expand All @@ -99,7 +99,7 @@ func (r *raftLogger) Errorf(format string, v ...interface{}) {

func (r *raftLogger) Fatal(v ...interface{}) {
wrapNumbersAsSafe(v)
log.FatalfDepth(r.ctx, 1, "", v...)
log.FatalfDepth(r.ctx, 1, "%s", fmt.Sprint(v...))
}

func (r *raftLogger) Fatalf(format string, v ...interface{}) {
Expand All @@ -109,7 +109,7 @@ func (r *raftLogger) Fatalf(format string, v ...interface{}) {

func (r *raftLogger) Panic(v ...interface{}) {
wrapNumbersAsSafe(v)
log.FatalfDepth(r.ctx, 1, "", v...)
log.FatalfDepth(r.ctx, 1, "%s", fmt.Sprint(v...))
}

func (r *raftLogger) Panicf(format string, v ...interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -1473,8 +1473,8 @@ func (c *SyncedCluster) Put(ctx context.Context, l *logger.Logger, src, dest str
return err
}
redColor, resetColor := "\033[31m", "\033[0m"
l.Printf(redColor + "WARNING: Source file is a symlink." + resetColor)
l.Printf(redColor+"WARNING: Remote file will inherit the target permissions '%v'."+resetColor, symlinkTargetInfo.Mode())
l.Printf("%sWARNING: Source file is a symlink.%s", redColor, resetColor)
l.Printf("%sWARNING: Remote file will inherit the target permissions '%v'.%s", redColor, symlinkTargetInfo.Mode(), resetColor)
}

// NB: This value was determined with a few experiments. Higher values were
Expand Down
4 changes: 2 additions & 2 deletions pkg/roachprod/install/cockroach.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ func (c *SyncedCluster) initializeCluster(ctx context.Context, l *logger.Logger,
}

if out := strings.TrimSpace(string(out)); out != "" {
l.Printf(out)
l.Printf("%s", out)
}
return nil
}
Expand All @@ -667,7 +667,7 @@ func (c *SyncedCluster) setClusterSettings(ctx context.Context, l *logger.Logger
return errors.Wrapf(err, "~ %s\n%s", cmd, out)
}
if out := strings.TrimSpace(string(out)); out != "" {
l.Printf(out)
l.Printf("%s", out)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/roachprod/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func Install(ctx context.Context, l *logger.Logger, c *SyncedCluster, args []str
var buf bytes.Buffer
err := c.Run(ctx, l, &buf, &buf, c.Nodes, "installing "+title, cmd)
if err != nil {
l.Printf(buf.String())
l.Printf("%s", buf.String())
}
return err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/server/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ func serverError(ctx context.Context, err error) error {
// Include the PGCode in the message for easier troubleshooting
errCode := pgerror.GetPGCode(err).String()
if errCode != pgcode.Uncategorized.String() {
errMessage := fmt.Sprintf("%s Error Code: %s", errAPIInternalErrorString, errCode)
return status.Errorf(codes.Internal, errMessage)
return status.Errorf(codes.Internal, "%s Error Code: %s", errAPIInternalErrorString, errCode)
}

// The error is already grpcstatus formatted error.
Expand Down
1 change: 1 addition & 0 deletions pkg/server/api_v2_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var errAPIInternalErrorString = "An internal server error has occurred. Please c

var errAPIInternalError = status.Errorf(
codes.Internal,
"%s",
errAPIInternalErrorString,
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/server/decommission.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *Server) Decommission(
return grpcstatus.Error(codes.NotFound, liveness.ErrMissingRecord.Error())
}
log.Errorf(ctx, "%+s", err)
return grpcstatus.Errorf(codes.Internal, err.Error())
return grpcstatus.Errorf(codes.Internal, "%s", err.Error())
}
if statusChanged {
nodeDetails.TargetNodeID = int32(nodeID)
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *adminServer) Drain(req *serverpb.DrainRequest, stream serverpb.Admin_Dr
// Which node is this request for?
nodeID, local, err := s.server.status.parseNodeID(req.NodeId)
if err != nil {
return status.Errorf(codes.InvalidArgument, err.Error())
return status.Errorf(codes.InvalidArgument, "%s", err.Error())
}
if !local {
// This request is for another node. Forward it.
Expand Down
6 changes: 3 additions & 3 deletions pkg/server/problem_ranges.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (s *statusServer) ProblemRanges(
if len(req.NodeID) > 0 {
requestedNodeID, _, err := s.parseNodeID(req.NodeID)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
}
isLiveMap = liveness.IsLiveMap{
requestedNodeID: liveness.IsLiveMapEntry{IsLive: true},
Expand Down Expand Up @@ -76,7 +76,7 @@ func (s *statusServer) ProblemRanges(
// Context completed, response no longer needed.
}
}); err != nil {
return nil, status.Errorf(codes.Internal, err.Error())
return nil, status.Errorf(codes.Internal, "%s", err.Error())
}
}

Expand Down Expand Up @@ -145,7 +145,7 @@ func (s *statusServer) ProblemRanges(
sort.Sort(roachpb.RangeIDSlice(problems.CircuitBreakerErrorRangeIDs))
response.ProblemsByNodeID[resp.nodeID] = problems
case <-ctx.Done():
return nil, status.Errorf(codes.DeadlineExceeded, ctx.Err().Error())
return nil, status.Errorf(codes.DeadlineExceeded, "%s", ctx.Err().Error())
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/server/sql_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s *statusServer) ResetSQLStats(
if len(req.NodeID) > 0 {
requestedNodeID, local, err := s.parseNodeID(req.NodeID)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
}
if local {
controller.ResetLocalSQLStats(ctx)
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/statements.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (s *statusServer) Statements(
if len(req.NodeID) > 0 {
requestedNodeID, local, err := s.parseNodeID(req.NodeID)
if err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
}
if local {
return statementsLocal(
Expand Down
Loading