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

Re: [PATCH v3 2/2] reftable: adapt writer code to propagate block_writer_add() errors

From
Meet Soni <meetsoni3017@gmail.com>
Date
Mar 13, 2025, 15:29 UTC
Message-ID
<CAPhwyn3rAaFZ0UYniJWUswAWyyPkDNgvKSvRpV6_H9v__txVog@mail.gmail.com>
In-Reply-To
<Z9GC400L-XV3SFyj@pks.im>
On Wed, 12 Mar 2025 at 18:19, Patrick Steinhardt <ps@pks.im> wrote:
Show 25 quoted lines
>
> > +     /*
> > +      * The current block is full, so we need to flush and reinitialize the
> > +      * writer to start writing the next block.
> > +      */
> >       arg->err = writer_flush_block(arg->w);
> >       if (arg->err < 0)
> >               goto done;
>
> But there is another case further down where we do `block_writer_add()`
> and then re-try in case the write fails. This one is a bit more curious:
> if the write fails, we don't create a new block -- after all we have
> just created one. Instead, we reset the record's offset length to zero
> before retrying.
>
> I _think_ that this is done because we know that when resetting the
> offset we would write less data to the block, as can be seen in
> `reftable_obj_record_encode()`. But I'm honestly not quite sure here as
> I haven't yet done a deep dive into object records -- after all, we
> don't even really use them in Git.
>
> In any case, I think that this callsite also needs adjustment and
> warrants a comment. And if so, all changes to `write_object_record()`
> should probably go into a separate commit, as well.
>

Regarding the callsite in write_object_record() where we reset the record's offset length to zero before retrying: my changes currently follow the same principle.

    - If block_writer_add() returns an error other than
      REFTABLE_ENTRY_TOO_BIG_ERROR, we simply return.
    - For REFTABLE_ENTRY_TOO_BIG_ERROR, we flush the block and retry.
    - If that fails, we reset the record's offset length to zero and
      then retry.

I'm not sure what adjustments or additional comments you are referring to. Could you please clarify what changes you expect at this callsite?

Thanks! Meet

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 10 of 20 in “reftable: return proper error code from block_writer_add()”
  1. reftable: return proper error code from block_writer_add()Meet Soni, Mar 6, 2025
  2. Patrick SteinhardtMar 6, 2025
  3. Junio C HamanoMar 6, 2025
  4. reftable: return proper error code from block_writer_add()Meet Soni, Mar 8, 2025
  5. Patrick SteinhardtMar 12, 2025
  6. 0/2 reftable: return proper error codes from block_writer_addMeet Soni, Mar 12, 2025
  7. 1/2 reftable: propagate specific error codes in block_writer_add()Meet Soni, Mar 12, 2025
  8. 2/2 reftable: adapt writer code to propagate block_writer_add() errorsMeet Soni, Mar 12, 2025
  9. Patrick SteinhardtMar 12, 2025
  10. Meet SoniMar 13, 2025
  11. Patrick SteinhardtMar 19, 2025
  12. 0/3 reftable: return proper error codes from block_writer_addMeet Soni, Mar 19, 2025
  13. 1/3 reftable: propagate specific error codes in block_writer_add()Meet Soni, Mar 19, 2025
  14. 2/3 reftable: adapt writer_add_record() to propagate block_writer_add() errorsMeet Soni, Mar 19, 2025
  15. 3/3 reftable: adapt write_object_record() to propagate block_writer_add() errorsMeet Soni, Mar 19, 2025
  16. 0/3 reftable: return proper error codes from block_writer_addMeet Soni, Mar 19, 2025
  17. 1/3 reftable: propagate specific error codes in block_writer_add()Meet Soni, Mar 19, 2025
  18. 2/3 reftable: adapt writer_add_record() to propagate block_writer_add() errorsMeet Soni, Mar 19, 2025
  19. 3/3 reftable: adapt write_object_record() to propagate block_writer_add() errorsMeet Soni, Mar 19, 2025
  20. Patrick SteinhardtMar 19, 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.