Re: [PATCH 1/2] Delete ref $frotz by moving ref file to "deleted-$frotz~ref".

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 1/2] Delete ref $frotz by moving ref file to "deleted-$frotz~ref".

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:43

Christian Couder [off-list ref] writes:
For example, when git becomes a major SCM, there may be people working on 
big projects that want to create a new branch for each new bug and then 
delete the branch when the code on the bug branch has been integrated into 
a new release and the bug is closed.
I would say that is a very valid way to work with git,
regardless of the size of project.  Now, how often would you
create such a per-bug branch and delete one, compared to the
number of operations that would require ref lookups?  Your
example actually supports what I've said -- optimizing for
deletion at the cost of more expensive lookups is wrong.
The operations that inspect project history may use a ref cache or something 
so that a lookup on the disk may not be needed. So only the ref creation or 
update rate versus delete rate may matter.
Stop and think about what you are saying.  What's a ref cache?
We do not have such a beast today (unless you equate it with
packed-refs file), and you would need to design and implement
it, but think about how you make that operate.  You would need
to invalidate it when you delete a ref using the deleted-ref/
approach; that's not much different from repacking packed-refs
file without the ref you just deleted, no?

Of course you can argue that instead of repacking you always
stat deleted-ref/ hierarchy; in other words, you can argue that
you can make deletion path faster by penalizing the lookup path.

So I do not think using "ref cache" (whatever it is, and however
it operates) does not change the situation a bit.
If there are thousand of refs and a heavy I/O load, rewritting the packed 
ref file for each deletion means writing on disk something that may not fit 
in the disk cache. It may be very bad.
If the goal is to optimize for deletion path, then that is
true.  My point is that we do not want to optimize for deletion
path at the expense of more costly lookup path.

Re: [PATCH 1/2] Delete ref $frotz by moving ref file to "deleted-$frotz~ref".

From: Shawn Pearce <hidden>
Date: 2016-06-15 22:42:43

Junio C Hamano [off-list ref] wrote:
Christian Couder [off-list ref] writes:
quoted
For example, when git becomes a major SCM, there may be people working on 
big projects that want to create a new branch for each new bug and then 
delete the branch when the code on the bug branch has been integrated into 
a new release and the bug is closed.
I would say that is a very valid way to work with git,
regardless of the size of project.  Now, how often would you
create such a per-bug branch and delete one, compared to the
number of operations that would require ref lookups?  Your
example actually supports what I've said -- optimizing for
deletion at the cost of more expensive lookups is wrong.
I agree completely with Junio.  I make a lot of temporary "throw
away" branches in Git; often they live on disk for 5/10 minutes at
most before getting deleted again.  I also make a smaller number
(but still significant) of longer lived branches that hang around
for days or weeks before getting deleted.

In the former case (throw away) I wouldn't want those refs added
to the packed refs file.  They just don't live around long enough
to make it worth it.  And when I delete them I want them gone.
So moving them off to a 'deleted-refs' directory to indicate they
are gone is just delaying the removal.  Not something I want.

In the latter case (longer lived) I don't mind if I have to sit
though an extra 500 ms to rewrite the entire packed refs file
during a ref delete operation.  I lived with the branch for weeks;
I can probably spare a second to finally get rid of it once its
gone upstream.  Heck, the push to move that branch upstream might
actually take longer to unpack the loose objects contained on that
branch than the packed ref delete, even on 1000s of refs.
 
If the goal is to optimize for deletion path, then that is
true.  My point is that we do not want to optimize for deletion
path at the expense of more costly lookup path.
Absolutely.  I figure I do ref lookups at least 3x the number of ref
deletes I perform.  And that's just thinking about the sequence of
commands I commonly perform against my "throw away" branches which
live for at most 10 minutes, let alone my longer lived branches
that hang around for weeks.

-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help