Re: [PATCH 0/3] notmuch-deliver: wait for database to become unlocked and test
authorAli Polatel <polatel@gmail.com>
Mon, 7 Nov 2011 01:32:29 +0000 (03:32 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:01 +0000 (09:40 -0800)
7e/187a12c22065e3828fcce46f313069f698ecf4 [new file with mode: 0644]

diff --git a/7e/187a12c22065e3828fcce46f313069f698ecf4 b/7e/187a12c22065e3828fcce46f313069f698ecf4
new file mode 100644 (file)
index 0000000..deb1c72
--- /dev/null
@@ -0,0 +1,163 @@
+Return-Path: <polatel@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id D2AD0429E21\r
+       for <notmuch@notmuchmail.org>; Sun,  6 Nov 2011 17:32:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id G4TAe7ih-rnY for <notmuch@notmuchmail.org>;\r
+       Sun,  6 Nov 2011 17:32:38 -0800 (PST)\r
+Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
+       [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id DBC29431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  6 Nov 2011 17:32:37 -0800 (PST)\r
+Received: by faan15 with SMTP id n15so1880807faa.26\r
+       for <notmuch@notmuchmail.org>; Sun, 06 Nov 2011 17:32:35 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=date:from:to:cc:subject:message-id:mail-followup-to:references\r
+       :mime-version:content-type:content-disposition:in-reply-to\r
+       :user-agent; bh=98oL6ZKi19CQguYSOZr2eVJzQoMDqQ3GgRxCeNoZNu8=;\r
+       b=IYEBEbd+4BuElxDBehD8k7dCBUpsvryTg2pZf6gdCIx3h/Q/ZkB/kQW9hkJiJGaf/L\r
+       euAFWcfMV7R3DFMoTWYEdj6IzhMsLFVTGpp3hS3RLmVx/kd0GeO+UsLyYUB/lhx9Sb1r\r
+       TMK+SLyMvUAxjFJTTk+ayy9HN/0fTnX6XAyE0=\r
+Received: by 10.152.105.67 with SMTP id gk3mr5550423lab.48.1320629555036;\r
+       Sun, 06 Nov 2011 17:32:35 -0800 (PST)\r
+Received: from localhost ([88.251.184.245])\r
+       by mx.google.com with ESMTPS id hm12sm7069097lab.9.2011.11.06.17.32.32\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 06 Nov 2011 17:32:33 -0800 (PST)\r
+Date: Mon, 7 Nov 2011 03:32:29 +0200\r
+From: Ali Polatel <polatel@gmail.com>\r
+To: David Riebenbauer <davrieb@liegesta.at>\r
+Subject: Re: [PATCH 0/3] notmuch-deliver: wait for database to become\r
+       unlocked and test\r
+Message-ID: <20111107013229.GA27262@hayalet>\r
+Mail-Followup-To: David Riebenbauer <davrieb@liegesta.at>,\r
+       Notmuch Mailing List <notmuch@notmuchmail.org>\r
+References: <1320578584-6642-1-git-send-email-davrieb@liegesta.at>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+       protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1"\r
+Content-Disposition: inline\r
+In-Reply-To: <1320578584-6642-1-git-send-email-davrieb@liegesta.at>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+Cc: Notmuch Mailing List <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 07 Nov 2011 01:32:41 -0000\r
+\r
+\r
+--RnlQjJ0d97Da+TV1\r
+Content-Type: text/plain; charset=us-ascii; format=flowed\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Sun, Nov 06, 2011 at 12:23:01PM +0100, David Riebenbauer wrote:\r
+>Hi,\r
+>\r
+>I noticed that mail would bounce in my setup, if the xapian database\r
+>was locked while notmuch-deliver tried to run.\r
+\r
+I recall having this problem sometime ago...\r
+\r
+>My solution was to make it wait for some time adn retry. A test\r
+>program for is alos included.\r
+\r
+Looks like a workaround more than a solution. What happens if the\r
+database doesn't become available for writing in the meantime?\r
+\r
+Quoting from:\r
+http://xapian.org/docs/admin_notes.html#single-writer-multiple-reader\r
+\r
+"Xapian enforces this restriction using by having a writer lock the databas=\r
+e.\r
+Each Xapian database directory contains a lock file named flintlock (we've =\r
+kept\r
+the same name as flint used, since the locking technique is the same).\r
+\r
+This lock-file will always exist, but will be locked using fcntl() when the\r
+database is open for writing. Because of the semantics of fcntl() locking, =\r
+for\r
+each WritableDatabase opened we spawn a child process to hold the lock, whi=\r
+ch\r
+then exec-s cat, so you will see a cat subprocess of any writer process in =\r
+the\r
+output of ps, top, etc."\r
+\r
+See? It's a simple fcntl() lock!\r
+\r
+That said, I'm against adding this kind of kludge to notmuch-deliver or\r
+any other tool accessing the database via libnotmuch. Until the issue is\r
+fixed properly I, and I suppose you, can live with a simple shell script\r
+using flock(1) on the file .notmuch/xapian/flintlock.\r
+\r
+One possible solution is described by Austin in the mail:\r
+id:AANLkTi=3DKOx8aTJipkiArFVjEHE6zt_JypoASMiiAWBZ6@mail.gmail.com\r
+which I quite like.\r
+\r
+>Regards,\r
+>David\r
+\r
+               -alip\r
+\r
+>David Riebenbauer (3):\r
+>  notmuch-deliver: wait for the database to become unlocked\r
+>  notmuch-deliver: test wait for database to become available\r
+>  notmuch-deliver: Convert test program to glib main loop.\r
+>\r
+> contrib/notmuch-deliver/.gitignore          |    2 +\r
+> contrib/notmuch-deliver/Makefile.am         |    2 +-\r
+> contrib/notmuch-deliver/configure.ac        |    1 +\r
+> contrib/notmuch-deliver/src/main.c          |   25 +++-\r
+> contrib/notmuch-deliver/test/Makefile.am    |   26 +++\r
+> contrib/notmuch-deliver/test/nm-test.sh     |    9 +\r
+> contrib/notmuch-deliver/test/nm-testconfig  |   12 ++\r
+> contrib/notmuch-deliver/test/notmuch-lock.c |  226 ++++++++++++++++++++++=\r
++++++\r
+> contrib/notmuch-deliver/test/testmail       |    7 +\r
+> 9 files changed, 306 insertions(+), 4 deletions(-)\r
+> create mode 100644 contrib/notmuch-deliver/test/Makefile.am\r
+> create mode 100755 contrib/notmuch-deliver/test/nm-test.sh\r
+> create mode 100644 contrib/notmuch-deliver/test/nm-testconfig\r
+> create mode 100644 contrib/notmuch-deliver/test/notmuch-lock.c\r
+> create mode 100644 contrib/notmuch-deliver/test/testmail\r
+>\r
+>--=20\r
+>1.7.7.1\r
+>\r
+>_______________________________________________\r
+>notmuch mailing list\r
+>notmuch@notmuchmail.org\r
+>http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--RnlQjJ0d97Da+TV1\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2.0.18 (GNU/Linux)\r
+\r
+iEYEARECAAYFAk63NS0ACgkQQU4yORhF8iCkLACeO3fFLjS7k+/3aAqwpsWQE52a\r
+W3wAn1Pn/AtpZUwsTLE22Bm5T4gSphYL\r
+=VYgh\r
+-----END PGP SIGNATURE-----\r
+\r
+--RnlQjJ0d97Da+TV1--\r