-
Notifications
You must be signed in to change notification settings - Fork 276
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
Modify the key format from a hash of the data to be write_version|node_path_in_tree
#571
Comments
@catShaark want to collaborate with @cool-develope on this work? I see you started the work already |
Yes I do |
@catShaark, I couldn't follow your approach. We can get children's paths through the parent path. // Node represents a node in a Tree.
type Node struct {
key []byte
value []byte
hash []byte
version int64
size int64
path []byte // the path of binary tree
leftVersion int64 // the version of left child
rightVersion int64 // the version of right child
leftNode *Node
rightNode *Node
subtreeHeight int8
persisted bool
} I am just preparing the initial PR, will discuss later. |
If we use the node key as I am suggesting the alternative way, instead of cc @marbar3778 |
I don't think we need to update all the keys, we can simply add a field to store the old key and the left/right node's old key. If we use the nonce value, we will still have to add that field. Tho I agree with you that using a nonce value instead of |
I'm not really following the proposal here, but I thought the entire point was that the keys on disk are prefixed with height/version. This makes layout on disk much more efficient. cc @ValarDragon |
This conversation got me thinking it would be good to capture both approaches in an adr. |
I think the 2 approaches don't differ much, either way we need to add NodeKey, LeftChildNodeKey, RightChildNodeKey field to the Node struct and have the node saving, key/value setting logic, ... to handle/use those field |
Got an explanation from Marko (Agreed prior post doesn't explain this well. Next time please include example keys!) Also what exactly are you calling an LRU algorithm? Doing things off of a write nonce does not make sense to me. This is bad for data locality of a key across versions? Also I think the whole framing around pivots is pretty off, just model a pivot as a new set of writes? |
I updated the diagram. Here LRU means we will re-visit the recently updated nodes probably. |
@cool-develope your suggestion seems in line with this issue #137 |
Yeah, it's almost the same. |
ref: #548
The text was updated successfully, but these errors were encountered: