From 81ae7899d14ccbefcf85b0db80513c35431fbf31 Mon Sep 17 00:00:00 2001 From: Istvan Marko Date: Wed, 4 May 2016 08:09:12 +1700 Subject: [PATCH] [PATCH] Use the Xapian::DB_RETRY_LOCK flag when available --- 27/70f10f818905dee44591b7ada49d326677c190 | 145 ++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 27/70f10f818905dee44591b7ada49d326677c190 diff --git a/27/70f10f818905dee44591b7ada49d326677c190 b/27/70f10f818905dee44591b7ada49d326677c190 new file mode 100644 index 000000000..4f8cf9bac --- /dev/null +++ b/27/70f10f818905dee44591b7ada49d326677c190 @@ -0,0 +1,145 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id A8A206DE01F7 + for ; Tue, 3 May 2016 08:34:03 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.927 +X-Spam-Level: +X-Spam-Status: No, score=0.927 tagged_above=-999 required=5 tests=[AWL=0.927] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id OEdat0b8IKPl for ; + Tue, 3 May 2016 08:33:53 -0700 (PDT) +X-Greylist: delayed 1480 seconds by postgrey-1.35 at arlo; + Tue, 03 May 2016 08:33:53 PDT +Received: from imarko.xen.prgmr.com (imarko.xen.prgmr.com [71.19.158.228]) + by arlo.cworth.org (Postfix) with ESMTP id CB0D76DE00DF + for ; Tue, 3 May 2016 08:33:53 -0700 (PDT) +Received: from localhost ([127.0.0.1] helo=zsu.kismala.com) + by imarko.xen.prgmr.com with esmtp (Exim 4.85) + (envelope-from ) id 1axbwm-0002Vu-HY + for notmuch@notmuchmail.org; Tue, 03 May 2016 08:09:12 -0700 +From: Istvan Marko +To: notmuch@notmuchmail.org +Subject: [PATCH] Use the Xapian::DB_RETRY_LOCK flag when available +User-Agent: Notmuch/0.21+69~gd27d908 (http://notmuchmail.org) Emacs/25.0.92.2 + (x86_64-unknown-linux-gnu) +Date: Tue, 03 May 2016 08:09:12 -0700 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 03 May 2016 15:34:03 -0000 + +Xapian 1.3 has introduced the DB_RETRY_LOCK flag (Xapian bug +275). Detect it in configure and use it if available. With this flag +commands that need the write lock will wait for their turn instead of +aborting when it's not immediately available. +--- + configure | 25 ++++++++++++++++++++++++- + lib/database.cc | 5 +++++ + 2 files changed, 29 insertions(+), 1 deletion(-) + +diff --git a/configure b/configure +index 6231d2b..0c1d5bc 100755 +--- a/configure ++++ b/configure +@@ -371,6 +371,21 @@ if [ ${have_xapian} = "1" ]; then + esac + fi + ++# DB_RETRY_LOCK is only supported on Xapian > 1.3.2 ++have_xapian_db_retry_lock=0 ++if [ ${have_xapian} = "1" ]; then ++ printf "Checking for Xapian lock retry support... " ++ case "${xapian_version}" in ++ 0.*|1.[012].*|1.3.[0-2]) ++ printf "No (only available with Xapian > 1.3.2).\n" ;; ++ [1-9]*.[0-9]*.[0-9]*) ++ have_xapian_db_retry_lock=1 ++ printf "Yes.\n" ;; ++ *) ++ printf "Unknown version.\n" ;; ++ esac ++fi ++ + default_xapian_backend="" + if [ ${have_xapian} = "1" ]; then + printf "Testing default Xapian backend... " +@@ -998,6 +1013,9 @@ HAVE_D_TYPE = ${have_d_type} + # Whether the Xapian version in use supports compaction + HAVE_XAPIAN_COMPACT = ${have_xapian_compact} + ++# Whether the Xapian version in use supports DB_RETRY_LOCK ++HAVE_XAPIAN_DB_RETRY_LOCK = ${have_xapian_db_retry_lock} ++ + # Whether the getpwuid_r function is standards-compliant + # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS + # to enable the standards-compliant version -- needed for Solaris) +@@ -1072,6 +1090,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ + -DSTD_GETPWUID=\$(STD_GETPWUID) \\ + -DSTD_ASCTIME=\$(STD_ASCTIME) \\ + -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\ ++ -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK) \\ + -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER) + + CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ +@@ -1086,6 +1105,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ + -DSTD_GETPWUID=\$(STD_GETPWUID) \\ + -DSTD_ASCTIME=\$(STD_ASCTIME) \\ + -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\ ++ -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK) \\ + -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER) + + CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS) +@@ -1097,7 +1117,10 @@ cat > sh.config <xapian_db = new Xapian::WritableDatabase (xapian_path, ++ Xapian::DB_CREATE_OR_OPEN|Xapian::DB_RETRY_LOCK); ++ #else + notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path, + Xapian::DB_CREATE_OR_OPEN); ++ #endif + } else { + notmuch->xapian_db = new Xapian::Database (xapian_path); + } +-- +2.4.10 + + +-- + Istvan -- 2.26.2