Skip to content

feat: speed up rollback command#636

Merged
tac0turtle merged 2 commits into
cosmos:masterfrom
yihuang:master
Dec 12, 2022
Merged

feat: speed up rollback command#636
tac0turtle merged 2 commits into
cosmos:masterfrom
yihuang:master

Conversation

@yihuang

@yihuang yihuang commented Nov 30, 2022

Copy link
Copy Markdown
  • fully rebuild fast node indexes after rollback, rather than leave it in dirty state.
  • skip unnecessary subtree traversal when deleting the latest version
  • restrict the iteration range when deleting orphans
  • support LazyLoadVersion, remove lazy support, we might be able to use lazy mode by default

A cleaner version based on: #636

Test result:

Combined with the lazy loading option, disabling fastnode, rollback takes 1.8s on one of our testnet archive node(337G), previously it was several hours.

@yihuang yihuang requested a review from a team November 30, 2022 06:53
@yihuang yihuang force-pushed the master branch 2 times, most recently from d9f40d1 to 9c1abd8 Compare December 1, 2022 04:15
Comment thread nodedb.go
return err
}

if node.version < version {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Like

Comment thread nodedb.go Outdated
Comment thread util.go Outdated
Comment thread nodedb.go Outdated
@yihuang yihuang requested review from cool-develope and mmsqe and removed request for cool-develope and mmsqe December 6, 2022 01:47
- fully rebuild fast node indexes after rollback, rather than leave it in dirty state.
- skip unnecessary subtree traversal when deleting the latest version.
- restrict the iteration range when deleting orphans.
Comment thread nodedb.go
if err != nil {
return err
}
// NOTICE: we don't touch fast node indexes here, because it'll be rebuilt later because of version mismatch.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the trade off here?

@yihuang yihuang Dec 12, 2022

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I believe the previous logic to just delete some fastnodes is simply wrong, because fast node is assumed to be represent the complete live state, it's wrong to leave a partial fast node index.

In new version, fast node index will be fully rebuilt because of version mismatch, and if user don't want to slow down rollback, they can disable fast node index before rollback, after recovered the node operation, user can find another good time to rebuild the fast node index by enable it again.

@tac0turtle tac0turtle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Utack. Should we backport this?

@yihuang

yihuang commented Dec 12, 2022

Copy link
Copy Markdown
Author

Utack. Should we backport this?

I hope so, it's a big UX improvement for existing version.

@tac0turtle tac0turtle merged commit d4086fe into cosmos:master Dec 12, 2022
@tac0turtle

Copy link
Copy Markdown
Contributor

@Mergifyio backport release/v0.19.x

mergify Bot pushed a commit that referenced this pull request Dec 12, 2022
(cherry picked from commit d4086fe)

# Conflicts:
#	nodedb.go
@mergify

mergify Bot commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

backport release/v0.19.x

✅ Backports have been created

Details

tac0turtle added a commit that referenced this pull request Dec 26, 2022
Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: Marko Baricevic <marbar3778@yahoo.com>
ankurdotb pushed a commit to cheqd/iavl that referenced this pull request Feb 28, 2023
Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: Marko Baricevic <marbar3778@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

6 participants