Skip to content

Commit

Permalink
store: Add more log (#10019)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiekeyi98 authored and winkyao committed Apr 7, 2019
1 parent bd34b28 commit f063e78
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/logutil"
"go.uber.org/zap"
)

var stores = make(map[string]kv.Driver)
Expand Down Expand Up @@ -65,9 +66,15 @@ func newStoreWithRetry(path string, maxRetries int) (kv.Storage, error) {

var s kv.Storage
err = util.RunWithRetry(maxRetries, util.RetryInterval, func() (bool, error) {
logutil.Logger(context.Background()).Info("new store")
logutil.Logger(context.Background()).Info("new store", zap.String("path", path))
s, err = d.Open(path)
return kv.IsRetryableError(err), err
})
return s, err

if err == nil {
logutil.Logger(context.Background()).Info("new store with retry success")
} else {
logutil.Logger(context.Background()).Warn("new store with retry failed", zap.Error(err))
}
return s, errors.Trace(err)
}

0 comments on commit f063e78

Please sign in to comment.