From: David Bremner <david@tethera.net>
To: Jani Nikula <jani@nikula.org>,
notmuch@notmuchmail.org, eg@gaute.vetsj.com
Subject: Re: [PATCH 3/4] lib: handle DatabaseModifiedError in _n_message_ensure_metadata
Date: Sat, 25 Feb 2017 16:21:09 -0400 [thread overview]
Message-ID: <8737f210p6.fsf@tethera.net> (raw)
In-Reply-To: <87poi66rjj.fsf@nikula.org>
Jani Nikula <jani@nikula.org> writes:
> On Fri, 24 Feb 2017, David Bremner <david@tethera.net> wrote:
>> The retries are hardcoded to a small number, and error handling aborts
>> than propagating errors from notmuch_database_reopen. These are both
>> somewhat justified by the assumption that most things that can go
>> wrong in Xapian::Database::reopen are rare and fatal (like running out
>> of memory or disk corruption).
>
> I think the sanity of the implementation hinges on that assumption. It
> makes sense if you're right, but I really have no idea either way...
That was my conclusion from talking to Olly (xapian upstream).
24-02-2017 08:12:57 < bremner> any intuition about how likely
Xapian::Database::reopen is to fail? I'm catching a
DatabaseModifiedError somewhere where handling any further errors is
tricky, and wondering about treating a failed reopen as as "the
impossible happened, stopping"
24-02-2017 16:22:34 < olly> bremner: there should not be much scope for
failure - stuff like out of memory or disk errors, which are probably a
good enough excuse to stop
I could add that to the commit message?
>> +
>> + /* all the way without an exception */
>> + success = TRUE;
>
> Nitpick, if you don't intend to use that variable to return status from
> the function, you can just break here, and get rid of the variable. But
> no big deal.
>
I think I have some kind of mental block about break and continue. But
it could even be a goto, those I understand ;).
>
>> + } catch (const Xapian::DatabaseModifiedError &error) {
>> + notmuch_status_t status = notmuch_database_reopen (message->notmuch);
>> + if (status != NOTMUCH_STATUS_SUCCESS)
>> + INTERNAL_ERROR ("unhandled error from notmuch_database_reopen: %s\n",
>> + notmuch_status_to_string (status));
>> + success = FALSE;
>> + } catch (const Xapian::Error &error) {
>> + INTERNAL_ERROR ("A Xapian exception occurred fetching message metadata: %s\n",
>> + error.get_msg().c_str());
>> + }
>
> If the assumption is that these really are rare cases (read: shouldn't
> happen), INTERNAL_ERROR is an improvement over leaking the
> exception. Otherwise, I think we'd need to propagate the status all the
> way to the API, which would really be annoying.
>
> I guess I think this is a worthwhile improvement no matter what.
Yeah, I had a go at that in the previous longer series, but I was not
very happy with the (incomplete) results
next prev parent reply other threads:[~2017-02-25 20:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-25 3:45 v1 _notmuch_message_ensure_metadata exception handling David Bremner
2017-02-25 3:45 ` [PATCH 1/4] test: add known broken test for uncaught DatabaseModifiedError David Bremner
2017-02-25 18:49 ` Jani Nikula
2017-02-25 20:08 ` David Bremner
2017-02-25 3:45 ` [PATCH 2/4] lib: add notmuch_database_reopen David Bremner
2017-02-25 18:33 ` Jani Nikula
2017-02-25 20:11 ` David Bremner
2017-02-25 3:45 ` [PATCH 3/4] lib: handle DatabaseModifiedError in _n_message_ensure_metadata David Bremner
2017-02-25 18:42 ` Jani Nikula
2017-02-25 20:21 ` David Bremner [this message]
2017-02-25 20:39 ` Jani Nikula
2017-02-25 3:45 ` [PATCH 4/4] lib/message.cc: use view number to invalidate cached metadata David Bremner
2017-02-25 18:44 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8737f210p6.fsf@tethera.net \
--to=david@tethera.net \
--cc=eg@gaute.vetsj.com \
--cc=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).