From 84d1e35467dd4635bd55dd97ff23341d8811ae4a Mon Sep 17 00:00:00 2001 From: Gaute Hope Date: Sat, 17 Jan 2015 11:18:43 +0000 Subject: [PATCH] Re: DatabaseModifiedErrors causing troubles --- f5/c026175fa678c3984c8a67028653974d34015e | 126 ++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 f5/c026175fa678c3984c8a67028653974d34015e diff --git a/f5/c026175fa678c3984c8a67028653974d34015e b/f5/c026175fa678c3984c8a67028653974d34015e new file mode 100644 index 000000000..21288bf70 --- /dev/null +++ b/f5/c026175fa678c3984c8a67028653974d34015e @@ -0,0 +1,126 @@ +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 353BF431FD9 + for ; Sat, 17 Jan 2015 03:17:50 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.738 +X-Spam-Level: * +X-Spam-Status: No, score=1.738 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, 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 0BvgIaEH7DcM for ; + Sat, 17 Jan 2015 03:17:46 -0800 (PST) +Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com + [209.85.217.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 84344431FAF + for ; Sat, 17 Jan 2015 03:17:46 -0800 (PST) +Received: by mail-lb0-f170.google.com with SMTP id 10so22084944lbg.1 + for ; Sat, 17 Jan 2015 03:17:45 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:date:from:subject:to:references:in-reply-to + :user-agent:message-id:mime-version:content-type + :content-transfer-encoding; + bh=/cpM2H3vRNph4jheM83SzNpW9w/f6olBC86vtSM5IBU=; + b=KaGsKHon/rBj0zS1OxUAwuzuLz01Q5bCvErFKfu0EiW6qK59NGa1frlBN/P6cQQI9w + W0ws0zH9AtA6gQRNuQxz4loTAm2mxx7MiqNiUYKL4LwSXEUVSSLph/QrNa1q5YVfaPaE + naGRywQhwuKoknDD6mb2AZLpANO+tmD7eqF31tiH72747QYCo7nKR+bibt0wWG4CX/VC + /BSeA1cabkVt5Vk7s+F2wW8fVqlnUGwijMdJmjIINeP8F4qIfU/xTaqOHenErA1+zo9f + nZTilvfp7CbN31rFRYGrsPa5xoUrQ1ESSYs59TTWRMWnmyx5vJupG688NEtH0caijdu8 + zkcw== +X-Gm-Message-State: + ALoCoQnWdwmY5iVUz0sQAWF7n96OsaoK86VQMrpXsSreuJaMROQZu+oVahEZLFR5DVq3euugJkYP +X-Received: by 10.112.172.194 with SMTP id be2mr20531561lbc.53.1421493465077; + Sat, 17 Jan 2015 03:17:45 -0800 (PST) +Received: from localhost (c2774BF51.dhcp.as2116.net. [81.191.116.39]) + by mx.google.com with ESMTPSA id p10sm2065524lap.10.2015.01.17.03.17.43 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 17 Jan 2015 03:17:44 -0800 (PST) +Date: Sat, 17 Jan 2015 11:18:43 +0000 +From: Gaute Hope +Subject: Re: DatabaseModifiedErrors causing troubles +To: David Bremner , notmuch +References: + + <87bnmkgr57.fsf@maritornes.cs.unb.ca> +In-Reply-To: <87bnmkgr57.fsf@maritornes.cs.unb.ca> +User-Agent: astroid/vv0.1-42-ge9d4344b (https://github.com/gauteh/astroid) +Message-Id: <1421493070-astroid-1-4x8pflg7mc-1327@strange> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8; format=flowed +Content-Transfer-Encoding: quoted-printable +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: Sat, 17 Jan 2015 11:17:50 -0000 + +Excerpts from David Bremner's message of December 31, 2014 9:28: +> Gaute Hope writes: +>=20 +>> I can work around this by checking for a NULL pointer returned from +>> notmuch_query_search_threads () and re-open the database +>> (notmuch_database_close () -> notmuch_database_open ()). But I have no +>> way of knowing programatically if this really is the error that has +>> happened. There should be some way of propagating the error +>> information or (even better for my case; for notmuch to reopen the +>> database), one option is the Gmime way of passing an pointer to an +>> error structure that is filled up by the notmuch interface function. +>=20 +> Hi Gaute; +>=20 +> Sorry this sequence of postings of yours kindof fell down a well. In +> general there seems to be not very much enthusiasm for the GError +> solution. We can do something less fancy with the series at +>=20 +> id:1419788030-10567-2-git-send-email-david@tethera.net +>=20 +> In particular id:1419788030-10567-6-git-send-email-david@tethera.net +> replaces the printfs with saving to a status string accessible from +> notmuch_database_t. + +Hi David, + +Would it be possible with an error code that I could compare against in +stead? It would then work a bit like a global instance of the gmime +error. It could even be a preparation step against a gmime-error-style +solution in the far future. + +I am sure you know all the bad reasons for using a strcmp with strings +such as small (subtle) changes making them useless or future +localization of notmuch. This solution is in my opinion worse than the +current situation, it will lock things in and create problems for future +API compatability and application maintainers. I would rather wait for +or spend some time on a more general solution. + +Best regards, Gaute + +> I _think_ this could solve your problem, although doing strcmp on error +> message might not be ideal. Overall this is much less api breakage +> (only open and create need to be wrapped). +>=20 +> We could also consider really updating the api for those NULL returning +> functions, but it seems less bad to me than the count functions updated +> in this series +>=20 +> id:1419971380-10307-2-git-send-email-david@tethera.net +>=20 +> Let me know what you think, +>=20 +> David +>=20 += -- 2.26.2