From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 37D036DE1F5A for ; Sat, 25 Feb 2017 10:44:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.184 X-Spam-Level: X-Spam-Status: No, score=-0.184 tagged_above=-999 required=5 tests=[AWL=-0.164, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LveP45I01obW for ; Sat, 25 Feb 2017 10:44:34 -0800 (PST) Received: from mail-lf0-f65.google.com (mail-lf0-f65.google.com [209.85.215.65]) by arlo.cworth.org (Postfix) with ESMTPS id 336676DE1F57 for ; Sat, 25 Feb 2017 10:44:34 -0800 (PST) Received: by mail-lf0-f65.google.com with SMTP id p197so3515911lfp.3 for ; Sat, 25 Feb 2017 10:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=N/aneVqETzUt389U/zLGXec6elgmDQxt204pBcZQDGk=; b=aGEtozLXXayIX9UGFR4dj3VZUZ8JRExEhG/3IB2WrrGtE6rPjBxdvC4TNEMDaKpJaj pVmsPopfYkjyZ773dGBrY9gOcOAoCQkZX4ZQstrTVxURcqwd5mmOsp6Vqp62cunFA2he 7pYib1mghGiUMUNEH/W88eVyhMiEH/2B04Q9D+N7rk0CIjntnZfQ4Wprenyk8uaB91BZ cB6aP83Ws7+A7HJQ6swOsUFIYYFWQ1iQfS7ZEpE18xgAa+4NWEHVdf0azYnR3wmfYHVU QfxUiIylBh4p2NeUsadXxqx1fXknbUkR9ye0Ib6wXlH7ggqKrpe+7gL6SoAW/gPXwkbb lUow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=N/aneVqETzUt389U/zLGXec6elgmDQxt204pBcZQDGk=; b=WFv9GF+b4eMyBAmYHoRVn+Km/FFeZT0xF45rB+AvH5ZRZVVeFTzAu0m5dJCQ5KWMCh EW4GdkEJ2BT1+aw/xinb3v1mg6nb4VKiBnT4zF3qPPKSre39pOMp8Stfnnf+rzFe9aqi LiKEqfl+5dVji1fQp+lpOgBY0ZbZPa/nbt04spgCqiZmsNhbBxEW0uvEWpitGVDtycWh ea8tVQzFjA6y8JApvDSwmCppM8pRpObAC0nlFr7kJhKgnRjlcVoYD8oWhOfGNGzSgzKZ h/U10KWqy4aR6phXlOjtOHpbPUEUyRSTds8fjQyBT4T/wk1xBy5q0Q3QIS3xnADpKFNR 95nQ== X-Gm-Message-State: AMke39kXM0UES3E5wuv1jFosk2PPI0s9noY+HsD9Aq3ZhVqNMCeaToYW9QVGsmk+ZuFkyQ== X-Received: by 10.25.159.16 with SMTP id i16mr2506613lfe.54.1488048272605; Sat, 25 Feb 2017 10:44:32 -0800 (PST) Received: from localhost (mobile-access-bcee80-14.dhcp.inet.fi. [188.238.128.14]) by smtp.gmail.com with ESMTPSA id t15sm2781058lfi.56.2017.02.25.10.44.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Feb 2017 10:44:31 -0800 (PST) From: Jani Nikula To: David Bremner , notmuch@notmuchmail.org, eg@gaute.vetsj.com Subject: Re: [PATCH 4/4] lib/message.cc: use view number to invalidate cached metadata In-Reply-To: <20170225034513.19427-5-david@tethera.net> References: <20170225034513.19427-1-david@tethera.net> <20170225034513.19427-5-david@tethera.net> Date: Sat, 25 Feb 2017 20:44:31 +0200 Message-ID: <87mvda6rg0.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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, 25 Feb 2017 18:44:35 -0000 On Fri, 24 Feb 2017, David Bremner wrote: > Currently the view number is incremented by notmuch_database_reopen > --- > lib/message.cc | 25 +++++++++++-------------- > 1 file changed, 11 insertions(+), 14 deletions(-) > > diff --git a/lib/message.cc b/lib/message.cc > index 15e2f528..bfb95917 100644 > --- a/lib/message.cc > +++ b/lib/message.cc > @@ -317,11 +317,14 @@ _notmuch_message_get_term (notmuch_message_t *message, > } > > static void > -_notmuch_message_ensure_metadata (notmuch_message_t *message) > +_notmuch_message_ensure_metadata (notmuch_message_t *message, void *field) > { > Xapian::TermIterator i, end; > notmuch_bool_t success = FALSE; > > + if ((field != NULL) && (message->last_view >= message->notmuch->view)) Nitpick, excessive braces for my taste! > + return; > + > const char *thread_prefix = _find_prefix ("thread"), > *tag_prefix = _find_prefix ("tag"), > *id_prefix = _find_prefix ("id"), > @@ -472,8 +475,7 @@ _notmuch_message_get_doc_id (notmuch_message_t *message) > const char * > notmuch_message_get_message_id (notmuch_message_t *message) > { > - if (!message->message_id) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, message->message_id); > if (!message->message_id) Side note, looks like we don't consistently check the metadata we want is really available. All in all, LGTM. > INTERNAL_ERROR ("Message with document ID of %u has no message ID.\n", > message->doc_id); > @@ -548,16 +550,14 @@ notmuch_message_get_header (notmuch_message_t *message, const char *header) > const char * > _notmuch_message_get_in_reply_to (notmuch_message_t *message) > { > - if (!message->in_reply_to) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, message->in_reply_to); > return message->in_reply_to; > } > > const char * > notmuch_message_get_thread_id (notmuch_message_t *message) > { > - if (!message->thread_id) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, message->thread_id); > if (!message->thread_id) > INTERNAL_ERROR ("Message with document ID of %u has no thread ID.\n", > message->doc_id); > @@ -860,8 +860,7 @@ _notmuch_message_ensure_filename_list (notmuch_message_t *message) > if (message->filename_list) > return; > > - if (!message->filename_term_list) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, message->filename_term_list); > > message->filename_list = _notmuch_string_list_create (message); > node = message->filename_term_list->head; > @@ -955,7 +954,7 @@ notmuch_message_get_flag (notmuch_message_t *message, > { > if (flag == NOTMUCH_MESSAGE_FLAG_GHOST && > ! NOTMUCH_TEST_BIT (message->lazy_flags, flag)) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, NULL); > > return NOTMUCH_TEST_BIT (message->flags, flag); > } > @@ -996,8 +995,7 @@ notmuch_message_get_tags (notmuch_message_t *message) > { > notmuch_tags_t *tags; > > - if (!message->tag_list) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, message->tag_list); > > tags = _notmuch_tags_create (message, message->tag_list); > /* _notmuch_tags_create steals the reference to the tag_list, but > @@ -1833,8 +1831,7 @@ _notmuch_message_ensure_property_map (notmuch_message_t *message) > if (message->property_map) > return; > > - if (!message->property_term_list) > - _notmuch_message_ensure_metadata (message); > + _notmuch_message_ensure_metadata (message, message->property_term_list); > > message->property_map = _notmuch_string_map_create (message); > > -- > 2.11.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch