-
Notifications
You must be signed in to change notification settings - Fork 222
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: improve ART's code and test coverage #1477
Conversation
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
@@ -300,11 +306,7 @@ func (t *ART) expandLeaf(key artKey, depth uint32, prev, current artNode) (arena | |||
newAn.addChild(&t.allocator, l2Key.charAt(int(depth)), !l2Key.valid(int(depth)), leaf2Addr) | |||
|
|||
// swap the old leaf with the new node4. | |||
if prev == nullArtNode { |
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 can we remove the check?
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.
Because the root node can't be a leaf, so when we expanding a leaf, the prev node is definitely not null.
Consider this case:
1. t.root == nullArtNode
2. insert a key [1, 2], t.root becomes a node4
3. insert a key [1, 3], t.root.findChild(1) is a leaf, so expandLeaf will be invoked, prev is t.root now
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
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.
Some minor grammar tweaks would make these comments better. May let LLM do this.
@@ -212,6 +212,14 @@ func (e *ErrTxnTooLarge) Error() string { | |||
return fmt.Sprintf("txn too large, size: %v.", e.Size) | |||
} | |||
|
|||
type ErrKeyTooLarge struct { |
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.
Kind reminder: TiDB should have corresponding conversions.
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
@ekexium PTAL again |
[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 |
[LGTM Timeline notifier]Timeline:
|
ref pingcap/tidb#55287
This PR tries to make the code simplify and increase the test coverage (only some unreachable paths are not covered).