-
Notifications
You must be signed in to change notification settings - Fork 219
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
membuffer: support staging & checkpoint for ART #1465
Conversation
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
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.
Could we implement unit tests for multi-level stages? The existing tests only cover single-level scenarios with simple staging and cleanup operations.
The rest LGTM.
|
||
func (t *ART) truncate(snap *arena.MemDBCheckpoint) { | ||
panic("unimplemented") | ||
cp := &t.stages[h-1] |
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.
Is it possible that len(stages)=0
and h=0
? Shall we test that?
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.
h == 0
means staging is not support in TiDB, I think we can just return for this case.
I'll add test for it.
panic("unimplemented") | ||
} | ||
if h > len(t.stages) { | ||
return |
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 directly related to this change, but I wonder whether there are such usages...
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.
TiDB always call defer memBuffer.Clean
after a group of mutations (even memBuffer.Release
is already invoked), so this case is expected and valid.
func addRecord() {
sh := memBuffer.Staging() // sh == 2, len(stages) == 2
defer memBuffer.Cleanup(sh) // sh == 2, len(stages) == 1
...
memBuffer.Release(sh) // len(stages) == 1 after this call
}
internal/unionstore/art/art.go
Outdated
@@ -392,51 +393,89 @@ func (t *ART) Size() int { | |||
} | |||
|
|||
func (t *ART) checkpoint() arena.MemDBCheckpoint { | |||
panic("unimplemented") | |||
return t.allocator.vlogAllocator.Checkpoint() | |||
} | |||
|
|||
func (t *ART) RevertNode(hdr *arena.MemdbVlogHdr) { |
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.
Is "RevertVLogEntry" or something similar a more appropriate name? RevertNode
looks like we are deleting the node.
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.
Rename it to RevertVAddr
.
Signed-off-by: you06 <you1474600@gmail.com>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, ekexium The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ref pingcap/tidb#55287
This PR implements
Staging/Release/Cleanup
andCheckpoint/RevertToCheckpoint
for ART, the behavior is exactly same with RBT.