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] PageStorage: Fix the lifetime of PageEntries in PageDirectory with RefPage mechanism #4061

Closed
wants to merge 7 commits into from

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Feb 16, 2022

What problem does this PR solve?

Issue Number: a part of #3594

Problem Summary: Fix the lifetime of PageEntries in PageDirectory with RefPage mechanism, the ut:

https://github.com/pingcap/tics/blob/c9960d42f2f701010ff591c2421b4a2b941b03b8/dbms/src/Storages/Page/V3/tests/gtest_page_directory.cpp#L1014-L1047

What is changed and how it works?

  • Use shared_ptr to save the PageEntry inside PageDirectory
  • Creating a RefPage to not external page will increase the ref count of the shared_ptr
  • After the page entry get totally removed, use the deletor of shared_ptr to emplace the entry to a vector
  • Return the page entries after GC

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • 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

[REVIEW NOTIFICATION]

This pull request has not been approved.

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 release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 16, 2022
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@@ -0,0 +1 @@
leak:fiu_enable
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is added for running asan detection like #4054

@sre-bot
Copy link
Collaborator

sre-bot commented Feb 16, 2022

Coverage for changed files

Filename                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PageDirectory.cpp                      181                41    77.35%          23                 4    82.61%         428                98    77.10%         136                36    73.53%
PageDirectory.h                         22                 4    81.82%          18                 4    77.78%          77                16    79.22%           4                 2    50.00%
PageEntry.h                              1                 1     0.00%           1                 1     0.00%           3                 3     0.00%           0                 0         -
PageStorageImpl.cpp                     61                26    57.38%          18                10    44.44%         143                73    48.95%          30                21    30.00%
tests/entries_helper.h                  61                35    42.62%           9                 3    66.67%         230               110    52.17%          30                20    33.33%
tests/gtest_page_directory.cpp        4031               660    83.63%          27                 0   100.00%         773                 0   100.00%        1284               640    50.16%
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                 4357               767    82.40%          96                22    77.08%        1654               300    81.86%        1484               719    51.55%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16417      9513             42.05%    181135  96314        46.83%

full coverage report (for internal network access only)

@JaySon-Huang
Copy link
Contributor Author

Find that we need to change the logic in CollapsingPageDirectory. change this PR status to be WIP

@JaySon-Huang JaySon-Huang changed the title PageStorage: Fix the lifetime of PageEntries in PageDirectory with RefPage mechanism [WIP] PageStorage: Fix the lifetime of PageEntries in PageDirectory with RefPage mechanism Feb 17, 2022
@ti-chi-bot ti-chi-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 17, 2022
@JaySon-Huang
Copy link
Contributor Author

do it by another design #4174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants