-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
types, *: move truncate flags to the types context #47522
Conversation
Skipping CI for Draft Pull Request. |
/test all |
Skipping CI for Draft Pull Request. |
12011de
to
6b8465c
Compare
153b1d8
to
b75eacd
Compare
9c98e8c
to
57b1ee4
Compare
/retest |
0d4c3f7
to
44b4fa9
Compare
/retest |
pkg/sessionctx/stmtctx/stmtctx.go
Outdated
} | ||
|
||
ctx := typectx.NewContext(typectx.StrictFlags, time.UTC, func(err error) { | ||
logutil.BgLogger().Warn("append a warnings without proper statement context", zap.Error(err)) |
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.
Will this happen in a production environment? If it is true, I think we'd better not warn it. If not , I think it's better to create a context like this:
ctx := typectx.NewContext(typectx.StrictFlags, time.UTC, func(err error) { assert(false) })
So that we can see the warning function is called by mistake
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.
I think the best way is to forbid all nil arguments of stmtctx.StatementContext
. But I'm not sure it is practice practical now
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.
Will this happen in a production environment?
Yes, now many functions in types
is passed with nil
statement context (some of them have been replaced by DefaultNoWarningContext
, but there are still some of them which will need to be changed in the future with our refractors).
I agree not to warn. I'll return DefaultNoWarningContext
directly in this function.
7033a2c
to
c0eb810
Compare
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
Signed-off-by: Yang Keao <[email protected]>
/LGTM |
[LGTM Timeline notifier]Timeline:
|
/approve |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lance6716, lcwangchao, xhebox, XuHuaiyu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
1 similar comment
/retest |
What problem does this PR solve?
Issue Number: close #47511
What is changed and how it works?
Move the
IgnoreTruncateErr
andTruncateAsWarning
flags from thestmtctx
totypes.Context
flags.Check List
Tests
These refractors are covered by existing tests.
Release note