Skip to content

Commit

Permalink
*: replace word error in warning, info, debug logs (pingcap#12050)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackysp authored and sre-bot committed Sep 9, 2019
1 parent e19138f commit 1ef81a8
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 22 deletions.
6 changes: 4 additions & 2 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ func (w *worker) updateDDLJob(t *meta.Meta, job *model.Job, meetErr bool) error
// If there is an error when running job and the RawArgs hasn't been decoded by DecodeArgs,
// so we shouldn't replace RawArgs with the marshaling Args.
if meetErr && (job.RawArgs != nil && job.Args == nil) {
logutil.Logger(w.logCtx).Info("[ddl] meet error before update DDL job, shouldn't update raw args", zap.String("job", job.String()))
logutil.Logger(w.logCtx).Info("[ddl] meet something wrong before update DDL job, shouldn't update raw args",
zap.String("job", job.String()))
updateRawArgs = false
}
return errors.Trace(t.UpdateDDLJob(0, job, updateRawArgs))
Expand Down Expand Up @@ -427,7 +428,8 @@ func (w *worker) handleDDLJobQueue(d *ddlCtx) error {
if runJobErr != nil {
// wait a while to retry again. If we don't wait here, DDL will retry this job immediately,
// which may act like a deadlock.
logutil.Logger(w.logCtx).Info("[ddl] run DDL job error, sleeps a while then retries it.", zap.Duration("waitTime", WaitTimeWhenErrorOccured), zap.Error(runJobErr))
logutil.Logger(w.logCtx).Info("[ddl] run DDL job failed, sleeps a while then retries it.",
zap.Duration("waitTime", WaitTimeWhenErrorOccured), zap.Error(runJobErr))
time.Sleep(WaitTimeWhenErrorOccured)
}

Expand Down
3 changes: 2 additions & 1 deletion ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,8 @@ func (w *worker) waitTaskResults(workers []*addIndexWorker, taskCnt int, totalAd
}

if result.err != nil {
logutil.BgLogger().Warn("[ddl] add index worker return error", zap.Int("workerID", worker.id), zap.Error(result.err))
logutil.BgLogger().Warn("[ddl] add index worker failed", zap.Int("workerID", worker.id),
zap.Error(result.err))
}

if firstErr == nil {
Expand Down
2 changes: 1 addition & 1 deletion executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ func (a *ExecStmt) handlePessimisticLockError(ctx context.Context, err error) (E
errStr := err.Error()
conflictCommitTS := extractConflictCommitTS(errStr)
if conflictCommitTS == 0 {
logutil.Logger(ctx).Warn("failed to extract conflictCommitTS from a conflict error")
logutil.Logger(ctx).Warn("failed to extract conflictCommitTS when write conflicted")
}
forUpdateTS := txnCtx.GetForUpdateTS()
logutil.Logger(ctx).Info("pessimistic write conflict, retry statement",
Expand Down
2 changes: 1 addition & 1 deletion executor/insert_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (e *InsertValues) handleErr(col *table.Column, val *types.Datum, rowIdx int
if types.ErrTruncated.Equal(err) {
valStr, err1 := val.ToString()
if err1 != nil {
logutil.BgLogger().Warn("truncate error", zap.Error(err1))
logutil.BgLogger().Warn("truncate value failed", zap.Error(err1))
}
return table.ErrTruncatedWrongValueForField.GenWithStackByArgs(types.TypeStr(col.Tp), valStr, col.Name.O, rowIdx+1)
}
Expand Down
2 changes: 1 addition & 1 deletion planner/core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (ds *DataSource) deriveStatsByFilter(conds expression.CNFExprs) {
ds.TblColHists = ds.statisticTable.ID2UniqueID(ds.TblCols)
selectivity, nodes, err := tableStats.HistColl.Selectivity(ds.ctx, conds)
if err != nil {
logutil.BgLogger().Debug("an error happened, use the default selectivity", zap.Error(err))
logutil.BgLogger().Debug("something wrong happened, use the default selectivity", zap.Error(err))
selectivity = selectionFactor
}
ds.stats = tableStats.Scale(selectivity)
Expand Down
7 changes: 4 additions & 3 deletions server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (cc *clientConn) getSessionVarsWaitTimeout(ctx context.Context) uint64 {
}
waitTimeout, err := strconv.ParseUint(valStr, 10, 64)
if err != nil {
logutil.Logger(ctx).Warn("get sysval wait_timeout error, use default value", zap.Error(err))
logutil.Logger(ctx).Warn("get sysval wait_timeout failed, use default value", zap.Error(err))
// if get waitTimeout error, use default value
return variable.DefWaitTimeout
}
Expand Down Expand Up @@ -666,8 +666,9 @@ func (cc *clientConn) Run(ctx context.Context) {
}
return
}
logutil.Logger(ctx).Warn("dispatch error",
logutil.Logger(ctx).Warn("command dispatched failed",
zap.String("connInfo", cc.String()),
zap.String("command", mysql.Command2Str[data[0]]),
zap.String("sql", queryStrForLog(string(data[1:]))),
zap.String("err", errStrForLog(err)),
)
Expand Down Expand Up @@ -1471,7 +1472,7 @@ func (cc *clientConn) handleChangeUser(ctx context.Context, data []byte) error {
cc.dbname = string(hack.String(dbName))
err := cc.ctx.Close()
if err != nil {
logutil.Logger(ctx).Debug("close old context error", zap.Error(err))
logutil.Logger(ctx).Debug("close old context failed", zap.Error(err))
}
err = cc.openSessionAndDoAuth(pass)
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ func (s *session) executeStatement(ctx context.Context, connID uint64, stmtNode
recordSet, err := runStmt(ctx, s, stmt)
if err != nil {
if !kv.ErrKeyExists.Equal(err) {
logutil.Logger(ctx).Warn("run statement error",
logutil.Logger(ctx).Warn("run statement failed",
zap.Int64("schemaVersion", s.sessionVars.TxnCtx.SchemaVersion),
zap.Error(err),
zap.String("session", s.String()))
Expand Down Expand Up @@ -1064,9 +1064,9 @@ func (s *session) execute(ctx context.Context, sql string) (recordSets []sqlexec
stmtNodes, warns, err := s.ParseSQL(ctx, sql, charsetInfo, collation)
if err != nil {
s.rollbackOnError(ctx)
logutil.Logger(ctx).Warn("parse sql error",
logutil.Logger(ctx).Warn("parse SQL failed",
zap.Error(err),
zap.String("sql", sql))
zap.String("SQL", sql))
return nil, util.SyntaxError(err)
}
durParse := time.Since(startTS)
Expand All @@ -1092,9 +1092,9 @@ func (s *session) execute(ctx context.Context, sql string) (recordSets []sqlexec
stmt, err := compiler.Compile(ctx, stmtNode)
if err != nil {
s.rollbackOnError(ctx)
logutil.Logger(ctx).Warn("compile sql error",
logutil.Logger(ctx).Warn("compile SQL failed",
zap.Error(err),
zap.String("sql", sql))
zap.String("SQL", sql))
return nil, err
}
durCompile := time.Since(startTS)
Expand Down
6 changes: 3 additions & 3 deletions session/tidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ func Compile(ctx context.Context, sctx sessionctx.Context, stmtNode ast.StmtNode
func finishStmt(ctx context.Context, sctx sessionctx.Context, se *session, sessVars *variable.SessionVars, meetsErr error) error {
if meetsErr != nil {
if !sessVars.InTxn() {
logutil.BgLogger().Info("rollbackTxn for ddl/autocommit error.")
logutil.BgLogger().Info("rollbackTxn for ddl/autocommit failed")
se.RollbackTxn(ctx)
} else if se.txn.Valid() && se.txn.IsPessimistic() && executor.ErrDeadlock.Equal(meetsErr) {
logutil.BgLogger().Info("rollbackTxn for deadlock error", zap.Uint64("txn", se.txn.StartTS()))
logutil.BgLogger().Info("rollbackTxn for deadlock", zap.Uint64("txn", se.txn.StartTS()))
se.RollbackTxn(ctx)
}
return meetsErr
Expand Down Expand Up @@ -244,7 +244,7 @@ func runStmt(ctx context.Context, sctx sessionctx.Context, s sqlexec.Statement)
}
}
} else {
logutil.BgLogger().Error("get txn error", zap.Error(err1))
logutil.BgLogger().Error("get txn failed", zap.Error(err1))
}
}
err = finishStmt(ctx, sctx, se, sessVars, err)
Expand Down
6 changes: 4 additions & 2 deletions statistics/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@ func (coll *HistColl) NewHistCollBySelectivity(sc *stmtctx.StatementContext, sta
}
newIdxHist, err := idxHist.newIndexBySelectivity(sc, node)
if err != nil {
logutil.BgLogger().Warn("[Histogram-in-plan]: error happened when calculating row count, failed to build histogram for index %v of table %v",
logutil.BgLogger().Warn("[Histogram-in-plan]: something wrong happened when calculating row count, "+
"failed to build histogram for index %v of table %v",
zap.String("index", idxHist.Info.Name.O), zap.String("table", idxHist.Info.Table.O), zap.Error(err))
continue
}
Expand Down Expand Up @@ -1031,7 +1032,8 @@ func (coll *HistColl) NewHistCollBySelectivity(sc *stmtctx.StatementContext, sta
err = newHistogramBySelectivity(sc, node.ID, &oldCol.Histogram, &newCol.Histogram, splitRanges, coll.GetRowCountByColumnRanges)
}
if err != nil {
logutil.BgLogger().Warn("[Histogram-in-plan]: error happened when calculating row count", zap.Error(err))
logutil.BgLogger().Warn("[Histogram-in-plan]: something wrong happened when calculating row count",
zap.Error(err))
continue
}
newColl.Columns[node.ID] = newCol
Expand Down
2 changes: 1 addition & 1 deletion store/tikv/2pc.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ func (c *twoPhaseCommitter) execute(ctx context.Context) error {
zap.Uint64("txnStartTS", c.startTS))
return errors.Trace(err)
}
logutil.Logger(ctx).Debug("2PC succeed with error",
logutil.Logger(ctx).Debug("got some exceptions, but 2PC was still successful",
zap.Error(err),
zap.Uint64("txnStartTS", c.startTS))
}
Expand Down
2 changes: 1 addition & 1 deletion store/tikv/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (s *RegionRequestSender) onRegionError(bo *Backoffer, ctx *RPCContext, regi
}
// For other errors, we only drop cache here.
// Because caller may need to re-split the request.
logutil.BgLogger().Debug("tikv reports region error",
logutil.BgLogger().Debug("tikv reports region failed",
zap.Stringer("regionErr", regionErr),
zap.Stringer("ctx", ctx))
s.regionCache.InvalidateCachedRegion(ctx.Region)
Expand Down
2 changes: 1 addition & 1 deletion store/tikv/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ func extractKeyErr(keyErr *pb.KeyError) error {
}
if keyErr.Abort != "" {
err := errors.Errorf("tikv aborts txn: %s", keyErr.GetAbort())
logutil.BgLogger().Warn("error", zap.Error(err))
logutil.BgLogger().Warn("2PC failed", zap.Error(err))
return errors.Trace(err)
}
return errors.Errorf("unexpected KeyError: %s", keyErr.String())
Expand Down

0 comments on commit 1ef81a8

Please sign in to comment.