Re: [PATCH v2 2/6] builtin/update-index: end ODB transaction when --verbose is specified
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Sep 16, 2025, 15:17 UTC
- Message-ID
- <xvrq3xrmxnotzwyurnrxmxxq6aoclns3ywykoguenlw4a7euyl@7xys5dgoxpbv>
- In-Reply-To
- <CAOLa=ZS_H2CKvYy09Xd1GPqS9Bd5v_dZYiOLjZRbKN4fbYRbVA@mail.gmail.com>
On 25/09/16 02:07AM, Karthik Nayak wrote:
Show 23 quoted lines
> Justin Tobler <jltobler@gmail.com> writes:
> > + /*
> > + * It is possible, though unlikely, that a caller could
> > + * use the verbose output to synchronize with addition
> > + * of objects to the object database. The current
> > + * implementation of ODB transactions leaves objects
> > + * invisible while a transaction is active, so end the
> > + * transaction here early before processing the next
> > + * update. All further updates are performed outside of
> > + * a transaction.
> > + */
> > + if (transaction && verbose) {
> > + end_odb_transaction(transaction);
> > + transaction = NULL;
> > + }
> > +
>
> So with this change, we now have all objects updated before the
> `--verbose` flag updated via a single transaction. Updates after the
> `--verbose` flag will no longer use a transaction.
>
> The older version would flush the transaction on every report, is there
> is any benefits to the new flow with regards to performance?The older version would only flush transaction during a report if the --verbose option is enabled. Object written without --verbose would not be immediately flushed on report.
In this version we have functionally the same thing, but instead of flushing the transaction every report, the transaction is ended and subsequent object writes are written outside of a transaction instead.
I'll try to clarify this in the commit message.
-Justin