1 Return-Path: <amthrax@drake.mit.edu>
\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 olra.theworths.org (Postfix) with ESMTP id AE61B431FD0
\r
6 for <notmuch@notmuchmail.org>; Sat, 11 Jun 2011 13:07:32 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id BaNZgMlh-15d for <notmuch@notmuchmail.org>;
\r
16 Sat, 11 Jun 2011 13:07:32 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 3255A431FB6
\r
20 for <notmuch@notmuchmail.org>; Sat, 11 Jun 2011 13:07:32 -0700 (PDT)
\r
21 X-AuditID: 12074424-b7bc6ae000005a77-8e-4df3cb035304
\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])
\r
23 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 30.35.23159.30BC3FD4; Sat, 11 Jun 2011 16:07:31 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id p5BK7VAB015089;
\r
27 Sat, 11 Jun 2011 16:07:31 -0400
\r
28 Received: from drake.mit.edu
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p5BK7UgD006077
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sat, 11 Jun 2011 16:07:31 -0400 (EDT)
\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.76)
\r
36 (envelope-from <amthrax@drake.mit.edu>)
\r
37 id 1QVUSw-0000Ih-H6; Sat, 11 Jun 2011 16:07:30 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 16/17] new: Wrap adding and removing messages in atomic
\r
42 Date: Sat, 11 Jun 2011 16:04:42 -0400
\r
43 Message-Id: <1307822683-848-17-git-send-email-amdragon@mit.edu>
\r
44 X-Mailer: git-send-email 1.7.5.1
\r
45 In-Reply-To: <1307822683-848-1-git-send-email-amdragon@mit.edu>
\r
46 References: <87ei34rnc5.fsf@yoom.home.cworth.org>
\r
47 <1307822683-848-1-git-send-email-amdragon@mit.edu>
\r
48 X-Brightmail-Tracker:
\r
49 H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsUixCmqrMt8+rOvwddeM4vrN2cyOzB6PFt1
\r
50 izmAMYrLJiU1J7MstUjfLoErY/fRnewFcwQrPuyay97AeJa3i5GTQ0LAROJPewsLhC0mceHe
\r
51 erYuRi4OIYF9jBLLruyBcjYwSqxeuoYZwrnPJPHrwC9WCGc+o8S+Q12MIP1sAhoS2/YvB7NF
\r
52 BKQldt6dDVTEwcEsoCbxp0sFJCwsECjR3f0WbB2LgKrE8l8L2EFsXgF7iaVnnjJDnKEgceXK
\r
53 PLAaTqD4vINXwWwhgTSJJbd2s09g5F/AyLCKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11wvN7NE
\r
54 LzWldBMjKGzYXVR2MDYfUjrEKMDBqMTDe2rVZ18h1sSy4srcQ4ySHExKorw6J4BCfEn5KZUZ
\r
55 icUZ8UWlOanFhxglOJiVRHjXt3/yFeJNSaysSi3Kh0lJc7AoifPOk1T3FRJITyxJzU5NLUgt
\r
56 gsnKcHAoSfBKngIaKliUmp5akZaZU4KQZuLgBBnOAzT86EmgGt7igsTc4sx0iPwpRl2Oxxs2
\r
57 HWIUYsnLz0uVEudVBxkkAFKUUZoHNwcW768YxYHeEub9ATKKB5gq4Ca9AlrCBLREoBRsSUki
\r
58 QkqqgfFAlFq9VqJZ6P47enHWv8oMFxROY/779d5qt3QVXfPPDGpRkhL5JxsVvDw/2u7jv7cq
\r
59 hKWbl/32ZgnT2ANn0iQi1mzcc9D0z/HonTuuyk4v45rhr5N61Uh2RuNJux/a/FeCjF+0dHYd
\r
60 k7+dKGlo+mLnqk75hrjagAsxsYEWr9eHXvrw+EWXvxJLcUaioRZzUXEiACqJLmbSAgAA
\r
61 Cc: Austin Clements <amdragon@mit.edu>
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sat, 11 Jun 2011 20:07:32 -0000
\r
76 This addresses atomicity of tag synchronization, the last atomicity
\r
77 problems in notmuch new. Each message add or remove is wrapped in its
\r
78 own atomic section, so interrupting notmuch new doesn't lose progress.
\r
80 notmuch-new.c | 16 ++++++++++++++++
\r
81 test/atomicity | 2 +-
\r
82 2 files changed, 17 insertions(+), 1 deletions(-)
\r
84 diff --git a/notmuch-new.c b/notmuch-new.c
\r
85 index b24eb51..fb92b03 100644
\r
88 @@ -428,6 +428,12 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
92 + status = notmuch_database_begin_atomic (notmuch);
\r
98 status = notmuch_database_add_message (notmuch, next, &message);
\r
101 @@ -468,6 +474,12 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
105 + status = notmuch_database_end_atomic (notmuch);
\r
112 notmuch_message_destroy (message);
\r
114 @@ -700,6 +712,9 @@ remove_filename (notmuch_database_t *notmuch,
\r
116 notmuch_status_t status;
\r
117 notmuch_message_t *message;
\r
118 + status = notmuch_database_begin_atomic (notmuch);
\r
121 message = notmuch_database_find_message_by_filename (notmuch, path);
\r
122 status = notmuch_database_remove_message (notmuch, path);
\r
123 if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
\r
124 @@ -709,6 +724,7 @@ remove_filename (notmuch_database_t *notmuch,
\r
126 add_files_state->removed_messages++;
\r
127 notmuch_message_destroy (message);
\r
128 + notmuch_database_end_atomic (notmuch);
\r
132 diff --git a/test/atomicity b/test/atomicity
\r
133 index 817819a..f546c07 100755
\r
134 --- a/test/atomicity
\r
135 +++ b/test/atomicity
\r
136 @@ -96,7 +96,7 @@ for ((i = 0; i < $outcount; i++)); do
\r
140 -test_expect_equal_failure GDB "$(cat searchall)" "$(cat expectall)"
\r
141 +test_expect_equal GDB "$(cat searchall)" "$(cat expectall)"
\r
143 test_expect_success GDB "detected $outcount>10 abort points" "test $outcount -gt 10"
\r