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

executor: make set system variable log shorter #7029

Merged
merged 3 commits into from
Jul 11, 2018

Conversation

coocood
Copy link
Member

@coocood coocood commented Jul 10, 2018

What have you changed? (mandatory)

make set system variable log shorter

What are the type of the changes (mandatory)?

  • Improvement (non-breaking change which is an improvement to an existing feature)

Some application change system variable a lot, logging in short format saves disk space.

How has this PR been tested (mandatory)?

Manual

Some application change system variable a lot, logging in short format saves disk space.
@@ -178,7 +178,7 @@ func (e *SetExecutor) setSysVariable(name string, v *expression.VarAssignment) e
valStr, err = value.ToString()
terror.Log(errors.Trace(err))
}
log.Infof("[con:%d] set system variable %s = %s", sessionVars.ConnectionID, name, valStr)
log.Infof("con:%d %s=%s", sessionVars.ConnectionID, name, valStr)
Copy link
Member

Choose a reason for hiding this comment

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

do we need to keep this format [con:%d]?

Copy link
Member Author

Choose a reason for hiding this comment

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

There are places where con: is not enclosed by '[]'.
How about we should remove all the [] that enclosing con:?

Copy link
Contributor

Choose a reason for hiding this comment

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

should we more shorter use c: instead of conn:?

and I have a idea: maybe we encapsulation all log method and in ctx idioms, in the method body it use prealloc log header in thread load level(e.g. "c:123, tx:12, tr:33"), then need for every place to to fomat conn mannul, and no need to alloc header part every time?

@@ -986,7 +986,7 @@ func (s *session) NewTxn() error {
return errors.Trace(err)
}
vars := s.GetSessionVars()
log.Infof("[con:%d][schema ver:%d] NewTxn() inside a transaction auto commit: %d", vars.ConnectionID, vars.TxnCtx.SchemaVersion, txnID)
log.Infof("con:%d[schema ver:%d] NewTxn() inside a transaction auto commit: %d", vars.ConnectionID, vars.TxnCtx.SchemaVersion, txnID)
Copy link
Contributor

Choose a reason for hiding this comment

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

s/[schema ver:%d]/schema_ver:%d?

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

zz-jason
zz-jason previously approved these changes Jul 11, 2018
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala dismissed zz-jason’s stale review July 11, 2018 05:04

Please address my comment.

@coocood
Copy link
Member Author

coocood commented Jul 11, 2018

/run-all-tests

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason merged commit f9a5686 into pingcap:master Jul 11, 2018
@coocood coocood deleted the shorter-log branch July 11, 2018 06:09
@zz-jason zz-jason added type/enhancement The issue or PR belongs to an enhancement. status/LGT2 Indicates that a PR has LGTM 2. labels Jul 11, 2018
@coocood coocood added status/all tests passed status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement. and removed status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement. labels Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants