]> git.ipfire.org Git - thirdparty/git.git/commit
reftable: adapt write_object_record() to propagate block_writer_add() errors
authorMeet Soni <meetsoni3017@gmail.com>
Wed, 19 Mar 2025 15:29:27 +0000 (20:59 +0530)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Mar 2025 08:51:08 +0000 (01:51 -0700)
commit0e1b9c5eed8bfc091570cc93bd15d3c235d15971
tree5f21c7c59e57fcdd6858c3489f9e207f232d73f9
parent9ce297239b94ca6bc671b629246711d0ebf096ef
reftable: adapt write_object_record() to propagate block_writer_add() errors

Previously, write_object_record() would flush the current block and retry
appending the record whenever block_writer_add() returned any nonzero
error. This forced an assumption that every failure meant the block was
full, even when errors such as memory allocation or I/O failures occurred.

Update the write_object_record() to inspect the error code returned by
block_writer_add() and flush and reinitialize the writer iff the
error is REFTABLE_ENTRY_TOO_BIG_ERROR. For any other error, immediately
propagate it.

If the flush and reinitialization still fail with
REFTABLE_ENTRY_TOO_BIG_ERROR, reset the record's offset length to zero
before a final attempt.

All call sites now handle various error codes returned by
block_writer_add().

Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reftable/writer.c