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

Re: [PATCHv2] refs.c: enable large transactions

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Apr 22, 2015, 20:12 UTC
Message-ID
<553800A1.3010903@alum.mit.edu>
In-Reply-To
<CAGZ79kbb=UUVq8np-ndiMS_id5GaBHpDafDe9ZB3TvsK3xYe_g@mail.gmail.com>
On 04/22/2015 09:09 PM, Stefan Beller wrote:
Show 22 quoted lines
> On Wed, Apr 22, 2015 at 7:11 AM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>>> +     if (lock->lk->fd == -1)
>>> +             reopen_lock_file(lock->lk);
>>
>> You should check that reopen_lock_file() was successful.
> 
> ok
> 
> 
>>> @@ -3762,6 +3779,10 @@ int ref_transaction_commit(struct ref_transaction *transaction,
>>>                                   update->refname);
>>>                       goto cleanup;
>>>               }
>>> +             if (remaining_fds > 0)
>>> +                     remaining_fds--;
>>> +             else
>>> +                     close_lock_file(update->lock->lk);
>>
>> I consider this code a stopgap, and simplicity is more important than
>> optimization.
> 
> Can you explain a bit why you think this is a stopgap?

At the point the lockfile is created, we have all the information we need to write the new SHA-1 to it and close it immediately. It seems more straightforward to do it that way than the way it is done in the current code, where the locking and writing are separated in time and space and now there is the small extra complication of maybe-closing-maybe-not. But getting to the final destination requires more refactoring than would be prudent for the upcoming release.

In other words, I think your fix is OK but that the whole area of code has still not reached its final form. I am working on a patch series that does what I have in mind, but it's not ready yet. As I remember I got stuck when I realized that the reflog for HEAD is updated somewhere out of the blue without proper locking and I haven't gotten around to sorting it out yet.

Show 6 quoted lines
> [...]
>> But just for the sake of discussion, if we planned to keep
>> this code around, it could be improved by not wasting open file
>> descriptors for references that are only being verified or deleted, like so:
> 
> I'll pick that up for the resend.
OK.
Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
Previous: Stefan BellerNext: Junio C Hamano
Message 21 of 28 in “Another approach to large transactions”
  1. 0/3 Another approach to large transactionsStefan Beller, Apr 16, 2015
  2. 1/3 refs.c: remove lock_fd from struct ref_lockStefan Beller, Apr 16, 2015
  3. 2/3 Move get_max_fd_limit(void) to git_compat_util.hStefan Beller, Apr 16, 2015
  4. 3/3 refs.c: enable large transactionsStefan Beller, Apr 16, 2015
  5. Junio C HamanoApr 17, 2015
  6. Junio C HamanoApr 17, 2015
  7. Stefan BellerApr 17, 2015
  8. Stefan BellerApr 17, 2015
  9. Stefan BellerApr 20, 2015
  10. Junio C HamanoApr 20, 2015
  11. Stefan BellerApr 20, 2015
  12. Stefan BellerApr 21, 2015
  13. refs.c: enable large transactionsStefan Beller, Apr 21, 2015
  14. Junio C HamanoApr 21, 2015
  15. Stefan BellerApr 21, 2015
  16. Junio C HamanoApr 21, 2015
  17. [PATCHv2] refs.c: enable large transactionsStefan Beller, Apr 21, 2015
  18. Stefan BellerApr 21, 2015
  19. Michael HaggertyApr 22, 2015
  20. Stefan BellerApr 22, 2015
  21. Michael HaggertyApr 22, 2015
  22. Junio C HamanoApr 21, 2015
  23. Jeff KingApr 21, 2015
  24. Stefan BellerApr 22, 2015
  25. Jeff KingApr 22, 2015
  26. Junio C HamanoApr 21, 2015
  27. Stefan BellerApr 21, 2015
  28. Michael HaggertyApr 21, 2015

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.