unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@mit.edu>
To: Thomas Schwinge <thomas@schwinge.name>
Cc: notmuch@notmuchmail.org
Subject: Re: notmuch's idea of concurrency / failing an invocation
Date: Fri, 28 Jan 2011 11:50:06 -0500	[thread overview]
Message-ID: <AANLkTinUhmcNKH6eFfcfygrc3XcVZoeDzVMFBSUi4LRQ@mail.gmail.com> (raw)
In-Reply-To: <877hdps6og.fsf@kepler.schwinge.homeip.net>

[-- Attachment #1: Type: text/plain, Size: 3314 bytes --]

On Fri, Jan 28, 2011 at 4:45 AM, Thomas Schwinge <thomas@schwinge.name>wrote:

> On Fri, 28 Jan 2011 15:10:01 +1000, Carl Worth <cworth@cworth.org> wrote:
> > On Thu, 27 Jan 2011 17:20:21 -0500, Austin Clements <amdragon@mit.edu>
> wrote:
> > > I'm looking into breaking notmuch new up into small transactions.  It
> > > wouldn't be much a leap from there to simply close and reopen the
> database
> > > between transactions if another task wants to use it, which would
> release
> > > the lock and let the queued notmuch task have the database for a bit.
> >
> > That sounds like something very useful to pursue. Please continue!
>
> Ack!  And actually -- I just wondered about that: what happens if
> ``notmuch new'' has executed notmuch_database_add_message for a new
> message M, but then is killed before adding any tags and finishing up
> (and supposing that the DB isn't in an invalid state now).  This process
> of adding M to the DB and applying any tags isn't one single transaction
> currently, right?  (And this is exactly what you're working on
> chainging?)  Am I right that what currently happens is that upon the next
> ``notmuch new'' run, notmuch will not reconsider M (given that it already
> is present in the DB), but continue with the next messages -- thus
> leaving M without any tags?  This isn't a very likely scenario, but still
> a possible one.


There are quite a few bugs like this.  In fact, last night I added a test
that interrupts notmuch new (for real, not SIGINT) after every database
write, and on each interrupted database snapshot, re-runs notmuch new to
completion, then checks that the database winds up in the correct state.
 There are dozens of interruption points where it doesn't, many of which are
permanent, even if you force notmuch new to rescan the maildir.

> Another advantage that can happen with queueing (wherever it occurs) is
> > to allow a client to be very responsive without waiting for an operation
> > to complete. Though that can of course be band if the operation isn't
> > reliably committed.
>
> (Obviously this can only work as long as we don't immediatelly need the
> operation's result; think ``notmuch show''.)
>
> So, if the DB has the functionality to internally queue and immediatelly
> acknowledge transactions, and only later (reliably) commit them, wouldn't
> that be fine indeed?  For example, ``notmuch tag'' then wouldn't have to
> wait for the DB to be writable.  (And note that I have no idea whether
> Xapian supports such things.)  But on the other hand we would like to
> immediatelly display the requested change in the UI, right?
>

This would be fantastic, if the client could indicate the difference between
a "pending" change and a "committed" change as you suggest below.  I don't
think having the database lie about its commit state is the right way to do
this, though (nor should the client lie about this, thus the "pending"
display).  A better way would be for the client to update the display to
"pending", start the notmuch operation asynchronously, have the notmuch
operation block and queue up on the database lock, then have the client
update the display to "committed" when the asynchronous operation returns.
 No weird database operations or transactional semantics and the client side
is fairly straightforward.

[-- Attachment #2: Type: text/html, Size: 4222 bytes --]

  parent reply	other threads:[~2011-01-28 16:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 18:20 notmuch's idea of concurrency / failing an invocation Thomas Schwinge
2011-01-27 18:40 ` micah anderson
2011-01-27 20:35   ` Jameson Rollins
2011-01-27 22:20     ` Austin Clements
2011-01-28  5:10       ` Carl Worth
2011-01-28  9:45         ` Thomas Schwinge
2011-01-28 15:36           ` Mike Kelly
2011-01-28 16:57             ` Austin Clements
2011-01-28 18:17               ` Austin Clements
2011-01-29 16:10               ` Mike Kelly
2011-01-28 16:50           ` Austin Clements [this message]
2011-02-24  6:59       ` Austin Clements
2011-02-03 16:28     ` micah anderson
2011-01-29  1:05   ` Stewart Smith
2011-01-30  0:14     ` Daniel Kahn Gillmor
2011-02-02  0:40       ` Stewart Smith
2011-01-28  5:07 ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinUhmcNKH6eFfcfygrc3XcVZoeDzVMFBSUi4LRQ@mail.gmail.com \
    --to=amdragon@mit.edu \
    --cc=notmuch@notmuchmail.org \
    --cc=thomas@schwinge.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).