Skip to content

fix(backend-api): thread mdbox tuning via a shared mailboxbuild helper (#639)#642

Merged
0kaba0hub merged 1 commit into
mainfrom
fix/backend-api-mdbox-tuning
Jul 18, 2026
Merged

fix(backend-api): thread mdbox tuning via a shared mailboxbuild helper (#639)#642
0kaba0hub merged 1 commit into
mainfrom
fix/backend-api-mdbox-tuning

Conversation

@0kaba0hub

Copy link
Copy Markdown
Owner

yarilo-backend-api's local buildMailbox built the mdbox backend without WithAltStorage/WithRotateSize/WithRotateInterval/WithPreallocate, so yarilo-admin mdbox altmove was structurally broken (always alt storage not configured, even with mdbox_alt_storage_path set end-to-end) and purge's compaction silently ignored the configured tuning. The session servers wired it correctly — two independent copies of the mdbox-build logic that drifted.

Fix

New internal/storage/mailboxbuild package (ByDriver + ParseIntervalSeconds), depending only on storage drivers + config (no session-server code, so lean binaries stay lean). Both internal/backend and yarilo-backend-api build every driver through it — no more drift. internal/backend's helpers collapse to thin wrappers; yarilo-fts unchanged.

Tests

TestByDriverThreadsMdboxAltStorage (backend built with the key set reports AltEnabled()) + ParseIntervalSeconds table. Full suite + -tags flatcurve green; helm lint clean. appVersion → 2.1.9.

Closes #639

#639)

yarilo-backend-api's local buildMailbox constructed the mdbox backend without
WithAltStorage / WithRotateSize / WithRotateInterval / WithPreallocate, so
`yarilo-admin mdbox altmove` was structurally broken (always "alt storage not
configured", even with mdbox_alt_storage_path set end-to-end), and purge's
compaction silently ignored the configured rotate/preallocate tuning. The session
servers (internal/backend) wired it correctly — the two paths were independent
copies of "how to build an mdbox backend from config" that drifted.

Extract that logic into a new internal/storage/mailboxbuild package (ByDriver +
ParseIntervalSeconds) that depends only on the storage drivers and config — not on
any session-server package, so the lean operator/indexer binaries don't pull in
imap/lmtp code. Both internal/backend and yarilo-backend-api now build every
driver through mailboxbuild.ByDriver, so mdbox tuning can't drift between them
again. internal/backend's buildMailboxByDriver / BuildMailboxByDriver /
buildNamespaceMailboxes collapse to thin wrappers over it (mdboxTuning /
mdboxTuningFrom / parseIntervalSeconds removed).

Test: ByDriver threads mdbox_alt_storage_path (a backend built with the key set
reports AltEnabled(); one without it does not) + ParseIntervalSeconds table moved
alongside the function. Both build tags green.

Bump appVersion to 2.1.9.

Closes #639
@0kaba0hub
0kaba0hub merged commit 1652692 into main Jul 18, 2026
3 checks passed
@0kaba0hub
0kaba0hub deleted the fix/backend-api-mdbox-tuning branch July 18, 2026 22:40
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.

backend-api: mdbox altmove structurally broken — buildMailbox() never threads alt_storage_path/rotate/preallocate tuning

2 participants