Re: Reimagining notmuch-git/nmbug

Subject: Re: Reimagining notmuch-git/nmbug

Date: Mon, 3 Apr 2023 15:23:36 -0500

To: David Bremner

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Mon, Apr 3, 2023 at 2:40 PM David Bremner <david@tethera.net> wrote:
>
> David Bremner <david@tethera.net> writes:
>
> > Indeed that speeds up the initial clone on this machine from 39 minutes
> > (I switched machines) to 30s. I will play with it a bit more, and report
> > back.
>
> It's not a showstopper, but "git pull" takes about 1/2 the wall time
> (about 2/3 of the CPU time) of the original clone, even if there is only
> one tag changed.

Yes, every fetch should take as much time as the original clone.

> Two potential improvements I can think of.
>
> - notmuch-dump.c calls notmuch_query_set_sort (query,
>   NOTMUCH_SORT_UNSORTED). I think I managed to do this (diff below),
>   but performance gain was negligible.

OK.

> - Since you cache the lastmod value, you should be able to use it in a
>   query. This does make a big difference in my experiments. I had to
>   remove the 'deleteall' (otherwise only the changed messages are left
>   in the git repo). I'm not 100% this is correct, hopefully you see
>   quicker than I. In any case the lastmod query is what notmuch-git
>   uses.

That should work to update existing tags, but how are we going to
detect if a message has disappeared? Or is that not a thing?

> diff --git a/git-remote-nm b/git-remote-nm
> index c668b38..cabea26 100755
> --- a/git-remote-nm
> +++ b/git-remote-nm
> @@ -148,9 +148,11 @@ def wr_import(ref)
>    wr_data("lastmod: %d\n" % ($lastmod || 0))
>    wr_l 'from refs/notmuch/master^0' if $lastmod
>
> -  wr_l 'deleteall'
> +#  wr_l 'deleteall'
>
> -  $db.query('').search_messages.each do |msg|
> +  $query=$db.query("lastmod:%d.." % ($lastmod || 0) )

Does "lastmod:0.." get all the revisions? If so, it might make sense
to set $lastmod to 0 initially.

Then we could unconditionally do:

    $db.query('lastmod:%d..' % $lastmod, sort: Notmuch::SORT_UNSORTED)

-- 
Felipe Contreras
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: