user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Eric Wong <e@80x24.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	<meta@public-inbox.org>
Subject: Re: downloading t.mbox.gz messages are not sorted in expected order
Date: Mon, 15 Apr 2024 14:06:28 -0700	[thread overview]
Message-ID: <4fc973d3-cc30-4b5d-9f54-537d27be15c9@intel.com> (raw)
In-Reply-To: <20240413075816.M838152@dcvr>



On 4/13/2024 12:58 AM, Eric Wong wrote:
> Jacob Keller <jacob.e.keller@intel.com> wrote:
>>
>>
>> On 4/11/2024 3:42 PM, Konstantin Ryabitsev wrote:
>>> On Thu, Apr 11, 2024 at 03:32:43PM -0700, Jacob Keller wrote:
>>>> I sometimes download patch series off of public inbox hosted servers to
>>>> apply with git-am. Occasionally I have found that these do not apply
>>>> cleanly because the thread is not sorted in patch order.
>>>
>>> It's more than just the order -- if there are replies in the thread, the mbox
>>> file won't apply either.
>>>
>>
>> If the order was correct, it is usually easy enough to just "git am
>> --skip" the patches which have no content. However...
>>
>>> This is the reason why the b4 tool exists:
>>> https://b4.docs.kernel.org/
>>>
>>
>> This is extremely useful and I was unaware of its existence. Thanks!!
> 
> Good to know b4 works for you.
> 
> FWIW, t.mbox.gz uses NNTP article number ordering to ensure
> batched fetches work and duplicates can't get served.
> 
> IOW, it fetches a batch of 1000 header rows at a time from a
> single thread to avoid using too much memory for a single
> request.  The next batch (another 1K) only gets fetched once the
> current batch is done.  So it must order by article number to
> deal with that, especially since new messages may appear in the
> thread while the current batch is being streamed.
> 
> Identical Date: headers can appear multiple times in the same
> thread, so using a >= or > comparison for retrieval wouldn't
> work.
> 
> Of course, most threads are <1000 messages, so I did think
> about sorting by Date for small threads (as we do for the HTML
> output)...
> 
> However with the current t.mbox.gz code, we expect (and can
> handle) new messages appearing while a t.mbox.gz is being
> served.  So if a thread has 10 messages, the first batch fetch
> would only return those 10.  However, while a client is slowly
> downloading the first 10 messages, more messages show up.  The
> current retrieval scheme allows new messages in a thread to show
> up without needing another request.
> 
> AFAIK, it's actually easier and fewer SQL statements to do the
> current way.

And given that there are reasons to download a thread than just patches,
I think it makes sense. I can use b4 and get exactly what I want with
not much more or different effort on my part, and the public-inbox side
doesn't need to bloat to handle that, or make other cases fragile or slower.

Thanks,
Jake

      reply	other threads:[~2024-04-15 21:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11 22:32 downloading t.mbox.gz messages are not sorted in expected order Jacob Keller
2024-04-11 22:42 ` Konstantin Ryabitsev
2024-04-12 23:59   ` Jacob Keller
2024-04-13  7:58     ` Eric Wong
2024-04-15 21:06       ` Jacob Keller [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://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fc973d3-cc30-4b5d-9f54-537d27be15c9@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=e@80x24.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=meta@public-inbox.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://80x24.org/public-inbox.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).