git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Justin Tobler <jltobler@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/6] builtin/update-index: end ODB transaction when --verbose is specified
Date: Mon, 15 Sep 2025 08:08:41 +0200	[thread overview]
Message-ID: <aMetaZxCN8CDsr6g@pks.im> (raw)
In-Reply-To: <3cmqsfz5j2h36mw7yzwbrgfgchaettcnidvkiboqqktkm3dd5k@h6rmgjnqdmq2>

On Thu, Sep 11, 2025 at 10:34:42AM -0500, Justin Tobler wrote:
> On 25/09/11 08:40AM, Patrick Steinhardt wrote:
> > On Tue, Sep 09, 2025 at 02:11:30PM -0500, Justin Tobler wrote:
> > > With 23a3a303 (update-index: use the bulk-checkin infrastructure,
> > > 2022-04-04), object database transactions were added to
> > > git-update-index(1) to facilitate writing objects in bulk. With
> > > transactions, newly added objects are instead written to a temporary
> > > object directory and migrated to the primary object database upon
> > > transaction commit.
> > > 
> > > When the --verbose option is specified, each individual object is
> > > explicitly flushed via flush_odb_transaction() prior to reporting the
> > > update. Flushing the object database transaction migrates pending
> > > objects to the primary object database without marking the transaction
> > > as complete. This is done so objects are immediately visible to
> > > git-update-index(1) callers using the --verbose option and that rely on
> > > parsing verbose output to know when objects are written.
> > > 
> > > As soon as verbose output is requested in git-update-index(1), all
> > > subsequent object writes are flushed prior to being reported and thus no
> > > longer benefit from being transactional. Furthermore, the mechanism to
> > > flush a transaction without committing is rather awkward. Drop the call
> > > to flush_odb_transaction() in favor of ending the transaction early when
> > > the --verbose flag is encountered.
> > 
> > Okay, this interface feels somewhat weird indeed. If we now end the
> > transaction early, does the transaction still serve any purpose at all?
> > Like, do we use it to batch steps _before_ we start reporting stuff?
> 
> We only start reporting updates when the --verbose option is first
> encountered. Options are not all processed upfront. This means in the
> follow example:
> 
>   $ git update-index --add foo --add bar --verbose --stdin
> 
> both "foo" and "bar" are silently added via a transaction. After the
> --verbose option, subsequent updates are reported. At this point there
> is no reason for the transaction to continue as all subsequent object
> writes must be fully written before being reported. Thus the transaction
> is ended early.

That's... huh. I really have no idea, but is this design intentional or
an accident?

Patrick

  reply	other threads:[~2025-09-15  6:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 19:11 [PATCH 0/6] odb: add transaction interfaces to ODB subsystem Justin Tobler
2025-09-09 19:11 ` [PATCH 1/6] bulk-checkin: remove ODB transaction nesting Justin Tobler
2025-09-11  6:40   ` Patrick Steinhardt
2025-09-11 15:17     ` Justin Tobler
2025-09-15 23:36     ` Taylor Blau
2025-09-16  2:55       ` Justin Tobler
2025-09-16 16:44         ` Junio C Hamano
2025-09-16 17:47           ` Justin Tobler
2025-09-09 19:11 ` [PATCH 2/6] builtin/update-index: end ODB transaction when --verbose is specified Justin Tobler
2025-09-11  6:40   ` Patrick Steinhardt
2025-09-11 15:34     ` Justin Tobler
2025-09-15  6:08       ` Patrick Steinhardt [this message]
2025-09-15 17:08         ` Justin Tobler
2025-09-15 22:03           ` Justin Tobler
2025-09-09 19:11 ` [PATCH 3/6] bulk-checkin: drop flush_odb_transaction() Justin Tobler
2025-09-09 19:11 ` [PATCH 4/6] object-file: relocate ODB transaction code Justin Tobler
2025-09-09 19:11 ` [PATCH 5/6] object-file: update naming from bulk-checkin Justin Tobler
2025-09-09 19:11 ` [PATCH 6/6] odb: add transaction interface Justin Tobler
2025-09-11  6:40   ` Patrick Steinhardt
2025-09-11 16:31     ` Justin Tobler
2025-09-15 20:29 ` [PATCH v2 0/6] odb: add transaction interfaces to ODB subsystem Justin Tobler
2025-09-15 20:29   ` [PATCH v2 1/6] bulk-checkin: remove ODB transaction nesting Justin Tobler
2025-09-16  7:57     ` Karthik Nayak
2025-09-16 15:00       ` Justin Tobler
2025-09-15 20:29   ` [PATCH v2 2/6] builtin/update-index: end ODB transaction when --verbose is specified Justin Tobler
2025-09-16  9:07     ` Karthik Nayak
2025-09-16 15:17       ` Justin Tobler
2025-09-15 20:29   ` [PATCH v2 3/6] bulk-checkin: drop flush_odb_transaction() Justin Tobler
2025-09-15 20:29   ` [PATCH v2 4/6] object-file: relocate ODB transaction code Justin Tobler
2025-09-15 20:29   ` [PATCH v2 5/6] object-file: update naming from bulk-checkin Justin Tobler
2025-09-15 20:29   ` [PATCH v2 6/6] odb: add transaction interface Justin Tobler
2025-09-16 18:29   ` [PATCH v3 0/6] odb: add transaction interfaces to ODB subsystem Justin Tobler
2025-09-16 18:29     ` [PATCH v3 1/6] bulk-checkin: remove ODB transaction nesting Justin Tobler
2025-09-16 18:29     ` [PATCH v3 2/6] builtin/update-index: end ODB transaction when --verbose is specified Justin Tobler
2025-09-16 18:29     ` [PATCH v3 3/6] bulk-checkin: drop flush_odb_transaction() Justin Tobler
2025-09-16 18:29     ` [PATCH v3 4/6] object-file: relocate ODB transaction code Justin Tobler
2025-09-16 18:29     ` [PATCH v3 5/6] object-file: update naming from bulk-checkin Justin Tobler
2025-09-16 18:29     ` [PATCH v3 6/6] odb: add transaction interface Justin Tobler

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

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

  git send-email \
    --in-reply-to=aMetaZxCN8CDsr6g@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=jltobler@gmail.com \
    /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.
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 NNTP newsgroup(s).