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

*: polish the table cache feature code #33408

Merged
merged 11 commits into from
Apr 8, 2022

Conversation

tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Mar 25, 2022

What problem does this PR solve?

Issue Number: close #33167

Problem Summary:

What is changed and how it works?

  • Make it clear that StateRemote is not thread-safe
  • Cache the latest known local state to avoid unnecessary visit to the remote meta data and reduce conflict
  • Use pessimistic transaction mode for updating write lock of StateRemote
  • Fix a bug that write operation doesn't set write lock when it's already in write locked state
  • Fix table cache lease too short cause load data infinitely
  • Add a metrics for loading table data duration

Check List

Tests

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

Run a playground tidb cluster, the use sysbench with hybrid workload.
For example, oltp_read_write on tidb server1, oltp_point_select on tidb server2, and oltp_read_write on tidb server 3 ...
Adjust the order randomly and observe the performance and cluster status.

  • No code

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

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 25, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lcwangchao
  • tangenta

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue release-note-none do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 25, 2022
@tiancaiamao tiancaiamao marked this pull request as ready for review March 30, 2022 14:25
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 30, 2022
@tiancaiamao tiancaiamao changed the title *: polish the table cache feature code [WIP] *: polish the table cache feature code Mar 31, 2022
table/tables/cache.go Show resolved Hide resolved
table/tables/cache.go Outdated Show resolved Hide resolved
table/tables/cache.go Outdated Show resolved Hide resolved
@sre-bot
Copy link
Contributor

sre-bot commented Apr 1, 2022

Copy link
Collaborator

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

session/session.go Outdated Show resolved Hide resolved
table/tables/cache.go Outdated Show resolved Hide resolved
table/tables/cache.go Outdated Show resolved Hide resolved
Co-authored-by: tangenta <tangenta@126.com>
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 8, 2022
@ti-chi-bot ti-chi-bot removed the status/LGT1 Indicates that a PR has LGTM 1. label Apr 8, 2022
@ti-chi-bot ti-chi-bot added the status/LGT2 Indicates that a PR has LGTM 2. label Apr 8, 2022
@tiancaiamao
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 3ff7175

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 8, 2022
@ti-chi-bot ti-chi-bot removed the status/can-merge Indicates a PR has been approved by a committer. label Apr 8, 2022
@tiancaiamao
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 1ece694

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Apr 8, 2022
@ti-chi-bot ti-chi-bot merged commit 181bfb7 into pingcap:master Apr 8, 2022
@tiancaiamao tiancaiamao deleted the polish-code branch April 8, 2022 13:46
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Apr 8, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 in PR #33838

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

table cache lease too short cause load data infinitely
6 participants