Skip to content

*: fix newtidb encoder #92

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

Merged
merged 4 commits into from
Oct 25, 2022
Merged

*: fix newtidb encoder #92

merged 4 commits into from
Oct 25, 2022

Conversation

xhebox
Copy link
Collaborator

@xhebox xhebox commented Sep 21, 2022

Signed-off-by: xhe xw897002528@gmail.com

What problem does this PR solve?

Issue Number: ref #8, pingcap/log section

Problem Summary: I made some mistakes when porting the encoder of pingcap/log. This PR should hopefully fix these issues.

What is changed and how it works:

  1. Correctly escape characters, but not all characters as pingcap/log. The requirements are: first, double quotes if needed; second, one message one line, no wrapping.
  2. Also escape AppendReflected and AddString, it is missed in my previous PR.
  3. AppendByteString will encode to hex automatically. This does not violate the RFC. It actually makes more sense. In tikv, []byte are mostly keys, which will be encoded into a human readable format. But that is not true in go or other components. Just convert all []byte to hex. If you need custom encoding, use zap.Stringer.
  4. remove encodeError. This workaround is already fixed by *: new tls configuration for operator #80
  5. fix problems with logger.With... etc, commented the reason for changes.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox requested a review from djshow832 September 21, 2022 10:00
@xhebox xhebox changed the title *: fix newtidb add string *: fix newtidb encoder Sep 21, 2022
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
@djshow832 djshow832 merged commit 87878b2 into pingcap:main Oct 25, 2022
@xhebox xhebox deleted the minor_4 branch October 26, 2022 06:22
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 7, 2023
xhebox added a commit to xhebox/TiProxy that referenced this pull request Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants