Re: database error
[notmuch-archives.git] / a6 / 88f1e962d3d7e850564901aed8cff5a169a0e4
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 E0113429E2A\r
6         for <notmuch@notmuchmail.org>; Thu, 17 Feb 2011 23:59:34 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] 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 htri53iIIwwO for <notmuch@notmuchmail.org>;\r
16         Thu, 17 Feb 2011 23:59:34 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
18         [18.7.68.37])\r
19         by olra.theworths.org (Postfix) with ESMTP id 1AB66429E34\r
20         for <notmuch@notmuchmail.org>; Thu, 17 Feb 2011 23:59:26 -0800 (PST)\r
21 X-AuditID: 12074425-b7c98ae000000a04-36-4d5e26de92aa\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-8.mit.edu (Symantec Brightmail Gateway) with\r
24         SMTP id 23.D7.02564.ED62E5D4; Fri, 18 Feb 2011 02:59:26 -0500 (EST)\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 p1I7xPs7027138; \r
27         Fri, 18 Feb 2011 02:59:25 -0500\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 p1I7xOUe001537\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Fri, 18 Feb 2011 02:59:25 -0500 (EST)\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.72)\r
36         (envelope-from <amthrax@drake.mit.edu>)\r
37         id 1PqLFM-0008LE-MG; Fri, 18 Feb 2011 02:59:24 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 04/10] lib: Make _notmuch_message_sync capable of deleting a\r
41         message.\r
42 Date: Fri, 18 Feb 2011 02:58:54 -0500\r
43 Message-Id: <1298015940-31986-5-git-send-email-amdragon@mit.edu>\r
44 X-Mailer: git-send-email 1.7.2.3\r
45 In-Reply-To: <1298015940-31986-1-git-send-email-amdragon@mit.edu>\r
46 References: <1298015940-31986-1-git-send-email-amdragon@mit.edu>\r
47 X-Brightmail-Tracker: AAAAAA==\r
48 Cc: amdragon@mit.edu\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Fri, 18 Feb 2011 07:59:35 -0000\r
62 \r
63 ---\r
64  lib/message.cc |    7 ++++++-\r
65  1 files changed, 6 insertions(+), 1 deletions(-)\r
66 \r
67 diff --git a/lib/message.cc b/lib/message.cc\r
68 index 0590f76..06747fe 100644\r
69 --- a/lib/message.cc\r
70 +++ b/lib/message.cc\r
71 @@ -29,6 +29,7 @@ struct _notmuch_message {\r
72      notmuch_database_t *notmuch;\r
73      Xapian::docid doc_id;\r
74      int frozen;\r
75 +    notmuch_bool_t deleted;\r
76      char *message_id;\r
77      char *thread_id;\r
78      char *in_reply_to;\r
79 @@ -96,6 +97,7 @@ _notmuch_message_create_for_document (const void *talloc_owner,\r
80      message->doc_id = doc_id;\r
81  \r
82      message->frozen = 0;\r
83 +    message->deleted = FALSE;\r
84      message->flags = 0;\r
85  \r
86      /* Each of these will be lazily created as needed. */\r
87 @@ -765,7 +767,10 @@ _notmuch_message_sync (notmuch_message_t *message)\r
88         return;\r
89  \r
90      db = static_cast <Xapian::WritableDatabase *> (message->notmuch->xapian_db);\r
91 -    db->replace_document (message->doc_id, message->doc);\r
92 +    if (message->deleted)\r
93 +       db->delete_document (message->doc_id);\r
94 +    else\r
95 +       db->replace_document (message->doc_id, message->doc);\r
96  }\r
97  \r
98  /* Ensure that 'message' is not holding any file object open. Future\r
99 -- \r
100 1.7.2.3\r
101 \r