| Age | Commit message (Collapse) | Author |
|
It is wrong most of the time in _notmuch_message_remove_terms, but
that function is too low level to know how to call
_n_m_invalidate_metadata with the right argument, at least not without
more extensive changes. This change merely makes the current behaviour
more obvious, since the other calls cannot have relied on metadata
being invalidated.
|
|
The overall goal is to allow clients to restart operations in
situations where that is the response recommended by the underlying
Xapian library.
Amended-by: db, added above explanation
|
|
If an open database is modified sufficiently by other callers, the open
instance becomes invalid and operations on it throw
DatabaseModifiedError. Per Xapian documentation, the caller is then
supposed to reopen the database and restart the query. This exception is
currently not handled in _notmuch_message_create(), leading to the
default handler abort()ing the process.
Catch this exception in _notmuch_message_create() and return an error
instead of crashing. Since the entire query becomes invalid - including
results that have already been read by the caller - this situation
cannot be handled by libnotmuch transparently. A new public function -
notmuch_messages_status() - is added to allow the callers to check
whether the messages iterator was exhausted or terminated early due to
a runtime error. This also allows memory allocation failure to be
signalled to the caller.
Amended-By: David Bremner <david@tethera.net>
[replace use of notmuch_messages_valid]
|
|
It isn't really clear how this worked before. Traversing the terms of
a document after deleting it from the database seems likely to be
undefined behaviour at best
|
|
_notmuch_message_remove_all_properties wasn't syncing the message back
to the database but was still invalidating the metadata, giving the
impression the properties had actually been removed.
Also move the metadata invalidation to _notmuch_message_remove_terms
to be closer to what's done in _notmuch_message_modify_property and
_notmuch_message_remove_term.
|
|
Previously we just crashed with an internal error. With this change,
the caller can handle it better. Update notmuch-new so that it doesn't
crash with "unknown error code" because of this change.
|
|
The call to delete_document can throw exceptions (and can happen in
practice [1]), so catch the exception and extract the error
message. As a side effect, also move the call to _n_m_has_term inside
the try/catch. This should not change anything as that function
already traps any Xapian exceptions.
[1]: id:wwuk039sk2p.fsf@chaotikum.eu
|
|
The database needs to be writable because the list of stored file
names will change in general.
|
|
Mainly to propagate information about Xapian exceptions.
|
|
Xapian exceptions are not something that can be ignored, in general.
|
|
This function has been unused since commit 4083fd8.
|
|
Some code movement is needed to make sure the cache is only
invalidated when the Xapian operation succeeds.
|
|
As far as I know, this is just a style / consistency thing, unless
notmuch code starts defining FALSE inconsistently with false.
|
|
Initially reported by Eliza Vasquez [1] (via valgrind).
[1]: id:87o7zxj086.fsf@eliza.
|
|
'message' should always be initialized if we reach here, but in case it
is not, we still want to be able to log an error message.
|
|
They are not used outside their file, so being extern seems like an oversight
|
|
This table is intended to be immutable
|
|
This is intended to fix the slow behaviour of "notmuch new" (and possibly
"notmuch reindex") when large numbers of files are deleted.
The underlying issue [1] seems to be the Xapian glass backend spending
a large amount of time in db.has_positions when running queries with
large-ish amounts of unflushed changes.
This commit removes two uses of Xapian queries [2], and replaces them with
an approximation of what Xapian would do after optimizing the
queries. This avoids the calls to has_positions (which are in any case
un-needed because we are only using boolean terms here).
[1] Thanks to "andres" on IRC for narrowing down the performance
bottleneck.
[2] Thanks to Olly Betts of Xapian fame for talking me a through a fix
that does not require people to update Xapian.
|
|
Introduce a new configuration value for the mail root, and use it to
locate mail messages in preference to the database.path (which
previously implied the mail messages were also in this location.
Initially only a subset of the CLI is tested in a split
configuration. Further changes will be needed for the remainder of the
CLI to work in split configurations.
|
|
Include the (currently unused) mode argument which will specify which
mode to re-open the database in. Functionality and docs to be
finalized in a followup commit.
|
|
This is the result of running
$ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h *.cc
in the lib directory
|
|
static_cast is a bit tricky to understand and error prone, so add a
second pointer to (potentially the same) Xapian database object that
we know has the right subclass.
|
|
The plan is to change the underlying representation.
|
|
The original generic handler had an extra '%s' in the format
string. Update tests that failed to catch this because the template to
print status strings checked 'stat', which was not set.
|
|
Also update the documentation for the behaviour of n_m_get_thread_id
that this fix relies on.
|
|
At least the exception we already catch should be reported properly.
|
|
Initially the new function is mainly tested indirectly via the
wrapper.
|
|
This passes the NULL return inside _ensure_maildir_flags does not
break anything. Probably this should be handled more explicitely.
|
|
It's not very nice to return FALSE for an error, so provide
notmuch_message_get_flag_st as a migration path.
Bump LIBNOTMUCH_MINOR_VERSION because the API is extended.
|
|
Currently I don't know of a good way of testing this, but at least in
principle a Xapian exception in _notmuch_message_{add,remove}_term
would cause an abort in the library.
|
|
The churn here is again mainly re-indentation.
|
|
This is mostly just (horizontal) code movement due to wrapping
everything in a try / catch.
|
|
This will require some care for the caller to check the sign, and not
just add error returns into a running total.
|
|
This allows the function to return an error value rather than
crashing.
|
|
This should not change functionality, but does slightly reduce code
duplication. Perhaps more importantly it allows consistent changes to
all of the similar exception handling in message.cc.
|
|
This is essentially copied from the change to notmuch_message_get_filename
|
|
This is the same machinery as applied for
notmuch_message_get_{thread,message}_id
|
|
This is just for consistency, and a small reduction in the amount of
boilerplate.
|
|
This allows us to return an error value from the library.
|
|
By catching it at the library top level, we can return an error value.
|
|
strncmp looks for a prefix that matches, which is very much not what
we want here. This fixes the bug reported by Franz Fellner in
id:1588595993-ner-8.651@TPL520
|
|
This is the result of running
$ uncrustify --replace --config ../devel/uncrustify.cfg *.c *.h *.cc
in the lib directory
|
|
When indexing the cleartext of an encrypted message, record any
protected subject in the database, which should make it findable and
visible in search.
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
|
This should not change the indexing process yet as nothing calls
_notmuch_message_gen_terms with a user prefix name. On the other hand,
it should not break anything either.
_notmuch_database_prefix does a linear walk of the list of (built-in)
prefixes, followed by a logarithmic time search of the list of user
prefixes. The latter is probably not really noticable.
|
|
Previously this functioned scanned every term attached to a given
Xapian document. It turns out we know how to read only the terms we
need to preserve (and we might have already done so). This commit
replaces many calls to Xapian::Document::remove_term with one call to
::clear_terms, and a (typically much smaller) number of calls to
::add_term. Roughly speaking this is based on the assumption that most
messages have more text than they have tags.
According to the performance test suite, this yields a roughly 40%
speedup on "notmuch reindex '*'"
|
|
The new `body:` field (in Xapian terms) or prefix (in slightly
sloppier notmuch) terms allows matching terms that occur only in the
body.
Unprefixed query terms should continue to match anywhere (header or
body) in the message.
This follows a suggestion of Olly Betts to use the facility (since
Xapian 1.0.4) to add the same field with multiple prefixes. The double
indexing of previous versions is thus replaced with a query time
expension of unprefixed query terms to the various prefixed
equivalent.
Reindexing will be needed for 'body:' searches to work correctly;
otherwise they will also match messages where the term occur in
headers (demonstrated by the new tests in T530-upgrade.sh)
|
|
This will be used in reparenting messages without useful in-reply-to,
but with useful references
|
|
The plan is to use these in resolving threads.
|
|
For non-root messages, this should not should anything currently, as
the messages are already added in date order. In the future we will
add some non-root messages in a second pass out of order and the
sorting will be useful. It does fix the order of multiple
root-messages (although it is overkill for that).
|
|
This is technically an API change, but it is not an ABI change, and
it's merely a statement that limits what the library can do.
This is in parallel to notmuch_query_get_database(), which also takes
a const pointer.
|