[PATCH 8/8] cli: optionally restore message properties from dump file
[notmuch-archives.git] / a5 / c2815329b480916727a304a3af1824095b3705
1 Return-Path: <eg@gaute.vetsj.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 olra.theworths.org (Postfix) with ESMTP id AB025431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 11 Aug 2014 05:18:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 74MwyFmpTj8R for <notmuch@notmuchmail.org>;\r
16         Mon, 11 Aug 2014 05:17:58 -0700 (PDT)\r
17 Received: from mail-qg0-f48.google.com (mail-qg0-f48.google.com\r
18         [209.85.192.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 120CA431FAE\r
21         for <notmuch@notmuchmail.org>; Mon, 11 Aug 2014 05:17:58 -0700 (PDT)\r
22 Received: by mail-qg0-f48.google.com with SMTP id i50so8336100qgf.35\r
23         for <notmuch@notmuchmail.org>; Mon, 11 Aug 2014 05:17:56 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:mime-version:date:message-id:subject:from:to\r
27         :content-type;\r
28         bh=zNSOgcDHBtBfm3lylf7EplrsfpI2eV7SX6iIlF1Edyw=;\r
29         b=iJGTIxnT6TTZvB4t035d2YqzXuipL/xpGjKKS2j5qkRRLr8y3VtD1mKdlR4Fnh808x\r
30         +zO4X0DZVdJDxt/yc/rg++Dv3YsNeGjhswW0u1FB7LkZJ5g1UfLw39955YNysjhCDu9J\r
31         dys2bONIS/02aJKdO75wX3W8dnq/cQ7BjhB6FbVff5OCGS02+3M7uKfv14UwxyXr1XCu\r
32         4FZelACrz+r65HIDNPHD4XroZX3lqnK3IW2/Wvjd3iIIarv7B0XKd0PvAlWCmwRwqXEq\r
33         nafGEiN2rLvxKRCxzYzigNTL8eY8Ss3+3Pot4iaj0JyamjNBKr1TRfGW8+KV/gpXE+IV\r
34         Ugdg==\r
35 X-Gm-Message-State:\r
36  ALoCoQnNRkazZ2Ia8zvIDNVivGrJr7+FDOg+ha5SzL2v7T8U88SuHDsLk1uxoWIiWinreLZosh9V\r
37 MIME-Version: 1.0\r
38 X-Received: by 10.224.137.65 with SMTP id v1mr62602608qat.53.1407759475308;\r
39         Mon, 11 Aug 2014 05:17:55 -0700 (PDT)\r
40 Received: by 10.140.86.148 with HTTP; Mon, 11 Aug 2014 05:17:54 -0700 (PDT)\r
41 Date: Mon, 11 Aug 2014 14:17:54 +0200\r
42 Message-ID:\r
43  <CABKe4MvEdcsq8BZ-vq6R0Vnw87zEgBvqW_2F-Wysf5GNchqweg@mail.gmail.com>\r
44 Subject: DatabaseModifiedErrors causing troubles\r
45 From: Gaute Hope <eg@gaute.vetsj.com>\r
46 To: notmuch <notmuch@notmuchmail.org>\r
47 Content-Type: multipart/mixed; boundary=001a11c2cc3074c37c0500598b50\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Mon, 11 Aug 2014 12:18:08 -0000\r
61 \r
62 --001a11c2cc3074c37c0500598b50\r
63 Content-Type: text/plain; charset=UTF-8\r
64 \r
65 Hi,\r
66 \r
67 I've been working on an application that keeps a read-only handle on\r
68 the notmuch database open for a long time. In some cases when a new\r
69 message is added along with some renames of other messages using\r
70 'notmuch new' while the application is running I get an Xapian\r
71 exception: DatabaseModifiedError:\r
72 \r
73   A Xapian exception occurred performing query: The revision being\r
74 read has been discarded - you\r
75   should call Xapian::Database::reopen() and retry the operation.\r
76 \r
77 Which seems to be printed from: notmuch_query_search_threads ->\r
78 notmuch_query_search_messages:294.\r
79 \r
80 I have not been able to make a smaller test case at the moment (this\r
81 happens with offlineimap updating an maildir and notmuch new run\r
82 afterwards + some tagging).\r
83 \r
84 I can work around this by checking for a NULL pointer returned from\r
85 notmuch_query_search_threads () and re-open the database\r
86 (notmuch_database_close () -> notmuch_database_open ()). But I have no\r
87 way of knowing programatically if this really is the error that has\r
88 happened. There should be some way of propagating the error\r
89 information or (even better for my case; for notmuch to reopen the\r
90 database), one option is the Gmime way of passing an pointer to an\r
91 error structure that is filled up by the notmuch interface function.\r
92 \r
93 I made some attempts at exposing the ::reopen() function as suggested\r
94 by Xapian (http://xapian.org/docs/apidoc/html/classXapian_1_1Database.html#af140b1f8d948d13cf7be4a11a7c699a4),\r
95 but I end up with other errors afterwards. Possibly from leftover\r
96 structures created with the original database handle:\r
97 \r
98 after notmuch_database_reopen (see attached patch for your reference):\r
99   A Xapian exception occurred when reading header: Expected block\r
100 24615 to be level 1, not 0\r
101   A Xapian exception occurred when reading header: Error reading block\r
102 419480589: got end of file\r
103   A Xapian exception occurred when reading date: Error reading block\r
104 419480589: got end of file\r
105   A Xapian exception occurred when reading header: Error reading block\r
106 419480589: got end of file\r
107 \r
108 \r
109 as mentioned, doing a manual _close and _open works. Again, the best\r
110 would be a consistent way to really know that this (or something else)\r
111 is the error that really happened.\r
112 \r
113 Cheers, Gaute\r
114 \r
115 --001a11c2cc3074c37c0500598b50\r
116 Content-Type: text/x-patch; charset=US-ASCII; \r
117         name="0001-lib-expose-XapianDatabae-reopen-through-notmuch_data.patch"\r
118 Content-Disposition: attachment; \r
119         filename="0001-lib-expose-XapianDatabae-reopen-through-notmuch_data.patch"\r
120 Content-Transfer-Encoding: base64\r
121 X-Attachment-Id: f_hyprlohc0\r
122 \r
123 RnJvbSA5MDM0MGZlNTlkNjc3Yzk4OTM1MmYwOGU4MmY5MDgwMTZjMjVmYWZhIE1vbiBTZXAgMTcg\r
124 MDA6MDA6MDAgMjAwMQpGcm9tOiBHYXV0ZSBIb3BlIDxlZ0BnYXV0ZS52ZXRzai5jb20+CkRhdGU6\r
125 IE1vbiwgMTEgQXVnIDIwMTQgMTQ6MTY6MTIgKzAyMDAKU3ViamVjdDogW1BBVENIXSBsaWI6IGV4\r
126 cG9zZSBYYXBpYW5EYXRhYmFlOjpyZW9wZW4oKSB0aHJvdWdoCiBub3RtdWNoX2RhdGFiYXNlX3Jl\r
127 b3BlbigpCgotLS0KIGxpYi9kYXRhYmFzZS5jYyB8IDE4ICsrKysrKysrKysrKysrKysrKwogbGli\r
128 L25vdG11Y2guaCAgIHwgMjIgKysrKysrKysrKysrKysrKysrKysrKwogMiBmaWxlcyBjaGFuZ2Vk\r
129 LCA0MCBpbnNlcnRpb25zKCspCgpkaWZmIC0tZ2l0IGEvbGliL2RhdGFiYXNlLmNjIGIvbGliL2Rh\r
130 dGFiYXNlLmNjCmluZGV4IGM3NjAyOTAuLjgwYWY0MTAgMTAwNjQ0Ci0tLSBhL2xpYi9kYXRhYmFz\r
131 ZS5jYworKysgYi9saWIvZGF0YWJhc2UuY2MKQEAgLTc3OCw2ICs3NzgsMjQgQEAgbm90bXVjaF9k\r
132 YXRhYmFzZV9vcG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