Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

domain,owner: unify and normalize the format of the log #9646

Merged
merged 60 commits into from
Mar 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
bb703a7
add head file in owner/manager
xiekeyi98 Mar 11, 2019
d04c884
change owner/manager.go
xiekeyi98 Mar 11, 2019
3a58e24
change domain/domin.go
xiekeyi98 Mar 11, 2019
d22c48e
change domain/schema_validator.go
xiekeyi98 Mar 11, 2019
b1fec09
change domain/info.go
xiekeyi98 Mar 11, 2019
490613a
Merge remote-tracking branch 'upstream/master' into TiDB-3014
xiekeyi98 Mar 12, 2019
e0cbde9
toLower
xiekeyi98 Mar 12, 2019
d5cf79e
address comment
xiekeyi98 Mar 15, 2019
aebb423
change Any to explict
xiekeyi98 Mar 15, 2019
415c2b1
Merge remote-tracking branch 'upstream/master' into TiDB-3014
xiekeyi98 Mar 15, 2019
abd197a
replace log to logutil
xiekeyi98 Mar 15, 2019
9fae8cd
Merge remote-tracking branch 'upstream/master' into TiDB-3014
xiekeyi98 Mar 15, 2019
d39dad9
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 18, 2019
4615d8c
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 19, 2019
0c283e9
Update owner/manager.go
xiekeyi98 Mar 19, 2019
f47396b
Update owner/manager.go
xiekeyi98 Mar 19, 2019
2207a3c
Update domain/domain.go
xiekeyi98 Mar 19, 2019
10c151a
Update domain/domain.go
xiekeyi98 Mar 19, 2019
fd74027
Update domain/domain.go
xiekeyi98 Mar 19, 2019
fd1844a
Update domain/domain.go
xiekeyi98 Mar 19, 2019
15cbaa3
Update owner/manager.go
xiekeyi98 Mar 19, 2019
77b7481
Update owner/manager.go
xiekeyi98 Mar 19, 2019
c36610d
Update domain/domain.go
xiekeyi98 Mar 19, 2019
d01e1d9
Update domain/domain.go
xiekeyi98 Mar 19, 2019
af70420
Update domain/domain.go
xiekeyi98 Mar 19, 2019
f97af0f
Update domain/domain.go
xiekeyi98 Mar 19, 2019
097cb0f
Update domain/domain.go
xiekeyi98 Mar 19, 2019
c639497
Update domain/domain.go
xiekeyi98 Mar 19, 2019
4501598
Update domain/domain.go
xiekeyi98 Mar 19, 2019
c917e96
Update domain/domain.go
xiekeyi98 Mar 19, 2019
d4b57b0
Apply suggestions from code review
xiekeyi98 Mar 19, 2019
5a5030f
Update domain/domain.go
xiekeyi98 Mar 19, 2019
2b7bf28
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 19, 2019
303cc4a
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 21, 2019
00585c9
Update domain/domain.go
xiekeyi98 Mar 21, 2019
241effa
Update owner/manager.go
xiekeyi98 Mar 21, 2019
fde9a82
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 21, 2019
c565225
Apply suggestions from code review
crazycs520 Mar 21, 2019
215a78d
Apply suggestions from code review
xiekeyi98 Mar 21, 2019
a6be267
apply comment
xiekeyi98 Mar 21, 2019
40f87ea
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 21, 2019
a75d607
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 21, 2019
3290963
types: improve the code coverage (#9780)
xiekeyi98 Mar 21, 2019
bcf41c4
infoschema, util: fix idle sessions in processlist (#9854)
morgo Mar 22, 2019
0e0f812
planner/core: fix privilege check for grant on table (#9828)
tiancaiamao Mar 22, 2019
8af98bf
util: use uniform log format for util package (#9668)
jackysp Mar 22, 2019
6df22fe
types:change Map to switch in `GetFormatType` (#9851)
xiekeyi98 Mar 22, 2019
11c494d
expression: fix overflow when `signed + unsigned` (#9840)
wjhuang2016 Mar 22, 2019
548a78a
remove an unnecessary argument (#9857)
ngaut Mar 22, 2019
dc8e0ef
replace logCtx with context.Background()
xiekeyi98 Mar 22, 2019
da24bdf
Merge remote-tracking branch 'upstream/master' into TiDB-3014
xiekeyi98 Mar 22, 2019
0cfe640
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 22, 2019
ea2efbf
adress comment
xiekeyi98 Mar 23, 2019
a97d104
Merge remote-tracking branch 'upstream/master' into TiDB-3014
xiekeyi98 Mar 23, 2019
dcbc3d6
apply comment
xiekeyi98 Mar 24, 2019
8ce91e5
tidb code
xiekeyi98 Mar 24, 2019
d6a33fb
apply comment
xiekeyi98 Mar 24, 2019
bb2ca92
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 25, 2019
fdad6b8
Merge branch 'master' into TiDB-3014
xiekeyi98 Mar 25, 2019
bb9845a
Merge branch 'master' into TiDB-3014
winkyao Mar 25, 2019
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
Prev Previous commit
Next Next commit
replace log to logutil
  • Loading branch information
xiekeyi98 committed Mar 15, 2019
commit abd197a7ce09e283ff1616861236f1bd63851f8c
82 changes: 41 additions & 41 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/ngaut/pools"
"github.com/ngaut/sync2"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/parser"
"github.com/pingcap/parser/ast"
"github.com/pingcap/parser/model"
Expand Down Expand Up @@ -98,12 +97,12 @@ func (do *Domain) loadInfoSchema(handle *infoschema.Handle, usedSchemaVersion in
// Update self schema version to etcd.
defer func() {
if err != nil {
log.Info("cannot update self schema version to etcd.")
logutil.Logger(context.Background()).Info("cannot update self schema version to etcd.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
return
}
err = do.ddl.SchemaSyncer().UpdateSelfVersion(context.Background(), latestSchemaVersion)
if err != nil {
log.Info("update self version failed.", zap.Int64("usedSchemaVersion", usedSchemaVersion),
logutil.Logger(context.Background()).Info("update self version failed.", zap.Int64("usedSchemaVersion", usedSchemaVersion),
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
zap.Int64("latestSchemaVersion", latestSchemaVersion), zap.Error(err))
}
}()
Expand All @@ -112,10 +111,11 @@ func (do *Domain) loadInfoSchema(handle *infoschema.Handle, usedSchemaVersion in
ok, tblIDs, err := do.tryLoadSchemaDiffs(m, usedSchemaVersion, latestSchemaVersion)
if err != nil {
// We can fall back to full load, don't need to return the error.
log.Error("failed to load schema diff", zap.Error(err))

xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
logutil.Logger(context.Background()).Error("failed to load schema diff", zap.Error(err))
}
if ok {
log.Info("diff load InfoSchema from version failed.", zap.Int64("usedSchemaVersion", usedSchemaVersion),
logutil.Logger(context.Background()).Info("diff load InfoSchema from version failed.", zap.Int64("usedSchemaVersion", usedSchemaVersion),
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
zap.Int64("latestSchemaVersion", latestSchemaVersion), zap.Duration("time", time.Since(startTime)), zap.Int64s("tblIDs", tblIDs))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
return latestSchemaVersion, tblIDs, fullLoad, nil
}
Expand All @@ -130,7 +130,7 @@ func (do *Domain) loadInfoSchema(handle *infoschema.Handle, usedSchemaVersion in
if err != nil {
return 0, nil, fullLoad, errors.Trace(err)
}
log.Info("full load InfoSchema failed", zap.Int64("usedSchemaVersion", usedSchemaVersion),
logutil.Logger(context.Background()).Info("full load InfoSchema failed", zap.Int64("usedSchemaVersion", usedSchemaVersion),
zap.Int64("latestSchemaVersion", latestSchemaVersion), zap.Duration("time", time.Since(startTime)))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
newISBuilder.Build()
return latestSchemaVersion, nil, fullLoad, nil
Expand Down Expand Up @@ -336,7 +336,7 @@ func (do *Domain) Reload() error {
metrics.LoadSchemaCounter.WithLabelValues("succ").Inc()

if fullLoad {
log.Info("full load and reset schema validator.")
logutil.Logger(context.Background()).Info("full load and reset schema validator.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
do.SchemaValidator.Reset()
}
do.SchemaValidator.Update(ver.Ver, schemaVersion, latestSchemaVersion, changedTableIDs)
Expand All @@ -346,7 +346,7 @@ func (do *Domain) Reload() error {
// Reload interval is lease / 2, if load schema time elapses more than this interval,
// some query maybe responded by ErrInfoSchemaExpired error.
if sub > (lease/2) && lease > 0 {
log.Warn("loading schema takes a long time.", zap.Duration("time", sub))
logutil.Logger(context.Background()).Warn("loading schema takes a long time.", zap.Duration("time", sub))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}

return nil
Expand Down Expand Up @@ -412,11 +412,11 @@ func (do *Domain) infoSyncerKeeper() {
for {
select {
case <-do.info.Done():
log.Info("server info syncer need to restart")
logutil.Logger(context.Background()).Info("server info syncer need to restart")
if err := do.info.Restart(context.Background()); err != nil {
log.Error("server restart failed", zap.Error(err))
logutil.Logger(context.Background()).Error("server restart failed", zap.Error(err))
}
log.Info("server info syncer restarted.")
logutil.Logger(context.Background()).Info("server info syncer restarted.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
case <-do.exit:
return
}
Expand All @@ -437,21 +437,21 @@ func (do *Domain) loadSchemaInLoop(lease time.Duration) {
case <-ticker.C:
err := do.Reload()
if err != nil {
log.Error("reload schema in loop.", zap.Error(err))
logutil.Logger(context.Background()).Error("reload schema in loop.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
case _, ok := <-syncer.GlobalVersionCh():
err := do.Reload()
if err != nil {
log.Error("reload schema in loop.", zap.Error(err))
logutil.Logger(context.Background()).Error("reload schema in loop.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
if !ok {
log.Warn("Reload schema in loop, schema syncer need rewatch")
logutil.Logger(context.Background()).Warn("Reload schema in loop, schema syncer need rewatch")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
// Make sure the rewatch doesn't affect load schema, so we watch the global schema version asynchronously.
syncer.WatchGlobalSchemaVer(context.Background())
}
case <-syncer.Done():
// The schema syncer stops, we need stop the schema validator to synchronize the schema version.
log.Info("reload schema in loop, schema syncer need restart")
logutil.Logger(context.Background()).Info("reload schema in loop, schema syncer need restart")
// The etcd is responsible for schema synchronization, we should ensure there is at most two different schema version
// in the TiDB cluster, to make the data/schema be consistent. If we lost connection/session to etcd, the cluster
// will treats this TiDB as a down instance, and etcd will remove the key of `/tidb/ddl/all_schema_versions/tidb-id`.
Expand All @@ -461,18 +461,18 @@ func (do *Domain) loadSchemaInLoop(lease time.Duration) {
do.SchemaValidator.Stop()
err := do.mustRestartSyncer()
if err != nil {
log.Error("reload schema in loop, schema syncer restart err.", zap.Error(err))
logutil.Logger(context.Background()).Error("reload schema in loop, schema syncer restart err.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
break
}
// The schema maybe changed, must reload schema then the schema validator can restart.
exitLoop := do.mustReload()
if exitLoop {
// domain is closed.
log.Error("domain is closed, exit loadSchemaInLoop")
logutil.Logger(context.Background()).Error("domain is closed, exit loadSchemaInLoop")
return
}
do.SchemaValidator.Restart()
log.Info("schema syncer restarted.")
logutil.Logger(context.Background()).Info("schema syncer restarted.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
case <-do.exit:
return
}
Expand All @@ -497,7 +497,7 @@ func (do *Domain) mustRestartSyncer() error {
default:
}
time.Sleep(time.Second)
log.Info("restart the schema syncer failed.", zap.Error(err))
logutil.Logger(context.Background()).Info("restart the schema syncer failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -507,15 +507,15 @@ func (do *Domain) mustReload() (exitLoop bool) {
for {
err := do.Reload()
if err == nil {
log.Info("mustReload succeed.")
logutil.Logger(context.Background()).Info("mustReload succeed.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
return false
}

log.Info("reload the schema failed.", zap.Error(err))
logutil.Logger(context.Background()).Info("reload the schema failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
// If the domain is closed, we returns immediately.
select {
case <-do.exit:
log.Info("domain is closed.")
logutil.Logger(context.Background()).Info("domain is closed.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
return true
default:
}
Expand All @@ -539,7 +539,7 @@ func (do *Domain) Close() {
do.sysSessionPool.Close()
do.slowQuery.Close()
do.wg.Wait()
log.Info("closed")
logutil.Logger(context.Background()).Info("closed")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}

type ddlCallback struct {
Expand All @@ -551,11 +551,11 @@ func (c *ddlCallback) OnChanged(err error) error {
if err != nil {
return err
}
log.Info("doing DDL change, must reload")
logutil.Logger(context.Background()).Info("doing DDL change, must reload")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/doing DDL/doing DDL
BTW, You prefer 'doing' to 'on'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logutil.Logger(context.Background()).Info("doing DDL change, must reload")
logutil.Logger(context.Background()).Info("on DDL change, must reload")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer "performing DDL change" or "ddl change in progress". on/doing DDL is not a natural way to word this.


err = c.do.Reload()
if err != nil {
log.Error("doing DDL change failed", zap.Error(err))
logutil.Logger(context.Background()).Error("doing DDL change failed", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}

return nil
Expand Down Expand Up @@ -773,7 +773,7 @@ func (do *Domain) LoadPrivilegeLoop(ctx sessionctx.Context) error {
case <-time.After(duration):
}
if !ok {
log.Error("load privilege loop watch channel closed.")
logutil.Logger(context.Background()).Error("load privilege loop watch channel closed.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
watchCh = do.etcdClient.Watch(context.Background(), privilegeKey)
count++
if count > 10 {
Expand All @@ -786,9 +786,9 @@ func (do *Domain) LoadPrivilegeLoop(ctx sessionctx.Context) error {
err := do.privHandle.Update(ctx)
metrics.LoadPrivilegeCounter.WithLabelValues(metrics.RetLabel(err)).Inc()
if err != nil {
log.Error("load privilege failed.", zap.Error(err))
logutil.Logger(context.Background()).Error("load privilege failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
} else {
log.Debug("reload privilege success.")
logutil.Logger(context.Background()).Debug("reload privilege success.")
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}()
Expand Down Expand Up @@ -896,7 +896,7 @@ func (do *Domain) newStatsOwner() owner.Manager {
// TODO: Need to do something when err is not nil.
err := statsOwner.CampaignOwner(cancelCtx)
if err != nil {
log.Warn("campaign owner failed.", zap.Error(err))
logutil.Logger(context.Background()).Warn("campaign owner failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
return statsOwner
}
Expand All @@ -921,9 +921,9 @@ func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager)
t := time.Now()
err := statsHandle.InitStats(do.InfoSchema())
if err != nil {
log.Debug("init stats info failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("init stats info failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
} else {
log.Info("init stats info time.", zap.Duration("time", time.Since(t)))
logutil.Logger(context.Background()).Info("init stats info time.", zap.Duration("time", time.Since(t)))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
defer func() {
do.SetStatsUpdating(false)
Expand All @@ -934,7 +934,7 @@ func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager)
case <-loadTicker.C:
err = statsHandle.Update(do.InfoSchema())
if err != nil {
log.Debug("update stats info failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("update stats info failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
case <-do.exit:
statsHandle.FlushStats()
Expand All @@ -943,18 +943,18 @@ func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager)
case t := <-statsHandle.DDLEventCh():
err = statsHandle.HandleDDLEvent(t)
if err != nil {
log.Debug("handle ddl event failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("handle ddl event failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
case <-deltaUpdateTicker.C:
err = statsHandle.DumpStatsDeltaToKV(statistics.DumpDelta)
if err != nil {
log.Debug("dump stats delta failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("dump stats delta failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
statsHandle.UpdateErrorRate(do.InfoSchema())
case <-loadHistogramTicker.C:
err = statsHandle.LoadNeededHistograms()
if err != nil {
log.Debug("load histograms failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("load histograms failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
case <-loadFeedbackTicker.C:
statsHandle.UpdateStatsByLocalFeedback(do.InfoSchema())
Expand All @@ -963,20 +963,20 @@ func (do *Domain) updateStatsWorker(ctx sessionctx.Context, owner owner.Manager)
}
err = statsHandle.HandleUpdateStats(do.InfoSchema())
if err != nil {
log.Debug("update stats using feedback failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("update stats using feedback failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
case <-dumpFeedbackTicker.C:
err = statsHandle.DumpStatsFeedbackToKV()
if err != nil {
log.Debug("dump stats feedback failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("dump stats feedback failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
case <-gcStatsTicker.C:
if !owner.IsOwner() {
continue
}
err = statsHandle.GCStats(do.InfoSchema(), do.DDL().GetLease())
if err != nil {
log.Debug("GC stats failed.", zap.Error(err))
logutil.Logger(context.Background()).Debug("GC stats failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down Expand Up @@ -1011,13 +1011,13 @@ func (do *Domain) NotifyUpdatePrivilege(ctx sessionctx.Context) {
row := do.etcdClient.KV
_, err := row.Put(context.Background(), privilegeKey, "")
if err != nil {
log.Warn("notify update privilege failed", zap.Error(err))
logutil.Logger(context.Background()).Warn("notify update privilege failed", zap.Error(err))
}
}
// update locally
_, _, err := ctx.(sqlexec.RestrictedSQLExecutor).ExecRestrictedSQL(ctx, `FLUSH PRIVILEGES`)
if err != nil {
log.Error("unable to update privileges.", zap.Error(err))
logutil.Logger(context.Background()).Error("unable to update privileges.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand All @@ -1027,7 +1027,7 @@ func recoverInDomain(funcName string, quit bool) {
return
}
buf := util.GetStack()
log.Error("recover in domain failed.", zap.String("function name", funcName),
logutil.Logger(context.Background()).Error("recover in domain failed.", zap.String("function name", funcName),
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
zap.Any("error", r), zap.String("buffer", string(buf)))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
metrics.PanicCounter.WithLabelValues(metrics.LabelDomain).Inc()
if quit {
Expand Down
8 changes: 4 additions & 4 deletions domain/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/clientv3/concurrency"
"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/ddl"
"github.com/pingcap/tidb/owner"
"github.com/pingcap/tidb/util/hack"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/printer"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -140,7 +140,7 @@ func (is *InfoSyncer) RemoveServerInfo() {
}
err := ddl.DeleteKeyFromEtcd(is.serverInfoPath, is.etcdCli, keyOpDefaultRetryCnt, keyOpDefaultTimeout)
if err != nil {
log.Error("remove server info failed.", zap.Error(err))
logutil.Logger(context.Background()).Error("remove server info failed.", zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down Expand Up @@ -189,15 +189,15 @@ func getInfo(ctx context.Context, etcdCli *clientv3.Client, key string, retryCnt
resp, err = etcdCli.Get(childCtx, key, opts...)
cancel()
if err != nil {
log.Info("get key failed.", zap.String("key", key), zap.Error(err))
logutil.Logger(context.Background()).Info("get key failed.", zap.String("key", key), zap.Error(err))
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
time.Sleep(200 * time.Millisecond)
continue
}
for _, kv := range resp.Kvs {
info := &ServerInfo{}
err = json.Unmarshal(kv.Value, info)
if err != nil {
log.Info("get key failed.", zap.String("key", string(kv.Key)), zap.ByteString("value", kv.Value),
logutil.Logger(context.Background()).Info("get key failed.", zap.String("key", string(kv.Key)), zap.ByteString("value", kv.Value),
xiekeyi98 marked this conversation as resolved.
Show resolved Hide resolved
zap.Error(err))
return nil, errors.Trace(err)
}
Expand Down
Loading