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

HAMT/AMT flush always writes node to store, even when unchanged #1443

Closed
anorth opened this issue Jan 12, 2023 · 2 comments
Closed

HAMT/AMT flush always writes node to store, even when unchanged #1443

anorth opened this issue Jan 12, 2023 · 2 comments
Labels
Kind: Improvement An improvement of something that exists. Topic: IPLD

Comments

@anorth
Copy link
Member

anorth commented Jan 12, 2023

The HAMT and AMT flush methods write the root block content to store even if it's the same data that was read from store. While this could in theory be detected and prevented by callers, it's easily overlooked. For example, a common pattern is:

  • load HAMT root
  • iterate over N things to update it
  • flush HAMT root
    ... where N can be zero.

To implement, I suggest Node::flush() return a boolean indicating whether it wrote anything, and then skip writing the root node if it didn't.

@Stebalien
Copy link
Member

#901
#1272

(or is this something different)

@anorth
Copy link
Member Author

anorth commented Jan 12, 2023

That looks like it. Sigh, why aren't the actors using this? I guess it went on the v3 branch even though we were deploying actors v10 on fvm v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kind: Improvement An improvement of something that exists. Topic: IPLD
Projects
None yet
Development

No branches or pull requests

2 participants