Skip to content

Commit

Permalink
Remove more unnecessary logs
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <ghzpotato@gmail.com>
  • Loading branch information
JmPotato committed Aug 27, 2021
1 parent 641394f commit a443374
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 18 deletions.
5 changes: 0 additions & 5 deletions errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,6 @@ error = '''
get local allocator failed, %s
'''

["PD:tso:ErrInvalidTimestamp"]
error = '''
invalid timestamp
'''

["PD:tso:ErrLogicOverflow"]
error = '''
logic part overflow
Expand Down
2 changes: 1 addition & 1 deletion metrics/grafana/pd.json
Original file line number Diff line number Diff line change
Expand Up @@ -9124,7 +9124,7 @@
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "PD server TSO handle time + Client revc time",
"title": "PD server TSO handle time",
"tooltip": {
"msResolution": false,
"shared": true,
Expand Down
1 change: 0 additions & 1 deletion pkg/errs/errno.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ var (
ErrSyncMaxTS = errors.Normalize("sync max ts failed, %s", errors.RFCCodeText("PD:tso:ErrSyncMaxTS"))
ErrResetUserTimestamp = errors.Normalize("reset user timestamp failed, %s", errors.RFCCodeText("PD:tso:ErrResetUserTimestamp"))
ErrGenerateTimestamp = errors.Normalize("generate timestamp failed, %s", errors.RFCCodeText("PD:tso:ErrGenerateTimestamp"))
ErrInvalidTimestamp = errors.Normalize("invalid timestamp", errors.RFCCodeText("PD:tso:ErrInvalidTimestamp"))
ErrLogicOverflow = errors.Normalize("logic part overflow", errors.RFCCodeText("PD:tso:ErrLogicOverflow"))
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/errs/errs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ func (s *testErrorSuite) TestError(c *C) {
log.ReplaceGlobals(lg.Logger, nil)

rfc := `[error="[PD:tso:ErrInvalidTimestamp]invalid timestamp"]`
log.Error("test", zap.Error(ErrInvalidTimestamp.FastGenByArgs()))
log.Error("test", zap.Error(ErrEtcdLeaderNotFound.FastGenByArgs()))
c.Assert(strings.Contains(lg.Message(), rfc), IsTrue)
err := errors.New("test error")
log.Error("test", ZapError(ErrInvalidTimestamp, err))
log.Error("test", ZapError(ErrEtcdLeaderNotFound, err))
rfc = `[error="[PD:tso:ErrInvalidTimestamp]test error"]`
c.Assert(strings.Contains(lg.Message(), rfc), IsTrue)
}
Expand Down
4 changes: 0 additions & 4 deletions server/tso/global_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ func (gta *GlobalTSOAllocator) getSyncRTT() int64 {
func (gta *GlobalTSOAllocator) estimateMaxTS(count uint32, suffixBits int) (*pdpb.Timestamp, bool, error) {
physical, logical, lastUpdateTime := gta.timestampOracle.generateTSO(int64(count), 0)
if physical == 0 {
log.Error("invalid global tso in memory, unable to estimate maxTSO",
zap.Any("timestamp-physical", physical),
zap.Any("timestamp-logical", logical),
errs.ZapError(errs.ErrInvalidTimestamp))
return &pdpb.Timestamp{}, false, errs.ErrGenerateTimestamp.FastGenByArgs("timestamp in memory isn't initialized")
}
estimatedMaxTSO := &pdpb.Timestamp{
Expand Down
6 changes: 1 addition & 5 deletions server/tso/tso.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,18 +358,14 @@ func (t *timestampOracle) getTS(leadership *election.Leadership, count uint32, s
return resp, errs.ErrGenerateTimestamp.FastGenByArgs("tso count should be positive")
}
for i := 0; i < maxRetryCount; i++ {
currentPhysical, currentLogical := t.getTSO()
currentPhysical, _ := t.getTSO()
if currentPhysical == typeutil.ZeroTime {
// If it's leader, maybe SyncTimestamp hasn't completed yet
if leadership.Check() {
time.Sleep(200 * time.Millisecond)
continue
}
tsoCounter.WithLabelValues("not_leader_anymore", t.dcLocation).Inc()
log.Error("invalid timestamp",
zap.Any("timestamp-physical", currentPhysical),
zap.Any("timestamp-logical", currentLogical),
errs.ZapError(errs.ErrInvalidTimestamp))
return pdpb.Timestamp{}, errs.ErrGenerateTimestamp.FastGenByArgs("timestamp in memory isn't initialized")
}
// Get a new TSO result with the given count
Expand Down

0 comments on commit a443374

Please sign in to comment.