Skip to content

fix: provider merge conflicts#10989

Merged
lidel merged 5 commits intomasterfrom
fix/provider-merge-conflicts
Sep 26, 2025
Merged

fix: provider merge conflicts#10989
lidel merged 5 commits intomasterfrom
fix/provider-merge-conflicts

Conversation

@guillaumemichel
Copy link
Contributor

Fixes #10988

When resolving merge conflicts between #10951 and master, some parts of the code have been overridden.

As a result, the buffered.SweepingProvider usage has been removed, triggering #10988.

This PR reverts the changes as they were initially in #10834. Hopefully, I didn't miss anything critical.

@guillaumemichel guillaumemichel requested a review from a team as a code owner September 24, 2025 12:40
@guillaumemichel guillaumemichel added the skip/changelog This change does NOT require a changelog entry label Sep 24, 2025
@guillaumemichel guillaumemichel force-pushed the fix/provider-merge-conflicts branch from b2ed9a6 to 2b5ec42 Compare September 25, 2025 15:43
- add Provide.DHT.BufferedBatchSize (default: 1024)
- add Provide.DHT.BufferedIdleWriteTime (default: 5s)
- improves UX: content becomes discoverable faster (5s vs 60s)
- allows operators to tune batching for their workload
bufferedProviderOpts := []buffered.Option{
buffered.WithBatchSize(int(cfg.Provide.DHT.BufferedBatchSize.WithDefault(config.DefaultProvideDHTBufferedBatchSize))),
buffered.WithDsName("bprov"),
buffered.WithIdleWriteTime(cfg.Provide.DHT.BufferedIdleWriteTime.WithDefault(config.DefaultProvideDHTBufferedIdleWriteTime)),
Copy link
Member

@lidel lidel Sep 25, 2025

Choose a reason for hiding this comment

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

waiting 60s for a flush to trigger provide after ipfs add would make people report bugs that providing is broken.

@guillaumemichel i changed this to 5s and made it configurable – does 72c4693 make sense, or did I misunderstood the impact of this 1 minute flush delay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is the IdleWriteTime for the go-dsqueue used by the buffer.

It means that it will hold the multihashes it receives in memory, and if it doesn't receive new items in >1 minute, it will persist items from the queue that are in memory to the datastore.

The provides happen as fast as possible. There is a worker dedicated to taking multihashes from the buffer (in front of the SweepingProvider) and adding them to the provide queue and schedule.

I don't really have a good intuition on what this value should be, so I took the default one (1 minute), that is also used in the boxo/provider queue. Maybe @gammazero has a better suggestion?

Copy link
Member

@lidel lidel Sep 26, 2025

Choose a reason for hiding this comment

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

Thanks. I realized 1m is DefaultIdleWriteTime https://github.com/ipfs/go-dsqueue.

I've reverted in 83b280c. and only documented bufferedBatchSize and bufferedIdleWriteTime (back to 1m) as consts.

Better to not expose too much internals to users, as that often backfires when users put random values. If we se the need, we can expose those under Internal.* or something in the future.

@lidel lidel self-assigned this Sep 25, 2025
This reverts commit 72c4693.

Moved BufferedBatchSize and BufferedIdleWriteTime from user configuration
to hardcoded constants in core/node/provider.go. These are internal
implementation details that users don't need to tune - the upstream
defaults (1024 batch size, 1 minute idle time) are battle-tested and
provide optimal performance for most use cases.
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Lgtm, let's merge as-is (with hardcoded buffer defaults) – we can expose them in future, but probably better to limit the amount of knobs users can touch in MVP.

Will take for a spin in 0.38.0-rc2

@lidel lidel merged commit 776c21a into master Sep 26, 2025
16 checks passed
@lidel lidel deleted the fix/provider-merge-conflicts branch September 26, 2025 01:22
lidel added a commit that referenced this pull request Sep 27, 2025
Co-authored-by: Marcin Rataj <lidel@lidel.org>
(cherry picked from commit 776c21a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip/changelog This change does NOT require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StartProviding() silently fails soon after daemon start: LAN provider: provider: offline

2 participants