Skip to content

store/tikv: make snapshot thread safe#17593

Merged
tiancaiamao merged 4 commits intopingcap:masterfrom
tiancaiamao:snapshot-threadsafe
Jun 3, 2020
Merged

store/tikv: make snapshot thread safe#17593
tiancaiamao merged 4 commits intopingcap:masterfrom
tiancaiamao:snapshot-threadsafe

Conversation

@tiancaiamao
Copy link
Contributor

@tiancaiamao tiancaiamao commented Jun 2, 2020

What problem does this PR solve?

Problem Summary:

After point get executor becoming data source node, snapshot may be used concurrently.

Snapshot is a read-only object, it should be thread safe, but as it cache data, this is not the truth.

What is changed and how it works?

What's Changed:

Add read-write lock on the cache to make snapshot thread safe.

How it Works:

Check List

Tests

  • Unit test

Side effects

  • Performance regression

The performance impact should be negligible.

Release note

  • No release note

@tiancaiamao tiancaiamao added type/enhancement The issue or PR belongs to an enhancement. component/store labels Jun 2, 2020
@tiancaiamao
Copy link
Contributor Author

/run-all-tests
PTAL @coocood @lysu

@tiancaiamao
Copy link
Contributor Author

PTAL @coocood @lysu

@coocood
Copy link
Member

coocood commented Jun 3, 2020

LGTM

Copy link
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu
Copy link
Contributor

lysu commented Jun 3, 2020

/merge

@sre-bot sre-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 3, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Jun 3, 2020

/run-all-tests

@codecov
Copy link

codecov bot commented Jun 3, 2020

Codecov Report

Merging #17593 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #17593   +/-   ##
===========================================
  Coverage   79.6064%   79.6064%           
===========================================
  Files           520        520           
  Lines        140853     140853           
===========================================
  Hits         112128     112128           
  Misses        19731      19731           
  Partials       8994       8994           

@sre-bot
Copy link
Contributor

sre-bot commented Jun 3, 2020

@tiancaiamao merge failed.

@tiancaiamao
Copy link
Contributor Author

/run-all-tests

@tiancaiamao tiancaiamao merged commit e5ba8f4 into pingcap:master Jun 3, 2020
tiancaiamao added a commit to tiancaiamao/tidb that referenced this pull request Jun 19, 2020
jebter pushed a commit that referenced this pull request Jun 30, 2020
* store/tikv: make snapshot thread safe (#17593)

* move point get & batch point get init code to Open

* address comment

* address comment

* address comment

* address comment

* address comment

* address comment

* address comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/store status/can-merge Indicates a PR has been approved by a committer. type/enhancement The issue or PR belongs to an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants