This article is an opportunity for me to give you TiDB Contributor, depending on whether you want it or not.


Intro

This article was written under the leadership of Liu boss. I also hope that more people will be involved through such small activities. Although these tasks are very simple, these small tasks can reflect our TiDB team’s perfect pursuit of code quality. This is what we should learn. This is an opportunity for you to improve/improve your code level. You shouldn’t give up easily.

Overview of the problem

Some of the % in TiDB’s test cases enclose the statement with double quotes "", but Github escaping it when displayed, so it will be marked with % red, and we are doing a review of It doesn’t look beautiful at the moment, so we need to change this and recommend replacing it with the Go language.

For examples: PR #5697

How to decide?

I can give you a reference note. If you use the Go syntax highlighting plug-in, then you can see that the unhighlighted part is escaping. It may be problematic. Then we need to make changes. [eg, 100%500, %W %r].

github_tidb_review_3

How to test and verify?

  1. First you have to fork TiDB (so that you can edit the file on GitHub).
  2. Open a suspicious file (For examples: util/stringutil/string_util_test.go).
  3. Find the code statement for the problem overview description.
  4. Modify the 3 corresponding code statement.
  5. Click Preview changes.
  6. Check and verify that your changes are correct.

Let me give you an example. It will be clear to see.

github_tidb_review_1 github_tidb_review_2

to add on

The above content is the original intention that we should change, but in fact we can do more.

Wrap all testkit’s pending SQL statements with `` .

Therefore, we should modify the SQL statements of the following methods by the way when we modify them.

  • Exec
  • MustExec
  • MustQuery

Todo List

The entire repair process took about 10 days.

Reference

  1. https://golang.org/ref/spec#String_literals

茶歇驿站

一个可以让你停下来看一看,在茶歇之余给你帮助的小站,这里的内容主要是后端技术,个人管理,团队管理,以及其他个人杂想。

茶歇驿站二维码 打赏