<feed xmlns='http://www.w3.org/2005/Atom'>
<title>notmuch/lib/database.cc, branch debian/0.19-1</title>
<subtitle>thread-based email index, search, and tagging</subtitle>
<id>https://git.notmuchmail.org/git/notmuch/atom?h=debian%2F0.19-1</id>
<link rel='self' href='https://git.notmuchmail.org/git/notmuch/atom?h=debian%2F0.19-1'/>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/'/>
<updated>2014-10-25T17:46:19Z</updated>
<entry>
<title>lib: Remove unnecessary thread linking steps when using ghost messages</title>
<updated>2014-10-25T17:46:19Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-23T12:30:41Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=70f15b37fb226160acea591632b73ebe1e48809c'/>
<id>urn:sha1:70f15b37fb226160acea591632b73ebe1e48809c</id>
<content type='text'>
Previously, it was necessary to link new messages to children to work
around some (though not all) problems with the old metadata-based
approach to stored thread IDs.  With ghost messages, this is no longer
necessary, so don't bother with child linking when ghost messages are
in use.
</content>
</entry>
<entry>
<title>lib: Implement upgrade to ghost messages feature</title>
<updated>2014-10-25T17:30:08Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-23T12:30:38Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=d1e8c80b7239705b05bfa3e129c5de1c7099498a'/>
<id>urn:sha1:d1e8c80b7239705b05bfa3e129c5de1c7099498a</id>
<content type='text'>
Somehow this is the first upgrade pass that actually does *any* error
checking, so this also adds the bit of necessary infrastructure to
handle that.
</content>
</entry>
<entry>
<title>lib: Implement ghost-based thread linking</title>
<updated>2014-10-25T17:27:07Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-23T12:30:37Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=58a4277d3b2ad88bc285f2dae998626b0aa73299'/>
<id>urn:sha1:58a4277d3b2ad88bc285f2dae998626b0aa73299</id>
<content type='text'>
This updates the thread linking code to use ghost messages instead of
user metadata to link messages into threads.

In contrast with the old approach, this is actually correct.
Previously, thread merging updated only the thread IDs of message
documents, not thread IDs stored in user metadata.  As originally
diagnosed by Mark Walters [1] and as demonstrated by the broken
T260-thread-order test, this can cause notmuch to fail to link
messages even though they're in the same thread.  In principle the old
approach could have been fixed by updating the user metadata thread
IDs as well, but these are not indexed and hence this would have
required a full scan of all stored thread IDs.  Ghost messages solve
this problem naturally by reusing the exact same thread ID and message
ID representation and indexing as regular messages.

Furthermore, thanks to this greater symmetry, ghost messages are also
algorithmically simpler.  We continue to support the old user metadata
format, so this patch can't delete any code, but when we do remove
support for the old format, several functions can simply be deleted.

[1] id:8738h7kv2q.fsf@qmul.ac.uk
</content>
</entry>
<entry>
<title>lib: Update database schema doc for ghost messages</title>
<updated>2014-10-25T17:26:03Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-23T12:30:34Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=d9f5da00bb7707f3244654b4e44df2284e3634be'/>
<id>urn:sha1:d9f5da00bb7707f3244654b4e44df2284e3634be</id>
<content type='text'>
This describes the structure of ghost mail documents.  Ghost messages
are not yet implemented.
</content>
</entry>
<entry>
<title>lib: Add a ghost messages database feature</title>
<updated>2014-10-25T17:25:54Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-23T12:30:33Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=1cdb96d3c4a2fc5ddf3a6e5c73c59c0f0e65cae2'/>
<id>urn:sha1:1cdb96d3c4a2fc5ddf3a6e5c73c59c0f0e65cae2</id>
<content type='text'>
This will be implemented over the next several patches.  The feature
is not yet "enabled" (this does not add it to
NOTMUCH_FEATURES_CURRENT).
</content>
</entry>
<entry>
<title>lib: Refactor _notmuch_database_link_message</title>
<updated>2014-10-11T05:10:02Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-06T23:17:08Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=46b1b035a5b82379706b9adee78568738f135123'/>
<id>urn:sha1:46b1b035a5b82379706b9adee78568738f135123</id>
<content type='text'>
This moves the code to retrieve and clear the metadata thread ID out
of _notmuch_database_link_message into its own function.  This will
simplify future changes.
</content>
</entry>
<entry>
<title>lib: Move message ID compression to _notmuch_message_create_for_message_id</title>
<updated>2014-10-11T05:09:54Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-06T23:17:07Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=54ec8a0fd87ae7a32c8208be67a345c0eeea7f69'/>
<id>urn:sha1:54ec8a0fd87ae7a32c8208be67a345c0eeea7f69</id>
<content type='text'>
Previously, this was performed by notmuch_database_add_message.  This
happens to be the only caller currently (which is why this was safe),
but we're about to introduce more callers, and it makes more sense to
put responsibility for ID compression in the lower-level function
rather than requiring each caller to handle it.
</content>
</entry>
<entry>
<title>lib: Simplify close and codify aborting atomic section</title>
<updated>2014-10-03T06:58:58Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-10-02T19:19:08Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=cec601c4dd94d19ce7e27804b6a2adbb9197824d'/>
<id>urn:sha1:cec601c4dd94d19ce7e27804b6a2adbb9197824d</id>
<content type='text'>
In Xapian, closing a database implicitly aborts any outstanding
transaction and commits changes.  For historical reasons,
notmuch_database_close had grown to almost, but not quite duplicate
this behavior.  Before closing the database, it would explicitly (and
unnecessarily) commit it.  However, if there was an outstanding
transaction (ie atomic section), commit would throw a Xapian
exception, which notmuch_database_close would unnecessarily print to
stderr, even though notmuch_database_close would ultimately abort the
transaction anyway when it called close.

This patch simplifies notmuch_database_close to explicitly abort any
outstanding transaction and then just call Database::close.  This
works for both read-only and read/write databases, takes care of
committing changes, unifies the exception handling path, and codifies
aborting outstanding transactions.  This is currently the only way to
abort an atomic section (and may remain so, since it would be
difficult to roll back things we may have cached from rolled-back
modifications).
</content>
</entry>
<entry>
<title>lib: Fix endless upgrade problem</title>
<updated>2014-09-02T06:06:51Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-09-01T22:49:07Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=cca05ac10e908c2a8d7fdb3beac59bc085de9702'/>
<id>urn:sha1:cca05ac10e908c2a8d7fdb3beac59bc085de9702</id>
<content type='text'>
48db8c8 introduced a disagreement between when
notmuch_database_needs_upgrade returned TRUE and when
notmuch_database_upgrade actually performed an upgrade.  As a result,
if a database had a version less than 3, but no new features were
required, notmuch new would call notmuch_database_upgrade to perform
an upgrade, but notmuch_database_upgrade would return immediately
without updating the database version.  Hence, the next notmuch new
would do the same, and so on.

Fix this by ensuring that the upgrade-required logic is identical
between the two.
</content>
</entry>
<entry>
<title>lib: Return an error from operations that require an upgrade</title>
<updated>2014-08-30T18:39:41Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@mit.edu</email>
</author>
<published>2014-08-25T17:26:08Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=ec573cd54fb3ea98f37a3c3612b00fb16e34578b'/>
<id>urn:sha1:ec573cd54fb3ea98f37a3c3612b00fb16e34578b</id>
<content type='text'>
Previously, there was no protection against a caller invoking an
operation on an old database version that would effectively corrupt
the database by treating it like a newer version.

According to notmuch.h, any caller that opens the database in
read/write mode is supposed to check if the database needs upgrading
and perform an upgrade if it does.  This would protect against this,
but nobody (even the CLI) actually does this.

However, with features, it's easy to protect against incompatible
operations on a fine-grained basis.  This lightweight change allows
callers to safely operate on old database versions, while preventing
specific operations that would corrupt the database with an
informative error message.
</content>
</entry>
</feed>
