Re: Performance regression in connectivity check during receive-pack (git 2.54)
From: Jeff King <hidden>
Date: 2026-07-23 10:46:26
On Wed, Jul 22, 2026 at 01:49:02PM +0200, Patrick Steinhardt wrote:
Seeing that this is about the `tmp_objdir` case: one of the things that Justin and I wanted to work on anyway is that we want to stop modifying the list of sources during transactions in the first place. It always felt kind of gross that we're modifying the sources when creating a transaction, as the only reason that we do this for is so that the writes actually go to the temporary object directory instead of to the primary object source. And that doesn't make a lot of sense to begin with. The alternative to this would be to instead have logic in functions like `odb_write()` that checks whether we have an active transaction or not. If so, the write would go into the transaction directly instead of going into the primary source, and consequently we wouldn't even have to modify the list of sources at all.
Yes, the swapping of the "regular" and "alternate" odbs for the
quarantine transaction is kind of hacky. But I don't think this is
something you can solve just via the odb API. The notion of which
sources to read/write from crosses process boundaries. In particular:
1. We write using a separate index-pack process. It has to be told to
write into the transaction area, not the regular odb.
2. After receiving objects, we _do_ read them in order to do quality
checks before admitting them to the repository. The connectivity
check discussed here is one example. That happens in a separate
rev-list process, though it in theory could be moved in-process.
But we also run user-specified hooks, which may run arbitrary Git
commands. Those hooks need to be given an environment where they
can transparently read from both the quarantine area and the
original odb.
So you'll have to communicate between processes both "write here, not
there" and "look at both here and there to read objects". And I suspect
the result is going to look a lot like the alternates juggling we are
doing today.
-Peff