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

feat: refactor the node key as version + path #650

Closed
wants to merge 41 commits into from

Conversation

cool-develope
Copy link
Collaborator

@cool-develope cool-develope commented Dec 20, 2022

ref: #571, #608

Context

As discussed in #608, it suggests the node key format as version + path instead of hash. It introduces a new way to get new nodes and orphans and remove the root and orphans from storage.

What does this PR do?

@cool-develope cool-develope requested a review from a team as a code owner December 20, 2022 17:46
@cool-develope cool-develope marked this pull request as draft December 20, 2022 17:49
@cool-develope cool-develope marked this pull request as ready for review December 20, 2022 18:52
@tac0turtle
Copy link
Member

@cool-develope can you give a short summary of all the changes in the pr in the description

import_test.go Outdated
@@ -160,7 +161,7 @@ func TestImporter_Close(t *testing.T) {
importer, err := tree.Import(1)
require.NoError(t, err)

err = importer.Add(&ExportNode{Key: []byte("key"), Value: []byte("value"), Version: 1, Height: 0})
err = importer.Add(&ExportNode{Key: []byte("key"), Value: []byte("value"), NodeKey: &NodeKey{version: 1, path: big.NewInt(1)}, Height: 0})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this work for existing exports?or is the migration path planned to be different ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it would look different, please refer #662

mutable_tree.go Outdated

if tree.allRootLoaded {
return tree.versions[version]
firstVersion, err := tree.ndb.getFirstVersion()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there not a need to lock here anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we don't use the map of versions,since we are keeping the range of versions (fristVersion, latestVersion)

This was referenced Jan 2, 2023
@cool-develope cool-develope changed the base branch from master to 592/remove_orphans January 3, 2023 13:49
@kocubinski kocubinski self-assigned this Jan 10, 2023
Base automatically changed from 592/remove_orphans to master January 23, 2023 17:24
@cool-develope
Copy link
Collaborator Author

This PR has two problems, the export/import is not working with the original version.
It violates #660.

@tac0turtle
Copy link
Member

in the storage working group we decided to move forward with local nonce + version, closing this pr

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 this pull request may close these issues.

3 participants