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

tikv: add size limit to batch get cache #21015

Merged
merged 6 commits into from
Nov 19, 2020

Conversation

bobotu
Copy link
Contributor

@bobotu bobotu commented Nov 12, 2020

What problem does this PR solve?

Issue Number: close #19560

The internal cache used by BatchGet need a size limit, it is OK to randomly discard some entry in it.

What is changed and how it works?

Add a size limit which equals to default TxnTotalSizeLimit. We can delete some entry from it randomly when the limit is exceeded.

Release note

  • No release note.

@bobotu
Copy link
Contributor Author

bobotu commented Nov 12, 2020

/run-all-tests

@bobotu
Copy link
Contributor Author

bobotu commented Nov 12, 2020

/run-check_dev_2

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 12, 2020
s.mu.cached[string(key)] = val
}

const cachedSizeLimit = 10 << 30
Copy link
Member

Choose a reason for hiding this comment

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

We could change it to a const for

if c.Performance.TxnTotalSizeLimit > 10<<30 {
and this one in another PR.

@tiancaiamao
Copy link
Contributor

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Nov 18, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Nov 18, 2020
@tiancaiamao
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 18, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@bobotu merge failed.

@bobotu
Copy link
Contributor Author

bobotu commented Nov 18, 2020

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@bobotu merge failed.

@cfzjywxk
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@bobotu merge failed.

@cfzjywxk
Copy link
Contributor

/merge

@ti-srebot
Copy link
Contributor

Your auto merge job has been accepted, waiting for:

  • 21072

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@bobotu merge failed.

@cfzjywxk cfzjywxk merged commit c5caca1 into pingcap:master Nov 19, 2020
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Nov 19, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #21129

@bobotu bobotu deleted the batch-get-cache-limit branch November 23, 2020 03:07
ti-srebot added a commit that referenced this pull request Nov 23, 2020
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unbounded memory usage of BatchGet's cache
5 participants