unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ali Polatel <polatel@gmail.com>
To: David Riebenbauer <davrieb@liegesta.at>
Cc: Notmuch Mailing List <notmuch@notmuchmail.org>
Subject: Re: [PATCH 0/3] notmuch-deliver: wait for database to become unlocked and test
Date: Mon, 7 Nov 2011 03:32:29 +0200	[thread overview]
Message-ID: <20111107013229.GA27262@hayalet> (raw)
In-Reply-To: <1320578584-6642-1-git-send-email-davrieb@liegesta.at>

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

On Sun, Nov 06, 2011 at 12:23:01PM +0100, David Riebenbauer wrote:
>Hi,
>
>I noticed that mail would bounce in my setup, if the xapian database
>was locked while notmuch-deliver tried to run.

I recall having this problem sometime ago...

>My solution was to make it wait for some time adn retry. A test
>program for is alos included.

Looks like a workaround more than a solution. What happens if the
database doesn't become available for writing in the meantime?

Quoting from:
http://xapian.org/docs/admin_notes.html#single-writer-multiple-reader

"Xapian enforces this restriction using by having a writer lock the database.
Each Xapian database directory contains a lock file named flintlock (we've kept
the same name as flint used, since the locking technique is the same).

This lock-file will always exist, but will be locked using fcntl() when the
database is open for writing. Because of the semantics of fcntl() locking, for
each WritableDatabase opened we spawn a child process to hold the lock, which
then exec-s cat, so you will see a cat subprocess of any writer process in the
output of ps, top, etc."

See? It's a simple fcntl() lock!

That said, I'm against adding this kind of kludge to notmuch-deliver or
any other tool accessing the database via libnotmuch. Until the issue is
fixed properly I, and I suppose you, can live with a simple shell script
using flock(1) on the file .notmuch/xapian/flintlock.

One possible solution is described by Austin in the mail:
id:AANLkTi=KOx8aTJipkiArFVjEHE6zt_JypoASMiiAWBZ6@mail.gmail.com
which I quite like.

>Regards,
>David

		-alip

>David Riebenbauer (3):
>  notmuch-deliver: wait for the database to become unlocked
>  notmuch-deliver: test wait for database to become available
>  notmuch-deliver: Convert test program to glib main loop.
>
> contrib/notmuch-deliver/.gitignore          |    2 +
> contrib/notmuch-deliver/Makefile.am         |    2 +-
> contrib/notmuch-deliver/configure.ac        |    1 +
> contrib/notmuch-deliver/src/main.c          |   25 +++-
> contrib/notmuch-deliver/test/Makefile.am    |   26 +++
> contrib/notmuch-deliver/test/nm-test.sh     |    9 +
> contrib/notmuch-deliver/test/nm-testconfig  |   12 ++
> contrib/notmuch-deliver/test/notmuch-lock.c |  226 +++++++++++++++++++++++++++
> contrib/notmuch-deliver/test/testmail       |    7 +
> 9 files changed, 306 insertions(+), 4 deletions(-)
> create mode 100644 contrib/notmuch-deliver/test/Makefile.am
> create mode 100755 contrib/notmuch-deliver/test/nm-test.sh
> create mode 100644 contrib/notmuch-deliver/test/nm-testconfig
> create mode 100644 contrib/notmuch-deliver/test/notmuch-lock.c
> create mode 100644 contrib/notmuch-deliver/test/testmail
>
>-- 
>1.7.7.1
>
>_______________________________________________
>notmuch mailing list
>notmuch@notmuchmail.org
>http://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2011-11-07  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-06 11:23 [PATCH 0/3] notmuch-deliver: wait for database to become unlocked and test David Riebenbauer
2011-11-06 11:23 ` [PATCH 1/3] notmuch-deliver: wait for the database to become unlocked David Riebenbauer
2011-11-06 11:23 ` [PATCH 2/3] notmuch-deliver: test wait for database to become available David Riebenbauer
2011-11-06 11:23 ` [PATCH 3/3] notmuch-deliver: Convert test program to glib main loop David Riebenbauer
2011-11-07  1:32 ` Ali Polatel [this message]

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=20111107013229.GA27262@hayalet \
    --to=polatel@gmail.com \
    --cc=davrieb@liegesta.at \
    --cc=notmuch@notmuchmail.org \
    /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).