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

infoschema: add tidb_servers_info memory table #12580

Merged
merged 12 commits into from
Oct 14, 2019

Conversation

crazycs520
Copy link
Contributor

What problem does this PR solve?

  • infoschema: add tidb_servers_info memory table.
  • rename pkg name.
mysql>select * from `TIDB_SERVERS_INFO`
+--------------------------------------+----+------+-------------+-------+-----------------------------------------------+------------------------------------------+
| DDL_ID                               | IP | PORT | STATUS_PORT | LEASE | VERSION                                       | GIT_HASH                                 |
+--------------------------------------+----+------+-------------+-------+-----------------------------------------------+------------------------------------------+
| 69c3d3a5-c164-41c2-a48b-4826b5d1be4e |    | 4001 | 10081       | 45s   | 5.7.25-TiDB-v4.0.0-alpha-439-g8392e1be6-dirty | 8392e1be6b15b0e276356e9d02517ab08945a637 |
| db900860-47a8-4421-8e5f-844c0529ab49 |    | 4000 | 10080       | 45s   | 5.7.25-TiDB-v4.0.0-alpha-439-g8392e1be6-dirty | 8392e1be6b15b0e276356e9d02517ab08945a637 |
+--------------------------------------+----+------+-------------+-------+-----------------------------------------------+------------------------------------------+

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

@codecov
Copy link

codecov bot commented Oct 10, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@9597a4d). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             master    #12580   +/-   ##
==========================================
  Coverage          ?   80.178%           
==========================================
  Files             ?       462           
  Lines             ?    107048           
  Branches          ?         0           
==========================================
  Hits              ?     85829           
  Misses            ?     15094           
  Partials          ?      6125

@AilinKid
Copy link
Contributor

/run-all-tests

domain/infosync/info.go Outdated Show resolved Hide resolved
domain/infosync/info.go Outdated Show resolved Hide resolved
func (is *InfoSyncer) GetAllServerInfo(ctx context.Context) (map[string]*ServerInfo, error) {
func GetAllServerInfo(ctx context.Context) (map[string]*ServerInfo, error) {
if globalInfoSyncer == nil {
return nil, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

If globalInfoSyncer is nil, err shouldn't be nil. Otherwise it would panic when executing serverInfo.IP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great.

@djshow832
Copy link
Contributor

LGTM

@djshow832 djshow832 added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 12, 2019
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@@ -299,8 +300,7 @@ func (s *testSuiteP1) TestAdmin(c *C) {
// rowOwnerInfos := strings.Split(row.Data[1].GetString(), ",")
// ownerInfos := strings.Split(ddlInfo.Owner.String(), ",")
// c.Assert(rowOwnerInfos[0], Equals, ownerInfos[0])
do := domain.GetDomain(tk.Se.(sessionctx.Context))
serverInfo, err := do.InfoSyncer().GetServerInfoByID(ctx, row.GetString(1))
serverInfo, err := infosync.GetServerInfoByID(ctx, row.GetString(1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Cause server info can access in a manner of table, we need other tests for testing SQL on your memory table to prevent code coverage decrease.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see TestForServersInfo .

@c4pt0r
Copy link
Member

c4pt0r commented Oct 14, 2019

LGTM

@crazycs520 crazycs520 added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 14, 2019
@crazycs520
Copy link
Contributor Author

/run-all-tests

@crazycs520 crazycs520 merged commit 2dc472f into pingcap:master Oct 14, 2019
qiuyesuifeng pushed a commit to qiuyesuifeng/tidb that referenced this pull request Oct 17, 2019
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
crazycs520 added a commit to lzmhhh123/tidb that referenced this pull request Feb 13, 2020
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/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants