From: Mark Walters Date: Thu, 12 Jun 2014 23:21:52 +0000 (+0100) Subject: Re: notmuch dump: taking write-lock to protect from concurrent (cronned) notmuch... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=042137df634773cc3df4f75b3cdf6edb832d3e39;p=notmuch-archives.git Re: notmuch dump: taking write-lock to protect from concurrent (cronned) notmuch new? --- diff --git a/cf/acf5003ceeafc03b095875b51c5d33742567f1 b/cf/acf5003ceeafc03b095875b51c5d33742567f1 new file mode 100644 index 000000000..8f5d13e15 --- /dev/null +++ b/cf/acf5003ceeafc03b095875b51c5d33742567f1 @@ -0,0 +1,122 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 20D34431FBC + for ; Thu, 12 Jun 2014 16:22:09 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.502 +X-Spam-Level: +X-Spam-Status: No, score=0.502 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 6ljCUhlWOIqo for ; + Thu, 12 Jun 2014 16:22:05 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DA6A7431FAF + for ; Thu, 12 Jun 2014 16:22:04 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1WvEJe-0005o6-EA; Fri, 13 Jun 2014 00:21:56 +0100 +Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1WvEJe-0003xt-0m; Fri, 13 Jun 2014 00:21:54 +0100 +From: Mark Walters +To: David Bremner , Maarten Aertsen , + notmuch@notmuchmail.org +Subject: Re: notmuch dump: taking write-lock to protect from concurrent + (cronned) notmuch new? +In-Reply-To: <87mwdhg2jh.fsf@zancas.localnet> +References: <20140606080354.28047.77393@kardo.rtsn.nl> + <878upafegc.fsf@qmul.ac.uk> <87mwdhg2jh.fsf@zancas.localnet> +User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Fri, 13 Jun 2014 00:21:52 +0100 +Message-ID: <87zjhh67e7.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 87.81.223.162 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: af87aa6497d32c89c7c7980043b12eff (of first 20000 bytes) +X-SpamAssassin-Score: -0.1 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -0.1 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.1 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 12 Jun 2014 23:22:09 -0000 + + +Hi + +On Thu, 12 Jun 2014, David Bremner wrote: +> Mark Walters writes: +> +> +>>> mjw1009 suggested to change NOTMUCH_DATABASE_MODE_READ_ONLY on line +>>> 215 of notmuch-dump.c to NOTMUCH_DATABASE_MODE_READ_WRITE +>>> +>>> I'm wondering if this hits enough people to motivate the addition of a +>>> command line switch (or perhaps even a change in default behaviour?) +>> +>> I think this is a clear bug but the fix is a little unclear. The above +>> fix works but it breaks one of the tests: "unicode message-ids" in +>> T150-tagging.sh. +>> +>> I think the problem is that it does +>> notmuch dump | sed... | notmuch restore +>> +> +> My first reaction was "argh, we should be locking things less, not +> more". But then I read +> +> http://getting-started-with-xapian.readthedocs.org/en/latest/xapian-core-rst/admin_notes.html?highlight=backup#id10 +> +> and now I'm not so sure, maybe write lock for dump is the right answer. + +On irc Olly said + +"I'd suggest locking the db by opening it R/W for the dump at least +until you can use reader locking to keep the read revision valid, but +it'll be a while before that's in a stable release" + +and he also said that pipes of the form notmuch dump | ... notmuch +restore will probably fail if they change many tags. + +So it is probably the way to go. But it does run the risk of breaking +some peoples (already fragile) scripts. + +> It seems hard to do anything sensible with "Database.reopen" in the +> context of a backup. + +Yes I agree. + +Best wishes + +Mark