summaryrefslogtreecommitdiff
path: root/lib/mu-store.cc
AgeCommit message (Collapse)Author
2026-02-24mu-store: cosmeticsDirk-Jan C. Binnema
2026-02-16Work around xapian bugDaniel Colascione
https://trac.xapian.org/ticket/850
2026-02-16New incremental cleanup strategy: 63%-88% fasterDaniel Colascione
This change adds a new cleanup mode that avoids cleanup having re-traverse the directories the index pass just looked at. Additionally, we efficiently query the Xapian database by walking the term list instead of doing multiple point-wise path lookups. I'd noticed that most of my time in mu's cleanup pass consisted of B-tree lookups in Xapian (one 8KB pread64 at a time). The point lookups forced Xapian to traverse from the root of the B-tree to the leaf for every single message. Additionally, in order to join on the message path, we had to do *another* B-tree traversal after locating each message term. Now we just walk the terms in order, which is much more efficient, as we touch each B-tree node only once. On my system, with 1371861 total messages, the total time of mu index (no lazy check): --nocleanup: 3.6s incremental cleanup: 4.2s (0.6s in cleanup) legacy cleanup: 5.2s (1.6s in cleanup) With the new mode, we save 1.0s of the 1.6s cleanup, so we're ~63% faster. But the incremental cleanup works even better with lazy checking. If I enable --lazy-check, dirty only my INBOX (360778 messages), and run index, I get: --nocleanup: 0.9s incremental cleanup: 1.1s (0.2s in cleanup) legacy cleanup: 2.5s (1.6s in cleanup) We save 1.4s out of 1.6s for ~88% speedup. This change also fixes a timestamp bug: we should be storing the *start* time of the index pass in metadata, not the end time, so that on the next index pass, we notice messages that arrived between the two times. All tests pass. You can set the environment variable MU_NO_INCREMENTAL_CLEANUP to use the legacy cleanup path instead.
2025-09-03store: remove some _unlocked functions, update clear_labelsDirk-Jan C. Binnema
They don't add much value, let's remove. Rework clear_labels in terms of update_labels.
2025-09-02store: update labels when removing messagesDirk-Jan C. Binnema
This does make removing a bit slower...
2025-09-02mu: refactor labels codeDirk-Jan C. Binnema
Split labels-cache and store-labels.
2025-09-02labels: allow restoring cache-mapDirk-Jan C. Binnema
E.g. with unexpected termination for mu it is possible that the labels-cache (i.e., the one that is used for auto-completion) gets disconnected from reality. Add a --restore option to `mu label list` to restore the actual labels from the labels seen in the store.
2025-09-01store: implement serialize method, use itDirk-Jan C. Binnema
For triggering saving the contacts / labels caches.
2025-08-31store: improve label handlingDirk-Jan C. Binnema
In particular, clear_labels And some cosmetics
2025-08-16mu-init: automatic export labels with --reinitDirk-Jan C. Binnema
When re-initializing the store, automatically write the labels to a file in mu's cache, so user can later import them.
2025-08-16labels: refactor import/export to mu-store-labelsDirk-Jan C. Binnema
Move the import/export code to 'lib'.
2025-08-15store: add support for modifying and listing labels and cachingDirk-Jan C. Binnema
Add methods update_labels, clear_labels which update or clear the labels for a message in the store, and update the cache with the overall counts of labels. Add a LabelsCache to keep track of the counts and labels_map() to retrieve that map.
2024-11-26lib/store-worker: removeDirk-Jan C. Binnema
We're not using it.
2024-06-03store-worker: implementDirk-Jan C. Binnema
store-worker is a thread + async queue to throttle requests to a single thread.
2024-06-03xapian-db: remove locks, transaction levelsDirk-Jan C. Binnema
Simplify xapian-db: locks should go elsewhere; transaction level add too much complication.
2024-06-01lib: fix batch-size after db creationDirk-Jan C. Binnema
Ensure we use the user-specified batch-size immediately after db creation.
2024-05-08mu-store/indexer: consume messages from workersDirk-Jan C. Binnema
Add store::consume_message, which is like add message but std::move from the caller such that the messages longer has copies (with Xapian::Document) on the caller side; this is to avoid threading issues.
2024-03-15clang: fix some compiler warningsDirk-Jan C. Binnema
From CI.
2024-02-26mu-init: insist that --maildir is absoluteDirk-Jan C. Binnema
2024-02-25lib/mu-store: don't assume non-empty in remove_slashDirk-Jan C. Binnema
HT: Arsen Arsenović Fixes #2633.
2023-12-22lib: move transaction handling to mu-xapianDirk-Jan C. Binnema
Instead of handling transactions in the store, handle it in xapian-db. Make the code a bit more natural / cleaner-out Handle transaction automatically (with a batch-size) and add some RAII Transaction object, which makes all database interaction transactable for the duration. So, no more need for explicit parameters to add_message while indexing.
2023-09-24store: better handling moving messagesDirk-Jan C. Binnema
sort results (for testing) with the ChangeName flag, also apply to dup messages.
2023-09-24mu-move: add new move sub commandDirk-Jan C. Binnema
Add sub-command to move messages; add tests and docs. Fixes #157
2023-09-23lib: xapian-db/config: more testsDirk-Jan C. Binnema
...and xapian-db gets a small API update, update store as well.
2023-09-16provide end-user hints and show themDirk-Jan C. Binnema
Only a few for now.
2023-09-10lib: move index/ into main lib/Dirk-Jan C. Binnema
simplify things a bit
2023-09-09support xapian ngramsDirk-Jan C. Binnema
Xapian supports an "ngrams" option to help with languages/scripts without explicit wordbreaks, such as Chinese / Japanese / Korean. Add some plumbing for supporting this in mu as well. Experimental for now.
2023-08-17store: expose maildirs() methodDirk-Jan C. Binnema
This gets the current list of maildirs by asking the scanner to do a file-system search.
2023-08-17store: update "move" and some related APIsDirk-Jan C. Binnema
Update test cases as well.
2023-07-25store: add 'add_document' optimization, use itDirk-Jan C. Binnema
*Usually* we need Xapian's replace_document() API, but when we know a document (message) is completely new, we can use the faster add_document(). That is the case with the initial (re)indexing, when start with an empty database. Also a few smaller cleanups.
2023-07-11lib/store: improve dirstamp / set_dirstamp codeDirk-Jan C. Binnema
Modernize.
2023-07-10store/server: centralize docids-for-msgidDirk-Jan C. Binnema
No need for two near-identical impls Remove some dead declarations.
2023-07-10lib: xapian-db/store: simplifyDirk-Jan C. Binnema
No need for "pimpl" in xapian-db; keep it simple.
2023-07-06store: removing trailing / for root_maildirDirk-Jan C. Binnema
Other code depends on that.
2023-07-06store: only write last-change _once_Dirk-Jan C. Binnema
xapian-db does it, no longer needed in store.cc
2023-07-05update to use fmt-based apisDirk-Jan C. Binnema
Not complete, but a first big stab converting users of Mu::Error and various g_warning & friends, format to the new libfmt-based APIs.
2023-07-02lib/store: rework to use xapian-db / configDirk-Jan C. Binnema
Simplifies the implementation.
2023-04-23store: small cleanupsDirk-Jan C. Binnema
Remove readonly/inmemory from properties. Add read_only() accessor.
2023-01-14mu-store: fix typoDirk-Jan C. Binnema
2023-01-14utils: get rid of mu-util.[ch]Dirk-Jan C. Binnema
It was getting old... Remove the unused parts, refactor the few parts still in use.
2023-01-06mu-store: create mu cache path if neededDirk-Jan C. Binnema
2022-12-07store: update move_message APIDirk-Jan C. Binnema
Update the move_message API so to allow for updating duplicate messages too (not implemented yet), and return all updated messages.
2022-11-07store: update for new sexp apiDirk-Jan C. Binnema
And use improved cached_sexp api (automatically handled with mu-document now)
2022-10-26store: fix move ctorDirk-Jan C. Binnema
indexer_ is holding a ptr to the _old_ store; clear it so it gets regenerated.
2022-10-02store: support reinitDirk-Jan C. Binnema
Support reinitializing, based on some current store. This is useful for upgrading. Note that this is only the backend implementation + tests.
2022-06-29maildir: improve testing coverageDirk-Jan C. Binnema
Remove some dead/unused code. Update docs. Add test cases.
2022-05-30store: log whether a message is 'personal'Dirk-Jan C. Binnema
2022-05-19lib: remove some dead code (mu-str/utils)Dirk-Jan C. Binnema
Remove unused library code; recycle some electrons.
2022-05-18indexer/store: avoid completed callbackDirk-Jan C. Binnema
This cause havoc / race conditions.
2022-05-18store: reset indexer in dtorDirk-Jan C. Binnema
Clear it up as soon as possible.