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

Implement a lazy set for the migration to the new node key format #747

Closed
cool-develope opened this issue Apr 14, 2023 · 2 comments · Fixed by #750
Closed

Implement a lazy set for the migration to the new node key format #747

cool-develope opened this issue Apr 14, 2023 · 2 comments · Fixed by #750

Comments

@cool-develope
Copy link
Collaborator

Context

The migration to the new node key format is tricky. To avoid stopping the network, it introduces a lazy set. We will accept the existence of both new and old format nodes in the tree.

Proposal

  • Refactor the Node structure to accept both old and new nodes, like this
// Node represents a node in a Tree.
type Node struct {
	key           []byte
	value         []byte
	hash          []byte
	nodeKey       *NodeKey
	leftNodeKey   []byte  // it can be a node hash for the old node and be a node key serialization for the new node.
	rightNodeKey  []byte
	size          int64
	leftNode      *Node
	rightNode     *Node
	subtreeHeight int8
}
  • Setting new nodes will store the node as a new node key format. It will refactor them to the new format for old nodes that face while updating the tree.
@yihuang
Copy link
Collaborator

yihuang commented Apr 14, 2023

Sounds great, so there are just multiple versions of node key, new version could reference old version, but not the other way.

@cool-develope
Copy link
Collaborator Author

Sounds great, so there are just multiple versions of node key, new version could reference old version, but not the other way.

exactly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants