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

PageStorage v3 modules combine. #3795

Closed
wants to merge 44 commits into from
Closed

PageStorage v3 modules combine. #3795

wants to merge 44 commits into from

Conversation

jiaqizho
Copy link
Contributor

@jiaqizho jiaqizho commented Jan 4, 2022

What problem does this PR solve?

Issue Number: a part of #3594

Problem Summary:

What is changed and how it works?

  • combine PageStorage v3 modules
  • port stress test into v3, now we can use stress test to test the V3 pagestorage

remain

  • some tests in pagestorage v3
  • stress test get some error when run HeavySkewWriteRead.cpp

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

jiaqizho and others added 15 commits December 30, 2021 11:43
call test: BlobStoreTest.testBlobStoreGcStats2

Error from
- BlobStore::write
- BlobStore::getBlobFile
- DB::LRUCache
- std::map

The ptr in __hash:87 will be lost.
And if i remove the `ro_ids` in BlobStore.h, it won't show again...
Anyway `ro_ids` is useless.
@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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 4, 2022
@jiaqizho jiaqizho changed the title Ps v3 combine [WIP] PageStorage v3 modules combine. Jan 4, 2022
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 4, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 13, 2022
@@ -88,7 +88,7 @@ struct PageEntry
PageFieldOffsetChecksums field_offsets{};

public:
inline bool isValid() const { return file_id != 0; }
inline bool isValid() const { return file_id != 0 && file_id != INVALID_BLOBFILE_ID; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe make INVAILD_BLOBFILE_ID be 0?

@JaySon-Huang
Copy link
Contributor

This PR mixes too many changes in different components, suggest splitting these two changes into separate PRs:

  • Add some debugging utils for PageDirectory: snapshot thread_id, living_time since created; getMaxId/getAllPageIds/gcApply method changes
  • Changes in BlobStore::gc

}

bool PageStorageImpl::gc(bool not_skip, const WriteLimiterPtr & write_limiter, const ReadLimiterPtr & read_limiter)
{
/// Get all pending external pages and BlobFiles. Note that we should get external pages before BlobFiles.
Copy link
Contributor

@flowbehappy flowbehappy Jan 19, 2022

Choose a reason for hiding this comment

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

  1. We should avoid this method being called by more than 1 thread at the same time.
  2. Return false if we didn't do any job this time. So that the scheduler won't call it again in the near future.

@@ -286,6 +382,14 @@ void PageDirectory::gcApply(const PageIdAndVersionedEntryList & migrated_entries

// TBD: wal apply
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. It is hard to locate which lines with the URL you post when the PR changes lots of lines. You should use "view file" to open the file and then copy the URL inside that file.
    image

  2. Do you mean this lock in this PR? PageStorage: Fix locks on BlobStore, PageDirectory #3897
    https://github.com/pingcap/tics/blob/ca65a7b1b3b359c5b3624b7482fef6f69c01e3fc/dbms/src/Storages/Page/V3/PageDirectory.cpp#L285-L288

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually, I have fixed some locking issues in this pr.

  1. In PageDirectory, due to added getSnapshotsStat, then we need to be added write_lock. Before we clear up snapshots in gc.
  2. Fix max_cap may cause inaccurate issues in BlobStore. There is no need to add more locks in other methods of BlobStore, because this may lead to reentrancy problems or bring more lock problems, and we only need to ensure that write/read/gc happens at the same time, and there will be no concurrency problems.
  3. If I'm missing something, I'd prefer to fix it in this PR, or after that, so I can use the adapted stress tool to verify it.

{
extern const Metric PSMVCCNumSnapshots;
} // namespace CurrentMetrics

Copy link
Contributor

Choose a reason for hiding this comment

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

Add a [[nodiscard]] mark to VersionedPageEntries::acquireLock.

@ti-chi-bot
Copy link
Member

@jiaqizho: PR needs rebase.

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/test-infra repository.

@jiaqizho
Copy link
Contributor Author

@JaySon-Huang @flowbehappy
split into #3905 #3907 #3908 #3909 #3913 PTAL if you have time to review~

@jiaqizho jiaqizho closed this Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

4 participants