Re: [PATCH] Use the Xapian::DB_RETRY_LOCK flag when available

Subject: Re: [PATCH] Use the Xapian::DB_RETRY_LOCK flag when available

Date: Tue, 03 May 2016 16:01:44 -0300

To: Istvan Marko, notmuch@notmuchmail.org

Cc:

From: David Bremner


Istvan Marko <notmuch@kismala.com> writes:

> 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

First, thanks for writing the patch. I'd completely forgotten about this
feature, and it's something pretty important for many notmuch users. I
saw you got some good feedback from Jani. As a less urgent comment, what
about writing the test in the style of

      http://article.gmane.org/gmane.mail.notmuch.general/22329

I don't know if there's complete concensus on this, but I personally
much prefer testing features to versions when possible.

d



Thread: