Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 27 / 70f10f818905dee44591b7ada49d326677c190
1 Return-Path: <notmuch@kismala.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id A8A206DE01F7\r
6  for <notmuch@notmuchmail.org>; Tue,  3 May 2016 08:34:03 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.927\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.927 tagged_above=-999 required=5 tests=[AWL=0.927]\r
12  autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id OEdat0b8IKPl for <notmuch@notmuchmail.org>;\r
16  Tue,  3 May 2016 08:33:53 -0700 (PDT)\r
17 X-Greylist: delayed 1480 seconds by postgrey-1.35 at arlo;\r
18  Tue, 03 May 2016 08:33:53 PDT\r
19 Received: from imarko.xen.prgmr.com (imarko.xen.prgmr.com [71.19.158.228])\r
20  by arlo.cworth.org (Postfix) with ESMTP id CB0D76DE00DF\r
21  for <notmuch@notmuchmail.org>; Tue,  3 May 2016 08:33:53 -0700 (PDT)\r
22 Received: from localhost ([127.0.0.1] helo=zsu.kismala.com)\r
23  by imarko.xen.prgmr.com with esmtp (Exim 4.85)\r
24  (envelope-from <notmuch@kismala.com>) id 1axbwm-0002Vu-HY\r
25  for notmuch@notmuchmail.org; Tue, 03 May 2016 08:09:12 -0700\r
26 From: Istvan Marko <notmuch@kismala.com>\r
27 To: notmuch@notmuchmail.org\r
28 Subject: [PATCH] Use the Xapian::DB_RETRY_LOCK flag when available\r
29 User-Agent: Notmuch/0.21+69~gd27d908 (http://notmuchmail.org) Emacs/25.0.92.2\r
30  (x86_64-unknown-linux-gnu)\r
31 Date: Tue, 03 May 2016 08:09:12 -0700\r
32 Message-ID: <m38tzr2n6v.fsf@zsu.kismala.com>\r
33 MIME-Version: 1.0\r
34 Content-Type: text/plain\r
35 X-BeenThere: notmuch@notmuchmail.org\r
36 X-Mailman-Version: 2.1.20\r
37 Precedence: list\r
38 List-Id: "Use and development of the notmuch mail system."\r
39  <notmuch.notmuchmail.org>\r
40 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
41  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
42 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
43 List-Post: <mailto:notmuch@notmuchmail.org>\r
44 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
45 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
46  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
47 X-List-Received-Date: Tue, 03 May 2016 15:34:03 -0000\r
48 \r
49 Xapian 1.3 has introduced the DB_RETRY_LOCK flag (Xapian bug\r
50 275). Detect it in configure and use it if available. With this flag\r
51 commands that need the write lock will wait for their turn instead of\r
52 aborting when it's not immediately available.\r
53 ---\r
54  configure       | 25 ++++++++++++++++++++++++-\r
55  lib/database.cc |  5 +++++\r
56  2 files changed, 29 insertions(+), 1 deletion(-)\r
57 \r
58 diff --git a/configure b/configure\r
59 index 6231d2b..0c1d5bc 100755\r
60 --- a/configure\r
61 +++ b/configure\r
62 @@ -371,6 +371,21 @@ if [ ${have_xapian} = "1" ]; then\r
63      esac\r
64  fi\r
65  \r
66 +# DB_RETRY_LOCK is only supported on Xapian > 1.3.2\r
67 +have_xapian_db_retry_lock=0\r
68 +if [ ${have_xapian} = "1" ]; then\r
69 +    printf "Checking for Xapian lock retry support... "\r
70 +    case "${xapian_version}" in\r
71 +       0.*|1.[012].*|1.3.[0-2])\r
72 +           printf "No (only available with Xapian > 1.3.2).\n" ;;\r
73 +       [1-9]*.[0-9]*.[0-9]*)\r
74 +           have_xapian_db_retry_lock=1\r
75 +           printf "Yes.\n" ;;\r
76 +       *)\r
77 +           printf "Unknown version.\n" ;;\r
78 +    esac\r
79 +fi\r
80 +\r
81  default_xapian_backend=""\r
82  if [ ${have_xapian} = "1" ]; then\r
83      printf "Testing default Xapian backend... "\r
84 @@ -998,6 +1013,9 @@ HAVE_D_TYPE = ${have_d_type}\r
85  # Whether the Xapian version in use supports compaction\r
86  HAVE_XAPIAN_COMPACT = ${have_xapian_compact}\r
87  \r
88 +# Whether the Xapian version in use supports DB_RETRY_LOCK\r
89 +HAVE_XAPIAN_DB_RETRY_LOCK = ${have_xapian_db_retry_lock}\r
90 +\r
91  # Whether the getpwuid_r function is standards-compliant\r
92  # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS\r
93  # to enable the standards-compliant version -- needed for Solaris)\r
94 @@ -1072,6 +1090,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\\r
95                    -DSTD_GETPWUID=\$(STD_GETPWUID)                       \\\r
96                    -DSTD_ASCTIME=\$(STD_ASCTIME)                         \\\r
97                    -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)         \\\r
98 +                  -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK) \\\r
99                    -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER)\r
100  \r
101  CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
102 @@ -1086,6 +1105,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
103                      -DSTD_GETPWUID=\$(STD_GETPWUID)                     \\\r
104                      -DSTD_ASCTIME=\$(STD_ASCTIME)                       \\\r
105                      -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)       \\\r
106 +                     -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK) \\\r
107                      -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER)\r
108  \r
109  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)\r
110 @@ -1097,7 +1117,10 @@ cat > sh.config <<EOF\r
111  # script of notmuch.\r
112  \r
113  # Whether the Xapian version in use supports compaction\r
114 -NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}\r
115 +NOTMUCH_HAVE_XAPIAN_  =${have_xapian_compact}\r
116 +\r
117 +# Whether the Xapian version in use supports DB_RETRY_LOCK\r
118 +NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}\r
119  \r
120  # Which backend will Xapian use by default?\r
121  NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}\r
122 diff --git a/lib/database.cc b/lib/database.cc\r
123 index c8c5e26..4b503a2 100644\r
124 --- a/lib/database.cc\r
125 +++ b/lib/database.cc\r
126 @@ -929,8 +929,13 @@ notmuch_database_open_verbose (const char *path,\r
127         string last_mod;\r
128  \r
129         if (mode == NOTMUCH_DATABASE_MODE_READ_WRITE) {\r
130 +           #if HAVE_XAPIAN_DB_RETRY_LOCK\r
131 +           notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path,\r
132 +                                                              Xapian::DB_CREATE_OR_OPEN|Xapian::DB_RETRY_LOCK);\r
133 +           #else\r
134             notmuch->xapian_db = new Xapian::WritableDatabase (xapian_path,\r
135                                                                Xapian::DB_CREATE_OR_OPEN);\r
136 +           #endif\r
137         } else {\r
138             notmuch->xapian_db = new Xapian::Database (xapian_path);\r
139         }\r
140 -- \r
141 2.4.10\r
142 \r
143 \r
144 -- \r
145         Istvan\r