From: Justin Tobler <jltobler@gmail.com>
To: git@vger.kernel.org
Cc: ps@pks.im, karthik.188@gmail.com, Justin Tobler <jltobler@gmail.com>
Subject: [PATCH v2 0/2] object-file: fix packfile flush during transaction commit
Date: Wed, 23 Sep 2026 17:03:13 -0500 [thread overview]
Message-ID: <20260923220315.569424-1-jltobler@gmail.com> (raw)
In-Reply-To: <cover.1789328612.git.jltobler@gmail.com>
Greetings,
This short series fixes a bug I found related to committing an ODB
transaction that contains both a loose object and "large" blob when also
configured to batch fsync loose objects. The issue can be reproduced
with the following:
git init
git config core.fsync loose-object
git config core.fsyncMethod batch
git config core.bigFileThreshold 5
echo foo >1-foo && echo foobar >2-foobar
git add 1-foo 2-foobar
and produces the following error:
error: unable to write file .git/objects/pack/pack-2b7c2470289822070687e8d64186093a710eaed3.pack: No such file or directory
fatal: unable to rename temporary file to '.git/objects/pack/pack-2b7c2470289822070687e8d64186093a710eaed3.pack'
If a "large" blob packfile is written to the transaction temporary
directory, it is unable to be flushed during transaction commit because
the underlying transaction is migrated to the main ODB before the
packfile is finalized. To avoid this, this series ensures any pending
packfile in the transaction is flushed first.
Changes since V1:
- Updated a commit message of first patch.
- Improved test readability in second patch.
Thanks,
-Justin
Justin Tobler (2):
object-file: lift ODB reprepare out of packfile flush
object-file: flush transaction packfile before migrating objects
object-file.c | 12 ++++++++----
t/t1050-large.sh | 17 +++++++++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
Range-diff against v1:
1: cf14416f22 ! 1: 6f74391ae8 object-file: lift ODB reprepare out of packfile flush
@@ Commit message
When flushing a packfile via `flush_packfile_transaction()`,
`odb_reprepare()` is invoked so the written packfile becomes visible in
- the current process. In a subsequent commit, repreparing the ODB is
- slightly deferred when committing a "files" ODB transaction.
+ the current process. In a subsequent commit, flushing the packfile is
+ performed earlier when committing a "files" ODB transaction, but the ODB
+ reprepare needs to remain the last step.
Lift ODB reprepare out of `flush_packfile_transaction()` and instead
require callers to explicitly invoke `odb_reprepare()` if required.
2: 18a1798d95 ! 2: ad2fa8ee3f object-file: flush transaction packfile before migrating objects
@@ t/t1050-large.sh: test_expect_success 'add a large file or two' '
+test_expect_success 'add large file with loose object in batch fsync' '
+ test_when_finished "rm -rf batch" &&
+ git init batch &&
++ (
++ cd batch &&
++ git config core.bigFileThreshold 5 &&
++ echo foo >1-small &&
++ echo foobar >2-large &&
+
-+ git -C batch config core.bigFileThreshold 5 &&
-+ echo foo >batch/1-small &&
-+ echo foobar >batch/2-large &&
++ git -c core.fsync=loose-object -c core.fsyncMethod=batch \
++ add 1-small 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.
-+ git -C batch cat-file -e :1-small &&
-+ git -C batch cat-file -e :2-large
++ git cat-file -e :1-small &&
++ git cat-file -e :2-large
++ )
+'
+
test_expect_success 'checkout a large file' '
base-commit: 47ce80527c56f462cb97db4ca8125342204d3783
--
2.55.0.424.g13c7afec21
next prev parent reply other threads:[~2026-09-23 22:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 20:26 [PATCH 0/2] object-file: fix packfile flush during transaction commit Justin Tobler
2026-09-13 20:26 ` [PATCH 1/2] object-file: lift ODB reprepare out of packfile flush Justin Tobler
2026-09-15 4:40 ` Karthik Nayak
2026-09-15 8:54 ` Justin Tobler
2026-09-23 13:16 ` Patrick Steinhardt
2026-09-23 21:04 ` Justin Tobler
2026-09-24 5:58 ` Patrick Steinhardt
2026-09-24 6:00 ` Patrick Steinhardt
2026-09-13 20:26 ` [PATCH 2/2] object-file: flush transaction packfile before migrating objects Justin Tobler
2026-09-15 4:46 ` Karthik Nayak
2026-09-15 8:59 ` Justin Tobler
2026-09-23 13:16 ` Patrick Steinhardt
2026-09-23 21:17 ` Justin Tobler
2026-09-23 22:03 ` Justin Tobler [this message]
2026-09-23 22:03 ` [PATCH v2 1/2] object-file: lift ODB reprepare out of packfile flush Justin Tobler
2026-09-24 6:13 ` Patrick Steinhardt
2026-09-23 22:03 ` [PATCH v2 2/2] object-file: flush transaction packfile before migrating objects Justin Tobler
2026-09-24 6:01 ` [PATCH v2 0/2] object-file: fix packfile flush during transaction commit Patrick Steinhardt
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=20260923220315.569424-1-jltobler@gmail.com \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=karthik.188@gmail.com \
--cc=ps@pks.im \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.