unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: Mark Walters <markwalters1009@gmail.com>
Cc: notmuch@notmuchmail.org
Subject: Re: [PATCH 0/3] Outline fix for emacs tagging race
Date: Sat, 10 Nov 2012 00:29:47 -0500	[thread overview]
Message-ID: <20121110052947.GK22284@mit.edu> (raw)
In-Reply-To: <1352487491-31512-1-git-send-email-markwalters1009@gmail.com>

Quoth Mark Walters on Nov 09 at  6:58 pm:
> For a long time [1] there have been two related races in tagging from
> the search buffer.
> 
> The first is that when tagging (including archiving) a thread message
> which arrived after the buffer was created may also be tagged. This is
> because the tagging is done based on the thread-id not on the
> individual messages.
> 
> The second is when using the '*' command to tag all messages. This is
> not quite the same as this command only tags messages matching the
> query not all messages in all threads that contain a message matching
> the query. Thus if more messages now match than when the buffer was
> created (eg some external tagging script has run) then this command
> can unexpectedly tag these messages too.
> 
> One solution that was discussed in [2] was for the search output of
> notmuch to include the message-ids of both matching and non-matching
> messages. At that time that was difficult to implement as it was
> unclear how to escape the message ids when using the text
> format. Since emacs now uses JSON for search mode this problem is
> solved.
> 
> This patch series implements the above mentioned solution and seems to
> work except for one problem.
> 
> Since emacs now tags each message in a thread in the search buffer it
> is easy to ask it to tag a lot of messages. This could be done
> individually which would be ridiculously slow so instead they are all
> done in one batch. But now it is relatively easy to take notmuch over
> the threshold for ARG_MAX.
> 
> In [3] Tomi did some experiments and found on a standard Debian system
> with getconf ARG_MAX =131072 that command lines with 10000 200 byte
> arguments worked. I am a little puzzled by that as I get the same
> results and I getconf ARG_MAX gives 2097152 for me.
> 
> More importantly though, when trying to execute a command from emacs I
> am finding that 131072 is the limit on the command length in bytes and
> we can hit this with something around 1500 messages (see end for a
> very hacky emacs test script). This is probably more than we can
> expect in a single thread so tagging from show is probably safe but it
> does cause a problem when tagging from search.
> 
> I can think of several possible solutions (e.g., batch it in my new
> stuff, put some batching in notmuch-tag, all notmuch tag to read a
> query from stdin). But before any larger more intrusive change do
> people like the general approach? Does anyone have a good way to get
> round the command line size problem?
> 
> Best wishes 
> 
> Mark
> 
> 
> [1] id:87ocmtg9ni.fsf@yoom.home.cworth.org
> [2] id:CAH-f9WticM4EN8F1_ik_-mcBcBtrXwSpO+Drbtp7=UN7McECrg@mail.gmail.com
> [3] id:m2liody7av.fsf@guru.guru-group.fi

I'm glad to see someone picking up this bug.  Besides somehow dealing
with long command-lines, when we were last exploring this race, I had
found that it was 3-4x more efficient to use Xapian document IDs
directly rather than message IDs [1].  It's probably best *not* to do
this initially for the sake of simplicity, but I think a simple tweak
to your approach would let us seamlessly transition to this in the
future.  Rather than extending the JSON output with what are
explicitly message IDs, instead extend the output with opaque queries
that are guaranteed to match the matching/non-matching messages in the
thread and are guaranteed to be combinable, but aren't guaranteed to
be of any particular form.  For now, the CLI can simply output id:
queries for these, but in the future we could easily add a special
query syntax for docid queries or, if we ever move to a custom query
parser, support docids in any query.

For the long command line problem, one easy solution is to support,
say, '-' as a query syntax that means "read the query from stdin."
This would be a simple addition to query_string_from_args and would
work across the CLI.

[1] id:CAH-f9WsPj=1Eu=g3sOePJgCTBFs6HrLdLq18xMEnJ8aZ00yCEg@mail.gmail.com

      parent reply	other threads:[~2012-11-10  5:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 18:58 [PATCH 0/3] Outline fix for emacs tagging race Mark Walters
2012-11-09 18:58 ` [PATCH 1/3] test: test for race when tagging from emacs search Mark Walters
2012-11-09 18:58 ` [PATCH 2/3] cli: all search mode to include msg-ids with JSON output Mark Walters
2012-11-22 16:15   ` Jameson Graef Rollins
2012-11-22 18:05     ` Michal Nazarewicz
2012-11-22 19:35     ` Mark Walters
2012-11-23  7:23       ` Jameson Graef Rollins
2012-11-23  9:01         ` Tomi Ollila
2012-11-23 20:39     ` Austin Clements
2012-11-09 18:58 ` [PATCH 3/3] emacs: make emacs use message-ids for tagging Mark Walters
2012-11-09 21:25 ` [PATCH 0/3] Outline fix for emacs tagging race Tomi Ollila
2012-11-09 23:27 ` David Bremner
2012-11-10  5:29 ` Austin Clements [this message]

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=20121110052947.GK22284@mit.edu \
    --to=amdragon@mit.edu \
    --cc=markwalters1009@gmail.com \
    --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).