This repository has been archived by the owner on Dec 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kennytm
force-pushed
the
kennytm/pingcap-log-3
branch
from
April 12, 2019 11:31
400a63f
to
03b305e
Compare
Some redundant logs (e.g. logging about the same thing inside and outside a function) are removed. The {QueryRow,Transact,Exec}WithRetry functions are revamped to include the logger.
kennytm
force-pushed
the
kennytm/pingcap-log-3
branch
from
April 16, 2019 18:07
03b305e
to
33759a6
Compare
kennytm
changed the title
[WIP] *: use pingcap/log (zap) for logging
*: use pingcap/log (zap) for logging
Apr 16, 2019
/run-all-tests tidb=master tikv=master pd=master |
kennytm
commented
Apr 16, 2019
kennytm
added
priority/important
status/PTAL
This PR is ready for review. Add this label back after committing new changes
type/enhancement
Performance improvement or refactoring
labels
Apr 16, 2019
csuzhangxc
reviewed
Apr 17, 2019
csuzhangxc
reviewed
Apr 17, 2019
/run-all-tests |
csuzhangxc
reviewed
Apr 19, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
csuzhangxc
added
status/LGT1
One reviewer already commented LGTM (LGTM1)
and removed
status/PTAL
This PR is ready for review. Add this label back after committing new changes
labels
Apr 19, 2019
july2993
reviewed
Apr 19, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest LGTM
lonng
reviewed
Apr 19, 2019
lonng
reviewed
Apr 19, 2019
lonng
approved these changes
Apr 19, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
/run-all-tests |
july2993
reviewed
Apr 19, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
july2993
added
status/LGT2
Two reviewers already commented LGTM, ready for merge (LGTM2)
and removed
status/LGT1
One reviewer already commented LGTM (LGTM1)
labels
Apr 19, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
status/LGT2
Two reviewers already commented LGTM, ready for merge (LGTM2)
type/enhancement
Performance improvement or refactoring
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Switch to use the uniform log format.
What is changed and how it works?
The log library is changed from
logrus
tozap
, a structured logger.Due to how structured logging usually works, several interfaces are rewritten.
QueryRowWithRetry
/TransactWithRetry
/ExecWithRetry
originally writes log without any contextual information. These are modified to accept a logger. The common arguments are abstracted into anSQLWithRetry
type.All logging infrastructures (e.g.
common.AppLogger
) are moved fromcommon
into a newlog
package.common.AppLogger
, we need to define our own loggerlog.L()
distinct from the true global one"github.com/pingcap/log".L()
so we could control TiDB's logging level independently (though perhaps we could investigate whether merging the two is possible nowadays).log.ShortError
function, to avoid flooding the log with noise.This is codified into the
log.Task
type.Several redundant error logs are eliminated (e.g. if
f()
callsg()
callsh()
, andh()
logs an error, theng()
andf()
will not log the error again).Following pingcap/tidb#10025's lead, when refactoring a function, if an error is known to be a custom error,
errors.Trace
will no longer be applied. This will be done more thoroughly in the future, after unit-test coverage is improved.Check List
Tests
Side effects
Related changes