From: Justin Tobler Date: Tue, 16 Sep 2025 15:17:40 GMT Subject: Re: [PATCH v2 2/6] builtin/update-index: end ODB transaction when --verbose is specified Message-ID: In-Reply-To: On 25/09/16 02:07AM, Karthik Nayak wrote: > Justin Tobler 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