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

Re: [RFC] prune: --expire=seconds

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 19, 2007, 03:44 UTC
Message-ID
<20070119034404.GA17521@spearce.org>
In-Reply-To
<7vy7o0klt1.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> wrote:
Show 8 quoted lines
> Matthias Lederhofer <matled@gmx.net> writes:
> 
> > This option specifies the minimum age of an object before it
> > may be removed by prune.  The default value is 2 hours and
> > may be changed using gc.pruneexpire.
> 
> I am not sure if this is needed, as Shawn explained earlier
> rounds of loose-objects safety work.

I think we need this fix. We still have a race condition between the loose object creation and the ref update.

We've closed this hole completely in the large push case (objects
>=receive.unpackLimit) and 'fetch -k' case by creating .keep files

before the .pack file, updating refs, then deleting the .keep file; and by making sure git-repack leaves packs with .keeps alone. So we cannot lose an object here.

But update-index/add/merge-recursive/write-tree/commit-tree, etc. as well as small pushes (objects <receive.unpackLimit) and fetch without -k option still have a race condition. The objects will be created/unpacked into the loose objects directory with nothing referencing them, and a prune which gets to run just before before the ref update becomes visible would probably whack those objects.

Given that 'git gc' is the encouraged way to maintain a repository,
and that 'repack -a -d' is safe, and prune-packed is equally safe,
I think we should try to make prune safe too.  Matthias' patch
does this by giving the ref update process a fairly large window
to perform its action within.
 
> If this is something we would want, it might make sense if we
> allowed "prune --expire='1.day'" syntax ;-).
Yes, I agree.

Matthias you can take a look at builtin-reflog.c's argument handling for an example. I think you just need to use approxidate() in both your config function and in your command line argument handling. Then the default becomes '2.hours.ago' instead of just "2" (at least from a documentation perspective).

Though the more I think about this perhaps the default should be '1.day'. 24 hours is a hellva large window for any current ref update to complete in, even if the ref update was some massive rsync which is doing a such a large volume of data on a small bandwidth link that it takes 20 hours to complete. Besides, users could always force it to be much lower with the command line option if they really need to prune _right_now_.

-- 
Shawn.
Previous: Junio C HamanoNext: Matthias Lederhofer
Message 7 of 30 in “prune-packed: new option --min-age=N”
  1. prune-packed: new option --min-age=NMatthias Lederhofer, Jan 18, 2007
  2. Shawn O. PearceJan 18, 2007
  3. Matthias LederhoferJan 18, 2007
  4. Shawn O. PearceJan 18, 2007
  5. [RFC] prune: --expire=secondsMatthias Lederhofer, Jan 18, 2007
  6. Junio C HamanoJan 18, 2007
  7. Shawn O. PearceJan 19, 2007
  8. prune: --expire=timeMatthias Lederhofer, Jan 19, 2007
  9. Nicolas PitreJan 19, 2007
  10. Junio C HamanoJan 19, 2007
  11. Matthias LederhoferJan 20, 2007
  12. Junio C HamanoJan 21, 2007
  13. Shawn O. PearceJan 21, 2007
  14. Matthias LederhoferJan 21, 2007
  15. Junio C HamanoJan 21, 2007
  16. Jeff KingJan 21, 2007
  17. Steven GrimmJan 22, 2007
  18. Jeff KingJan 22, 2007
  19. Junio C HamanoJan 22, 2007
  20. Linus TorvaldsJan 22, 2007
  21. Junio C HamanoJan 22, 2007
  22. Linus TorvaldsJan 22, 2007
  23. Junio C HamanoJan 22, 2007
  24. Linus TorvaldsJan 22, 2007
  25. Shawn O. PearceJan 22, 2007
  26. Junio C HamanoJan 22, 2007
  27. Jakub NarebskiJan 22, 2007
  28. v1.5.0.txt: update description of git-gcJeff King, Jan 22, 2007
  29. Junio C HamanoJan 22, 2007
  30. Simon 'corecode' SchubertJan 20, 2007

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.