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

coprocessor: skip empty tidb nodes #56858

Merged
merged 8 commits into from
Nov 6, 2024

Conversation

Leavrth
Copy link
Contributor

@Leavrth Leavrth commented Oct 28, 2024

What problem does this PR solve?

Issue Number: close #36546

Problem Summary:
BR backup now depends on domain

What changed and how does it work?

skip tidb nodes whose IP is unavailable

Check List

Tests

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

before: the BR's IP is empty, and the address :10080 equals to 127.0.0.1:10080, which means coprocessor will requests to TiDB instead of BR. That's why we can find there are duplicated rows.

$ curl http://127.0.0.1:10080/info/all                                                                                    
{
 "servers_num": 2,
 "owner_id": "f64a9d4b-8809-4883-a7ed-fca019a01ea5",
 "is_all_server_version_consistent": true,
 "all_servers_info": {
  "7e9c90c6-6650-4cd4-84ab-daf4d9449afc": {
   "version": "8.0.11-TiDB-v8.4.0-alpha-483-g7143727-dirty",
   "git_hash": "7143727b3c43c43e92ecdb163c6f7aefc3c67894",
   "ddl_id": "7e9c90c6-6650-4cd4-84ab-daf4d9449afc",
   "ip": "",
   "listening_port": 4000,
   "status_port": 10080,
   "lease": "45s",
   "start_timestamp": 1730707063,
   "labels": {},
   "server_id": 8
  },
  "f64a9d4b-8809-4883-a7ed-fca019a01ea5": {
   "version": "8.0.11-TiDB-v8.4.0-alpha-483-g7143727-dirty",
   "git_hash": "7143727b3c43c43e92ecdb163c6f7aefc3c67894",
   "ddl_id": "f64a9d4b-8809-4883-a7ed-fca019a01ea5",
   "ip": "127.0.0.1",
   "listening_port": 4000,
   "status_port": 10080,
   "lease": "45s",
   "start_timestamp": 1730706878,
   "labels": {},
   "server_id": 719
  }
 }
}

MySQL [(none)]> SELECT INSTANCE, SUMMARY_BEGIN_TIME, SUMMARY_END_TIME, STMT_TYPE, SCHEMA_NAME, DIGEST, DIGEST_TEXT, TABLE_NAMES FROM information_schema.cluster_statements_summary;
+-----------------+---------------------+---------------------+-----------+-------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+
| INSTANCE        | SUMMARY_BEGIN_TIME  | SUMMARY_END_TIME    | STMT_TYPE | SCHEMA_NAME | DIGEST                                                           | DIGEST_TEXT                                                                                                                                                                                 | TABLE_NAMES                                   |
+-----------------+---------------------+---------------------+-----------+-------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | 727b0d75bb37338a9772e42a27aca490d08caf53ddc9448f7ad760d6e9749be9 | select @@version_comment limit ?                                                                                                                                                            | NULL                                          |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | c5f286394fab8ae144718cf4e17497d68ea2e40afd3f31e3d09c918bdac9bc58 | select instance , `summary_begin_time` , `summary_end_time` , `stmt_type` , `schema_name` , digest , `digest_text` , `table_names` from `information_schema` . `cluster_statements_summary` | information_schema.cluster_statements_summary |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | 727b0d75bb37338a9772e42a27aca490d08caf53ddc9448f7ad760d6e9749be9 | select @@version_comment limit ?                                                                                                                                                            | NULL                                          |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | c5f286394fab8ae144718cf4e17497d68ea2e40afd3f31e3d09c918bdac9bc58 | select instance , `summary_begin_time` , `summary_end_time` , `stmt_type` , `schema_name` , digest , `digest_text` , `table_names` from `information_schema` . `cluster_statements_summary` | information_schema.cluster_statements_summary |
+-----------------+---------------------+---------------------+-----------+-------------+------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------+
4 rows in set (0.01 sec)

after

$ curl http://127.0.0.1:10080/info/all
{
 "servers_num": 2,
 "owner_id": "211365fc-c0ca-4091-b36c-f3c417485a1a",
 "is_all_server_version_consistent": true,
 "all_servers_info": {
  "211365fc-c0ca-4091-b36c-f3c417485a1a": {
   "version": "8.0.11-TiDB-v8.4.0-alpha-483-g7143727-dirty",
   "git_hash": "7143727b3c43c43e92ecdb163c6f7aefc3c67894",
   "ddl_id": "211365fc-c0ca-4091-b36c-f3c417485a1a",
   "ip": "127.0.0.1",
   "listening_port": 4000,
   "status_port": 10080,
   "lease": "45s",
   "start_timestamp": 1730705519,
   "labels": {},
   "server_id": 1181
  },
  "adbd4e64-406f-4f1c-80ec-43f8eabe2b04": {
   "version": "8.0.11-TiDB-v8.4.0-alpha-483-g7143727-dirty",
   "git_hash": "7143727b3c43c43e92ecdb163c6f7aefc3c67894",
   "ddl_id": "adbd4e64-406f-4f1c-80ec-43f8eabe2b04",
   "ip": "\u003cnil\u003e",
   "listening_port": 4000,
   "status_port": 10080,
   "lease": "45s",
   "start_timestamp": 1730705637,
   "labels": {},
   "server_id": 1215
  }
 }
}

MySQL [(none)]> SELECT INSTANCE, SUMMARY_BEGIN_TIME, SUMMARY_END_TIME, STMT_TYPE, SCHEMA_NAME, DIGEST, DIGEST_TEXT, TABLE_NAMES FROM information_schema.cluster_statements_summary;
+-----------------+---------------------+---------------------+-----------+-------------+------------------------------------------------------------------+-------------------------------------------------------------------+-----------------------------------------------+
| INSTANCE        | SUMMARY_BEGIN_TIME  | SUMMARY_END_TIME    | STMT_TYPE | SCHEMA_NAME | DIGEST                                                           | DIGEST_TEXT                                                       | TABLE_NAMES                                   |
+-----------------+---------------------+---------------------+-----------+-------------+------------------------------------------------------------------+-------------------------------------------------------------------+-----------------------------------------------+
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | DescTable | NULL        | 9915a1e791a0b58b6502a66922339a371320eddf592a27c17129833cda57e83a | desc `information_schema` . `cluster_statements_summary`          | NULL                                          |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | 0edbca1a1a0e39aa16e8407927cdd969feba0a58b4e204954601f9d36613b3c5 | select * from `information_schema` . `cluster_statements_summary` | information_schema.cluster_statements_summary |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | 22f606e5960591eed2f59d91c7ac5a770b7d78842ee98dbf68ed5be39c8ca8e1 | select * from `information_schema` . `cluster_slow_query`         | information_schema.cluster_slow_query         |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | 727b0d75bb37338a9772e42a27aca490d08caf53ddc9448f7ad760d6e9749be9 | select @@version_comment limit ?                                  | NULL                                          |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | DescTable | NULL        | ac2226558d34022b07694d674385efeb4a578d5ea2a7ed79bbce608418b90e19 | desc `information_schema` . `slow_query`                          | NULL                                          |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | Select    | NULL        | 2a4f31712c4e329dd87e3eb8fa68d5669bbf1f157df5844033ce542e8898a1c1 | select * from `information_schema` . `slow_query`                 | information_schema.slow_query                 |
| 127.0.0.1:10080 | 2024-11-04 15:30:00 | 2024-11-04 16:00:00 | DescTable | NULL        | f5dd03e8f45fcefb8a7a7e91f2c741b8e24f865496754b866f75483f35ddd612 | desc `information_schema` . `cluster_statements_summary_history`  | NULL                                          |
+-----------------+---------------------+---------------------+-----------+-------------+------------------------------------------------------------------+-------------------------------------------------------------------+-----------------------------------------------+
7 rows in set (0.01 sec)
  • 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: Jianjun Liao <[email protected]>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 28, 2024
Copy link

tiprow bot commented Oct 28, 2024

Hi @Leavrth. 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

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 57.2704%. Comparing base (3c8f2f3) to head (56b3b2f).
Report is 71 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56858         +/-   ##
=================================================
- Coverage   73.3393%   57.2704%   -16.0690%     
=================================================
  Files          1636       1806        +170     
  Lines        453658     649513     +195855     
=================================================
+ Hits         332710     371979      +39269     
- Misses       100561     252146     +151585     
- Partials      20387      25388       +5001     
Flag Coverage Δ
integration 39.2701% <94.4444%> (?)
unit 72.4609% <16.6666%> (-0.0908%) ⬇️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 62.6297% <100.0000%> (+16.6530%) ⬆️

Signed-off-by: Jianjun Liao <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 30, 2024
@Leavrth
Copy link
Contributor Author

Leavrth commented Oct 31, 2024

/retest

Copy link

tiprow bot commented Oct 31, 2024

@Leavrth: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 4, 2024
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
Signed-off-by: Jianjun Liao <[email protected]>
@Leavrth Leavrth removed the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Nov 4, 2024
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Nov 4, 2024
@Leavrth
Copy link
Contributor Author

Leavrth commented Nov 4, 2024

/retest

Copy link

tiprow bot commented Nov 4, 2024

@Leavrth: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 4, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 4, 2024
Copy link

ti-chi-bot bot commented Nov 4, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-04 08:15:05.335271848 +0000 UTC m=+856018.174427386: ☑️ agreed by xhebox.
  • 2024-11-04 08:57:30.815232247 +0000 UTC m=+858563.654387792: ☑️ agreed by Defined2014.

Copy link

tiprow bot commented Nov 4, 2024

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

Test name Commit Details Required Rerun command
fast_test_tiprow 7143727 link true /test fast_test_tiprow

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-sigs/prow repository. I understand the commands that are listed here.

Signed-off-by: Jianjun Liao <[email protected]>
@BornChanger
Copy link
Contributor

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 5, 2024
@Leavrth Leavrth removed the needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. label Nov 5, 2024
Copy link

ti-chi-bot bot commented Nov 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benmeadowcroft, Defined2014, xhebox, YuJuncen

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 the approved label Nov 5, 2024
@Leavrth
Copy link
Contributor Author

Leavrth commented Nov 6, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 6, 2024
@ti-chi-bot ti-chi-bot bot merged commit b6a817d into pingcap:master Nov 6, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cluster in-mem table query is slow when there are empty tidb nodes in etcd
6 participants