All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH] git: add --no-optional-locks option
Date: Thu, 21 Sep 2017 01:08:36 -0400	[thread overview]
Message-ID: <20170921050835.mrbgx2zryy3jusdk@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqbmm4lkf5.fsf@gitster.mtv.corp.google.com>

On Thu, Sep 21, 2017 at 01:55:58PM +0900, Junio C Hamano wrote:

> The phrase 'optional lock' does not answer this question clearly,
> though: does it make sense to extend the coverage of this option in
> the future to things more than the "opportunistic update to the
> index file"?
> 
> If the answer is no, then having 'index' instead of 'lock' in the
> name of the option would make more sense (and 'opportunistic' over
> 'optional', too), because what the change is about is to allow other
> processes that are directly interacting with the user to update the
> index, and 'lock' being hindrance is merely an implementation
> detail.  The comment on the "test" in the log message mentions as if
> it were a short-coming that it does not check the lock but checks
> if the index is written, but I think that is testing what matters
> and preferable than testing "did we lock and then unlock it?"
> 
> On the other hand, if the answer is yes, then I am curious what
> other things this may extend to, and if these other things are also
> opportunistic optimizations.

I left it intentionally vague exactly because I thought we might want to
leave room for the answer to change to "yes" eventually.  For instance,
imagine that we had a ref storage format that required periodic
compaction, and readers might sometimes choose to compact in order to
save future readers from repeating some work they've done. If that
compaction means holding a lock even for a brief period, I think it
would fall under this option.

I admit that's just adding more hand-waving to the pile. But I don't
think it really _hurts_ to leave that door open (aside from making the
documentation a bit wishy-washy). And it helps because callers would
pick up the new features automatically, without having to learn about a
new option.

And I think that's really what this option is. It is less about the
caller asking for some specific behavior, and more about them telling
Git about the context in which it's executing so it can make intelligent
decisions.

And in that sense, something descriptive like --background-process
perhaps would be a better name. Except that I couldn't come up with a
name that isn't confusing (certainly --background-process implies to me
that Git would itself run in the background, which makes no sense here).

I also considered something like "--read-only" to tell Git that we
should avoid writing to the repository. But that's really not what this
does. It just avoids writes that may cause contention, not all writes.

I also considered using the word "opportunistic" in the option name, but
decided it was too long and hard to spell.

So there. I am open to a better name, but I could not come up with one.

> Thanks (and sorry for not being Johannes ;-).

You lack his rugged good looks, but your review was still welcome.

-Peff

  reply	other threads:[~2017-09-21  5:08 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-21  4:32 [PATCH] git: add --no-optional-locks option Jeff King
2017-09-21  4:55 ` Junio C Hamano
2017-09-21  5:08   ` Jeff King [this message]
2017-09-21  5:29     ` Junio C Hamano
2017-09-21 18:25 ` Johannes Sixt
2017-09-22  4:25   ` Jeff King
2017-09-22 11:22     ` Jeff Hostetler
2017-09-22 15:04       ` Jeff King
2017-09-22 20:09     ` Stefan Beller
2017-09-22 21:25       ` Jeff King
2017-09-22 21:41         ` Stefan Beller
2017-09-23  3:34           ` Jeff King
2017-09-25 18:51             ` Stefan Beller
2017-09-27  6:44               ` Jeff King
2017-09-22  6:42 ` Daniel Santos
2017-09-22 16:04   ` Jeff King
2017-09-24 11:31 ` Kaartic Sivaraam
2017-09-25 16:17   ` Johannes Schindelin
2017-09-26 14:44     ` Jeff Hostetler
2017-09-25 16:10 ` Johannes Schindelin
2017-09-25 17:00   ` Jeff King
     [not found] ` <79ed4c34-1727-7c1e-868a-1206902638ad@gmail.com>
2017-09-27  6:40   ` Jeff King
2017-09-27 13:50     ` Kaartic Sivaraam
2017-09-27 16:28       ` Jeff King
2017-09-27  6:54 ` [PATCH v2] " Jeff King
2017-09-28 16:15   ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170921050835.mrbgx2zryy3jusdk@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.