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

[WIP]handler: add /db-table?table_ids={...} #54280

Closed
wants to merge 7 commits into from

Conversation

lance6716
Copy link
Contributor

@lance6716 lance6716 commented Jun 27, 2024

What problem does this PR solve?

Issue Number: close #54281

Problem Summary:

What changed and how does it work?

curl http://{TiDBIP}:10080/db-table?table_ids={tableID,...}

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

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

None

Signed-off-by: lance6716 <lance6716@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 27, 2024
Copy link

tiprow bot commented Jun 27, 2024

Hi @lance6716. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wrong diff calculation 😂

Copy link
Contributor

Choose a reason for hiding this comment

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

can you point where are changed, diff so large

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. My IDE writes the correct order for the markdown item list
  2. add the new API under "10. Get database information, table information and tidb info schema version by tableID."

Signed-off-by: lance6716 <lance6716@gmail.com>
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 56.5699%. Comparing base (08147e7) to head (4df803e).
Report is 25 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54280         +/-   ##
=================================================
- Coverage   72.8476%   56.5699%   -16.2778%     
=================================================
  Files          1542       1669        +127     
  Lines        436136     619352     +183216     
=================================================
+ Hits         317715     350367      +32652     
- Misses        98837     245475     +146638     
- Partials      19584      23510       +3926     
Flag Coverage Δ
integration 37.0984% <2.9411%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.5347% <ø> (+6.6505%) ⬆️

Signed-off-by: lance6716 <lance6716@gmail.com>
@lance6716 lance6716 changed the title [WIP]handler: add /schema?table_ids={...} handler: add /schema?table_ids={...} Jun 27, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2024
@lance6716 lance6716 changed the title handler: add /schema?table_ids={...} handler: add /schema?table_ids={...} Jun 27, 2024
@lance6716 lance6716 changed the title handler: add /schema?table_ids={...} [WIP] handler: add /schema?table_ids={...} Jun 27, 2024
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 27, 2024
@lance6716 lance6716 changed the title [WIP] handler: add /schema?table_ids={...} handler: add /schema?table_ids={...} Jun 28, 2024
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 28, 2024
@lance6716 lance6716 changed the title handler: add /schema?table_ids={...} handler: add /db-table?table_ids={...} Jul 8, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

can you point where are changed, diff so large

@@ -248,6 +248,7 @@ func (s *Server) startHTTPServer() {
router.Handle("/info", tikvhandler.NewServerInfoHandler(tikvHandlerTool)).Name("Info")
router.Handle("/info/all", tikvhandler.NewAllServerInfoHandler(tikvHandlerTool)).Name("InfoALL")
// HTTP path for get db and table info that is related to the tableID.
router.Handle("/db-table", tikvhandler.NewDBTableHandler(tikvHandlerTool)).Name("DB Table")
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer /tables, but we have used /db-table, ok to reuse the word

Copy link
Contributor

@D3Hunter D3Hunter 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

Comment on lines 959 to 960
require.NoError(t, err)
require.NoError(t, resp.Body.Close())
Copy link
Contributor

Choose a reason for hiding this comment

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

check response code=400

data[tid] = tbl
}
}
handler.WriteData(w, data)
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe consider wrap data inside another common struct for further extend

{
   data: <real-data>
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mornyx Do you think it's better we add another level JSON object?

Copy link
Contributor

Choose a reason for hiding this comment

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

/schema does not follow this design. Maybe we should keep them consistent?

}
tbl, err := getDBTableInfo(schema, int64(tid))
if err == nil {
data[tid] = tbl
Copy link
Contributor

Choose a reason for hiding this comment

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

do dashboard need to know it's partially result?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Current way to process the result is verified by dashboard dev.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the dashboard scenario alone this is as designed.

Signed-off-by: lance6716 <lance6716@gmail.com>
Copy link

ti-chi-bot bot commented Jul 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 9, 2024
Copy link

ti-chi-bot bot commented Jul 9, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-09 06:35:09.086141354 +0000 UTC m=+339406.321375466: ☑️ agreed by D3Hunter.

@lance6716 lance6716 changed the title handler: add /db-table?table_ids={...} [WIP]handler: add /db-table?table_ids={...} Jul 10, 2024
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2024
Signed-off-by: lance6716 <lance6716@gmail.com>
Copy link

ti-chi-bot bot commented Jul 10, 2024

@lance6716: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/mysql-test 4df803e link true /test mysql-test
idc-jenkins-ci-tidb/unit-test 4df803e link true /test unit-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@tiancaiamao
Copy link
Contributor

If it's ready for review, you can remove the [WIP] label @lance6716

@lance6716
Copy link
Contributor Author

Due to problems on keyvis side, I will open another PR to fix the issue. The API in this PR can't be used smoothly.

@lance6716 lance6716 closed this Jul 15, 2024
@lance6716
Copy link
Contributor Author

replaced by #54608 (still WIP)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When many tables under a DB, dashboard keyvis feature will cost a lot of resource
4 participants