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

Re: [PATCH 00/24] Yet another pre-refs-backend series

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Apr 9, 2016, 16:19 UTC
Message-ID
<57092BA6.1060808@alum.mit.edu>
In-Reply-To
<1460055791-23313-1-git-send-email-dturner@twopensource.com>
On 04/07/2016 03:02 PM, David Turner wrote:
Show 14 quoted lines
> We now have quite a large number of patches before we even get into
> the meat of the pluggable refs backend series.  So it's worth breaking
> those out and getting them in before we get into the main series
> (which Michael Haggerty swants to redesign a bit anyway).
> 
> This set of patches should be applied on top of
> jk/check-repository-format.
> 
> Michael Haggerty has reviewed those of my patches which are in here
> except maybe:
>   refs: on symref reflog expire, lock symref not referrent
> This was the one from later in the series that was straightforward to
> move to before the vtable; the other two were going to be harder to
> move and can wait until after the vtable.

This last patch deserves a little bit of discussion. Currently, when the reflog of a symref is expired, the pointed-to ref is locked rather than the symref. This patch changes the code to lock the symref instead.

This is clearly the right thing to do, and I consider this change a bug fix. However, it introduces an incompatibility. An old version of `git reflog expire` and a new version wouldn't agree on the locking protocol, and could potentially try to overwrite the same reflog at the same time.

I think this risk is acceptable nevertheless, because expiring reflogs is an uncommon operation and unlikely to be done from two processes at the same time; moreover, the integrity of reflogs is not a matter of life or death.

A far more likely conflict would be between a reflog expiration and a symref update (e.g., `git checkout otherbranch`). This use case is currently *broken* because `git checkout` locks HEAD. It would be fixed by this patch.

If somebody is really upset about the risk of a race between an old and new version of `git reflog expire`, the way to increase the safety would be to lock *both* the symref and the referent while changing the symref's reflog. I think that would be overkill.

This whole series is
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>

David mentioned that I want to redesign the vtable patches somewhat. Anybody who is curious can look at the work in progress branch on my GitHub fork [1], branch wip/ref-storage.

Michael
[1] https://github.com/mhagger/git
Previous: Junio C HamanoNext: Junio C Hamano
Message 31 of 32 in “Yet another pre-refs-backend series”
  1. 00/24 Yet another pre-refs-backend seriesDavid Turner, Apr 7, 2016
  2. 01/24 refs: move head_ref{,_submodule} to the common codeDavid Turner, Apr 7, 2016
  3. 02/24 refs: move for_each_*ref* functions into common codeDavid Turner, Apr 7, 2016
  4. 03/24 t1430: test the output and error of some commands more carefullyDavid Turner, Apr 7, 2016
  5. Michael HaggertyApr 8, 2016
  6. David TurnerApr 8, 2016
  7. Junio C HamanoApr 8, 2016
  8. David TurnerApr 8, 2016
  9. 04/24 t1430: clean up broken refs/tags/shadowDavid Turner, Apr 7, 2016
  10. 05/24 t1430: don't rely on symbolic-ref for creating broken symrefsDavid Turner, Apr 7, 2016
  11. 06/24 t1430: test for-each-ref in the presence of badly-named refsDavid Turner, Apr 7, 2016
  12. 07/24 t1430: improve test coverage of deletion of badly-named refsDavid Turner, Apr 7, 2016
  13. 08/24 resolve_missing_loose_ref(): simplify semanticsDavid Turner, Apr 7, 2016
  14. 09/24 resolve_ref_unsafe(): use for loop to count up to MAXDEPTHDavid Turner, Apr 7, 2016
  15. 10/24 resolve_ref_unsafe(): ensure flags is always setDavid Turner, Apr 7, 2016
  16. 11/24 resolve_ref_1(): eliminate local variableDavid Turner, Apr 7, 2016
  17. 12/24 resolve_ref_1(): reorder codeDavid Turner, Apr 7, 2016
  18. 13/24 resolve_ref_1(): eliminate local variable "bad_name"David Turner, Apr 7, 2016
  19. 14/24 files-backend: break out ref readingDavid Turner, Apr 7, 2016
  20. 15/24 read_raw_ref(): manage own scratch spaceDavid Turner, Apr 7, 2016
  21. 16/24 Inline resolve_ref_1() into resolve_ref_unsafe()David Turner, Apr 7, 2016
  22. 17/24 read_raw_ref(): change flags parameter to unsigned intDavid Turner, Apr 7, 2016
  23. 18/24 fsck_head_link(): remove unneeded flag variableDavid Turner, Apr 7, 2016
  24. 19/24 cmd_merge(): remove unneeded flag variableDavid Turner, Apr 7, 2016
  25. 20/24 checkout_paths(): remove unneeded flag variableDavid Turner, Apr 7, 2016
  26. 21/24 check_aliased_update(): check that dst_name is non-NULLDavid Turner, Apr 7, 2016
  27. 22/24 show_head_ref(): check the result of resolve_ref_namespace()David Turner, Apr 7, 2016
  28. 23/24 refs: move resolve_ref_unsafe into common codeDavid Turner, Apr 7, 2016
  29. 24/24 refs: on symref reflog expire, lock symref not referrentDavid Turner, Apr 7, 2016
  30. Junio C HamanoApr 7, 2016
  31. Michael HaggertyApr 9, 2016
  32. Junio C HamanoApr 10, 2016

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.