Skip to content

Conversation

@bernard-avalabs
Copy link
Contributor

@bernard-avalabs bernard-avalabs commented Oct 7, 2025

Addresses #1342.

Created a propose_with_parent to allow code reuse between Db.propose and Proposal.create_proposal. propose_with_parent will also choose between using parallel or serial proposal creation based on the batch size. Currently the batch size for using parallel creation is 8, but there is a TODO to update the constant once we have some experimental results. We use size_hint() on the batch iterator to estimate the batch size.

…s/firewood into bernard/insert-worker-pool-rayon
a new branch node with an empty partial path is added to support
parallel insertion. Appears to be working.
@bernard-avalabs bernard-avalabs changed the title chore: Added helper to reduce code duplication between propose and Proposal.create_proposal chore: Added helper to reduce code duplication between Db.propose and Proposal.create_proposal Oct 7, 2025
Copy link
Member

@rkuris rkuris left a comment

Choose a reason for hiding this comment

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

Looks good, but please apply the comments before merging.

Copy link
Member

@rkuris rkuris left a comment

Choose a reason for hiding this comment

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

Great start, but I think we can do a bit better, especially since this area is likely to change.

IMO the right way to fix this is to use a value set at database open time as the value of force_parallel. This is because I think we'll eventually need some way to mark parallel as always disabled.

IMO the best way to fix this is to create an enum with values NEVER, BATCH_SIZE(usize), ALWAYS set at database open time. That has the higest readability and would probably make this code change much cleaner.

@bernard-avalabs
Copy link
Contributor Author

bernard-avalabs commented Oct 28, 2025

IMO the right way to fix this is to use a value set at database open time as the value of force_parallel. This is because I think we'll eventually need some way to mark parallel as always disabled.

IMO the best way to fix this is to create an enum with values NEVER, BATCH_SIZE(usize), ALWAYS set at database open time. That has the higest readability and would probably make this code change much cleaner.

I don't think we need both a force_parallel Option and an enum. I've instead added a enum field in Db, and set BatchSize (8 currently) as the default configuration value. Instead of checking for an option, it performs a match on an Enum during proposal creation. Please let me know if I've misunderstood your comment.

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.

4 participants