-
Notifications
You must be signed in to change notification settings - Fork 409
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
Refine the GC interface by PageEntriesEdit
#3879
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-all-tests |
throw Exception("Not implemented", ErrorCodes::NOT_IMPLEMENTED); | ||
} | ||
|
||
void WALStore::gc() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure WALStore need gc or we can make it more simple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two approaches:
- Stopping the foreground write and dump the MVCCDirectory into a new LogFile to replace all files before it
- Select some LogFiles and compact them in a background thread
I prefer 2 cause it doesn't stall the foreground writes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While 1 will stop the foreground writes, and the stop duration is proportional to the size of MVCC Directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a suggestion, can we finish the WalStore
in this pr, in this case, the changes to the interface can be done together?
@@ -90,7 +91,6 @@ PageEntriesEdit BlobStore::write(DB::WriteBatch & wb, const WriteLimiterPtr & wr | |||
switch (write.type) | |||
{ | |||
case WriteBatch::WriteType::PUT: | |||
case WriteBatch::WriteType::UPSERT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why removed UPSERT
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After digging into current gc routine implementation, we only use PageEntriesEdit:: upsertPage
in BlobStore::gc
(with version set in the same time). WriteBatch::upsert
is not a valid input.
https://github.com/pingcap/tics/blob/ded8a062b9f777ccfd70087f6341feac725bcb08/dbms/src/Storages/Page/V3/BlobStore.cpp#L406
// stage 1, persisted the changes to WAL | ||
// wal.apply(edit); | ||
// stage 1, persisted the changes to WAL with version [seq=last_seq + 1, epoch=0] | ||
// wal->apply(edit, PageVersionType(last_sequence + 1, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so we do have wal->apply
already , can we just use it? or is there remain some work for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to set a proper version for edits written from PageDirectory::apply
...
https://github.com/pingcap/tics/blob/ded8a062b9f777ccfd70087f6341feac725bcb08/dbms/src/Storages/Page/V3/WALStore.cpp#L136-L142
... While in PageDirectory::gcApply
, we use the existing version
https://github.com/pingcap/tics/blob/ded8a062b9f777ccfd70087f6341feac725bcb08/dbms/src/Storages/Page/V3/PageDirectory.cpp#L279-L300
@@ -159,7 +159,7 @@ class PageDirectory | |||
|
|||
mutable std::list<std::weak_ptr<PageDirectorySnapshot>> snapshots; | |||
|
|||
WALStore wal; | |||
WALStorePtr wal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure we need ptr to refine WALStore.
And I don't see we init it in the constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use WALStore::create
to create it in restore
instead of during the constructor of PageDirectory::PageDirectory
now, so it need to be a ptr.
I may refactor PageDirectory
to make it construct by a static method create
, so that we do not get a PageDirectory
instance that is created but without restoring existing data from disks.
I've created #3891 for the full implementation of WALStore. That PR contains lots of changes files (1300 lines over 23 files). |
7487e4f
to
40d6c35
Compare
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
40d6c35
to
fd4bbbb
Compare
Should get #3897 merged first. |
Signed-off-by: JaySon-Huang <tshent@qq.com>
/merge |
@JaySon-Huang: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. 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 ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 4057c79
|
Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/1074/cobertura/ lines: 44.7% (51509 out of 115198) |
What problem does this PR solve?
Issue Number: a part of #3594; a part of WALStore implementation
Problem Summary:
PageEntriesEdit
to unify the data exchange structure betweenBlobStore
andPageDirectory
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note