git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] bulk-checkin: remove ODB transaction nesting

From
Justin Tobler <jltobler@gmail.com>
Date
Sep 16, 2025, 17:47 UTC
Message-ID
<vy7ah7cvv2xtq74h4zn2peqnyprd672v5pkfxskduyznrcpp2x@uqs3ksrhw6z3>
In-Reply-To
<xmqqfrcmny8r.fsf@gitster.g>
On 25/09/16 09:44AM, Junio C Hamano wrote:
Show 7 quoted lines
> Justin Tobler <jltobler@gmail.com> writes:
> > Yes, this patch removes the logic that manages the internal nested
> > transaction counter in favor of requiring callers to check if a
> > transaction has already been started or not.
> 
> OK.  Is that related to those "make it a silent no-op to pass a
> NULL, instead of forcing the caller to check" changes?

The first version of this patch initially required {begin,end}_odb_transaction() callers to manually ensure there was not already a pending transaction. If this was not ensured, it could BUG() out.

Going forward, I think it probably makes sense to change to a silent no-op passing a NULL transaction value around. This should keep the existing callers mostly unchanged and pose less of a burden while still being able to drop the transaction nesting mechanism.

Show 5 quoted lines
> Can all callers tell reliably if there is a transaction already
> going?  One transaction may start somewhere and end in a far away
> place, and these two places may not be ancestor-decendant in the
> call graph but merely a distant relative that shares a grand grand
> parent.

To start a transaction, callers must have access to `struct object_directory`. To know if a transaction is already pending, the `transaction` field of this structure can be checked.

Ending a transaction does require the pending transaction be provided to it. All existing {begin,end}_odb_transaction() call sites don't currently have a problem with this though as they are relatively close together. If we wanted to end a transaction somewhere else far away from the start, the pending transaction would need to be either wired or accessed through the repository/odb.

> > The ultimate goal of this patch is make it so invoking
> > end_odb_transaction() on a transaction guarantees it is flushed.
> 
> Either flushed or a noop, I guess?

Yes. If the pending transaction is specified, it should always be committed. If a NULL transaction value is passed, it should function as a no-op.

-Justin
Previous: Junio C HamanoNext: Justin Tobler
Message 8 of 38 in “odb: add transaction interfaces to ODB subsystem”
  1. 0/6 odb: add transaction interfaces to ODB subsystemJustin Tobler, Sep 9, 2025
  2. 1/6 bulk-checkin: remove ODB transaction nestingJustin Tobler, Sep 9, 2025
  3. Patrick SteinhardtSep 11, 2025
  4. Justin ToblerSep 11, 2025
  5. Taylor BlauSep 15, 2025
  6. Justin ToblerSep 16, 2025
  7. Junio C HamanoSep 16, 2025
  8. Justin ToblerSep 16, 2025
  9. 2/6 builtin/update-index: end ODB transaction when --verbose is specifiedJustin Tobler, Sep 9, 2025
  10. Patrick SteinhardtSep 11, 2025
  11. Justin ToblerSep 11, 2025
  12. Patrick SteinhardtSep 15, 2025
  13. Justin ToblerSep 15, 2025
  14. Justin ToblerSep 15, 2025
  15. 3/6 bulk-checkin: drop flush_odb_transaction()Justin Tobler, Sep 9, 2025
  16. 4/6 object-file: relocate ODB transaction codeJustin Tobler, Sep 9, 2025
  17. 5/6 object-file: update naming from bulk-checkinJustin Tobler, Sep 9, 2025
  18. 6/6 odb: add transaction interfaceJustin Tobler, Sep 9, 2025
  19. Patrick SteinhardtSep 11, 2025
  20. Justin ToblerSep 11, 2025
  21. 0/6 odb: add transaction interfaces to ODB subsystemJustin Tobler, Sep 15, 2025
  22. 1/6 bulk-checkin: remove ODB transaction nestingJustin Tobler, Sep 15, 2025
  23. Karthik NayakSep 16, 2025
  24. Justin ToblerSep 16, 2025
  25. 2/6 builtin/update-index: end ODB transaction when --verbose is specifiedJustin Tobler, Sep 15, 2025
  26. Karthik NayakSep 16, 2025
  27. Justin ToblerSep 16, 2025
  28. 3/6 bulk-checkin: drop flush_odb_transaction()Justin Tobler, Sep 15, 2025
  29. 4/6 object-file: relocate ODB transaction codeJustin Tobler, Sep 15, 2025
  30. 5/6 object-file: update naming from bulk-checkinJustin Tobler, Sep 15, 2025
  31. 6/6 odb: add transaction interfaceJustin Tobler, Sep 15, 2025
  32. 0/6 odb: add transaction interfaces to ODB subsystemJustin Tobler, Sep 16, 2025
  33. 2/6 builtin/update-index: end ODB transaction when --verbose is specifiedJustin Tobler, Sep 16, 2025
  34. 1/6 bulk-checkin: remove ODB transaction nestingJustin Tobler, Sep 16, 2025
  35. 3/6 bulk-checkin: drop flush_odb_transaction()Justin Tobler, Sep 16, 2025
  36. 4/6 object-file: relocate ODB transaction codeJustin Tobler, Sep 16, 2025
  37. 5/6 object-file: update naming from bulk-checkinJustin Tobler, Sep 16, 2025
  38. 6/6 odb: add transaction interfaceJustin Tobler, Sep 16, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.