fix(backend-api): thread mdbox tuning via a shared mailboxbuild helper (#639)#642
Merged
Conversation
#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
yarilo-backend-api's localbuildMailboxbuilt the mdbox backend withoutWithAltStorage/WithRotateSize/WithRotateInterval/WithPreallocate, soyarilo-admin mdbox altmovewas structurally broken (alwaysalt storage not configured, even withmdbox_alt_storage_pathset 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/mailboxbuildpackage (ByDriver+ParseIntervalSeconds), depending only on storage drivers + config (no session-server code, so lean binaries stay lean). Bothinternal/backendandyarilo-backend-apibuild every driver through it — no more drift.internal/backend's helpers collapse to thin wrappers;yarilo-ftsunchanged.Tests
TestByDriverThreadsMdboxAltStorage(backend built with the key set reportsAltEnabled()) +ParseIntervalSecondstable. Full suite +-tags flatcurvegreen;helm lintclean. appVersion → 2.1.9.Closes #639