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

Re: [PATCH 2/2] object-file: flush transaction packfile before migrating objects

From
Patrick Steinhardt <ps@pks.im>
Date
Sep 23, 2026, 13:16 UTC
Message-ID
<arPRM191URNQGu7V@pks.im>
In-Reply-To
<18a1798d958d7f089614ec588346096c10b0666a.1789328612.git.jltobler@gmail.com>
On Sun, Sep 13, 2026 at 03:26:22PM -0500, Justin Tobler wrote:
Show 22 quoted lines
> diff --git a/object-file.c b/object-file.c
> index 0f123b79fad1..210984f82532 100644
> --- a/object-file.c
> +++ b/object-file.c
> @@ -1262,6 +1262,8 @@ static int odb_transaction_files_commit(struct odb_transaction *base)
>  		container_of(base, struct odb_transaction_files, base);
>  	int have_packfile = !!transaction->packfile.f;
>  
> +	flush_packfile_transaction(transaction);
> +
>  	if (transaction->objdir) {
>  		struct strbuf temp_path = STRBUF_INIT;
>  		struct tempfile *temp;
> @@ -1292,8 +1294,6 @@ static int odb_transaction_files_commit(struct odb_transaction *base)
>  		transaction->objdir = NULL;
>  	}
>  
> -	flush_packfile_transaction(transaction);
> -
>  	if (have_packfile)
>  		odb_reprepare(transaction->base.source->odb);
>  
In the preceding commit you wrote:
    In a subsequent commit, repreparing the ODB is slightly deferred
    when committing a "files" ODB transaction.

But that's not really true -- you don't delay repreparing the object database, but instead only flush earlier. The reprepare still happens at the same point in time.

Show 11 quoted lines
> diff --git a/t/t1050-large.sh b/t/t1050-large.sh
> index d295c265c75c..fb83c8fba619 100755
> --- a/t/t1050-large.sh
> +++ b/t/t1050-large.sh
> @@ -87,6 +87,22 @@ test_expect_success 'add a large file or two' '
>  	test $count = 1
>  '
>  
> +test_expect_success 'add large file with loose object in batch fsync' '
> +	test_when_finished "rm -rf batch" &&
> +	git init batch &&

I feel like using a subshell might've helped here for readability. But, oh well, it saves us an extra process.

Show 8 quoted lines
> +	git -C batch config core.bigFileThreshold 5 &&
> +	echo foo >batch/1-small &&
> +	echo foobar >batch/2-large &&
> +
> +	git -C batch -c core.fsync=loose-object -c core.fsyncMethod=batch \
> +		add 1-small 2-large &&
> +
> +	# Neither object may be left behind in a temporary location.

You don't really verify whether they are left behind, but rather verify that the can be read. Which is a bit of a different thing.

Sorry, feels like I'm in a nitpicky mood today :)
Thanks!
Patrick
Previous: Justin ToblerNext: Justin Tobler
Message 12 of 18 in “object-file: fix packfile flush during transaction commit”
  1. 0/2 object-file: fix packfile flush during transaction commitJustin Tobler, Sep 13, 2026
  2. 1/2 object-file: lift ODB reprepare out of packfile flushJustin Tobler, Sep 13, 2026
  3. Karthik NayakSep 15, 2026
  4. Justin ToblerSep 15, 2026
  5. Patrick SteinhardtSep 23, 2026
  6. Justin ToblerSep 23, 2026
  7. Patrick SteinhardtSep 24, 2026
  8. Patrick SteinhardtSep 24, 2026
  9. 2/2 object-file: flush transaction packfile before migrating objectsJustin Tobler, Sep 13, 2026
  10. Karthik NayakSep 15, 2026
  11. Justin ToblerSep 15, 2026
  12. Patrick SteinhardtSep 23, 2026
  13. Justin ToblerSep 23, 2026
  14. 0/2 object-file: fix packfile flush during transaction commitJustin Tobler, Sep 23, 2026
  15. 1/2 object-file: lift ODB reprepare out of packfile flushJustin Tobler, Sep 23, 2026
  16. Patrick SteinhardtSep 24, 2026
  17. 2/2 object-file: flush transaction packfile before migrating objectsJustin Tobler, Sep 23, 2026
  18. Patrick SteinhardtSep 24, 2026

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.