git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag
@ 2019-06-20  8:30 Christian Couder
  2019-06-20  8:30 ` [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Christian Couder @ 2019-06-20  8:30 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Derrick Stolee, Johannes Schindelin,
	Christian Couder

In a review[1] of my "many promisor remotes" patch series[2] and in
the following thread, it was suggested that a flag should be passed to
tell oid_object_info_extended() that it should not fetch objects from
promisor remotes if they are missing, instead of using the ugly
fetch_if_missing global.

It looks like the OBJECT_INFO_FOR_PREFETCH flag already exists but
unfortunately conflates 2 separate things.

This patch series introduces OBJECT_INFO_NO_FETCH_IF_MISSING to
disambiguate the different meanings and then uses it instead of
OBJECT_INFO_FOR_PREFETCH where it makes sense.

1: https://public-inbox.org/git/b4d69d2b-dc0d-fffb-2909-c54060fe9cd1@gmail.com/
2: https://public-inbox.org/git/20190409161116.30256-1-chriscool@tuxfamily.org/

Christian Couder (2):
  object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING
  sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING

 object-store.h | 9 +++++++--
 sha1-file.c    | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.22.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20  8:30 [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Christian Couder
@ 2019-06-20  8:30 ` Christian Couder
  2019-06-20  8:48   ` Jeff King
  2019-06-20  8:30 ` [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
  2019-06-20 20:52 ` [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Junio C Hamano
  2 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2019-06-20  8:30 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Derrick Stolee, Johannes Schindelin,
	Christian Couder

The fetch_if_missing global variable should be replaced as much
as possible by passing a flag to oid_object_info_extended().

The existing OBJECT_INFO_FOR_PREFETCH unfortunately conflates
both a "no fetch if missing" meaning with OBJECT_INFO_QUICK
which is about retrying packed storage.

Let's disambiguate that by adding a new explicit
OBJECT_INFO_NO_FETCH_IF_MISSING flag.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 object-store.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/object-store.h b/object-store.h
index 272e01e452..02c1795d50 100644
--- a/object-store.h
+++ b/object-store.h
@@ -277,10 +277,15 @@ struct object_info {
 #define OBJECT_INFO_IGNORE_LOOSE 16
 /*
  * Do not attempt to fetch the object if missing (even if fetch_is_missing is
- * nonzero). This is meant for bulk prefetching of missing blobs in a partial
+ * nonzero).
+ */
+#define OBJECT_INFO_NO_FETCH_IF_MISSING 32
+/*
+ * This is meant for bulk prefetching of missing blobs in a partial
  * clone. Implies OBJECT_INFO_QUICK.
  */
-#define OBJECT_INFO_FOR_PREFETCH (32 + OBJECT_INFO_QUICK)
+#define OBJECT_INFO_FOR_PREFETCH \
+  (OBJECT_INFO_NO_FETCH_IF_MISSING + OBJECT_INFO_QUICK)
 
 int oid_object_info_extended(struct repository *r,
 			     const struct object_id *,
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20  8:30 [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Christian Couder
  2019-06-20  8:30 ` [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
@ 2019-06-20  8:30 ` Christian Couder
  2019-06-20  8:50   ` Jeff King
  2019-06-20 20:52 ` [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Junio C Hamano
  2 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2019-06-20  8:30 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Jeff King, Derrick Stolee, Johannes Schindelin,
	Christian Couder

Currently the OBJECT_INFO_FOR_PREFETCH flag is used to check
if we should fetch objects from promisor remotes when we
haven't found them elsewhere.

Now that OBJECT_INFO_NO_FETCH_IF_MISSING exists, let's use
it instead to be more correct in case this new flag is ever
used without OBJECT_INFO_QUICK.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 sha1-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sha1-file.c b/sha1-file.c
index ed5c50dac4..2116ff1e70 100644
--- a/sha1-file.c
+++ b/sha1-file.c
@@ -1379,7 +1379,7 @@ int oid_object_info_extended(struct repository *r, const struct object_id *oid,
 		/* Check if it is a missing object */
 		if (fetch_if_missing && repository_format_partial_clone &&
 		    !already_retried && r == the_repository &&
-		    !(flags & OBJECT_INFO_FOR_PREFETCH)) {
+		    !(flags & OBJECT_INFO_NO_FETCH_IF_MISSING)) {
 			/*
 			 * TODO Investigate having fetch_object() return
 			 * TODO error/success and stopping the music here.
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20  8:30 ` [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
@ 2019-06-20  8:48   ` Jeff King
  0 siblings, 0 replies; 10+ messages in thread
From: Jeff King @ 2019-06-20  8:48 UTC (permalink / raw)
  To: Christian Couder
  Cc: git, Junio C Hamano, Derrick Stolee, Johannes Schindelin,
	Christian Couder

On Thu, Jun 20, 2019 at 10:30:25AM +0200, Christian Couder wrote:

> The fetch_if_missing global variable should be replaced as much
> as possible by passing a flag to oid_object_info_extended().
> 
> The existing OBJECT_INFO_FOR_PREFETCH unfortunately conflates
> both a "no fetch if missing" meaning with OBJECT_INFO_QUICK
> which is about retrying packed storage.
> 
> Let's disambiguate that by adding a new explicit
> OBJECT_INFO_NO_FETCH_IF_MISSING flag.

I think this patch is obsoleted by Stolee's 31f5256c82 (sha1-file: split
OBJECT_INFO_FOR_PREFETCH, 2019-05-28), which I think just made it to
master in the last day or so.

There it's called OBJECT_INFO_SKIP_FETCH_OBJECT, so your 2/2 will need
to be tweaked.

-Peff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20  8:30 ` [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
@ 2019-06-20  8:50   ` Jeff King
  2019-06-20 12:39     ` Derrick Stolee
  0 siblings, 1 reply; 10+ messages in thread
From: Jeff King @ 2019-06-20  8:50 UTC (permalink / raw)
  To: Christian Couder
  Cc: git, Junio C Hamano, Derrick Stolee, Johannes Schindelin,
	Christian Couder

On Thu, Jun 20, 2019 at 10:30:26AM +0200, Christian Couder wrote:

> Currently the OBJECT_INFO_FOR_PREFETCH flag is used to check
> if we should fetch objects from promisor remotes when we
> haven't found them elsewhere.
> 
> Now that OBJECT_INFO_NO_FETCH_IF_MISSING exists, let's use
> it instead to be more correct in case this new flag is ever
> used without OBJECT_INFO_QUICK.

I said earlier that this one would need to be tweaked for the new
upstream name. But actually, I think it is not necessary after Stolee's
patch.

-Peff

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20  8:50   ` Jeff King
@ 2019-06-20 12:39     ` Derrick Stolee
  2019-06-20 14:08       ` Christian Couder
  0 siblings, 1 reply; 10+ messages in thread
From: Derrick Stolee @ 2019-06-20 12:39 UTC (permalink / raw)
  To: Jeff King, Christian Couder
  Cc: git, Junio C Hamano, Johannes Schindelin, Christian Couder

On 6/20/2019 4:50 AM, Jeff King wrote:
> On Thu, Jun 20, 2019 at 10:30:26AM +0200, Christian Couder wrote:
> 
>> Currently the OBJECT_INFO_FOR_PREFETCH flag is used to check
>> if we should fetch objects from promisor remotes when we
>> haven't found them elsewhere.
>>
>> Now that OBJECT_INFO_NO_FETCH_IF_MISSING exists, let's use
>> it instead to be more correct in case this new flag is ever
>> used without OBJECT_INFO_QUICK.
> 
> I said earlier that this one would need to be tweaked for the new
> upstream name. But actually, I think it is not necessary after Stolee's
> patch.

Yes, I believe that 31f5256c82  does an equivalent thing to the
combination of these patches.

Thanks,
-Stolee


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20 12:39     ` Derrick Stolee
@ 2019-06-20 14:08       ` Christian Couder
  2019-06-20 20:57         ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Couder @ 2019-06-20 14:08 UTC (permalink / raw)
  To: Derrick Stolee
  Cc: Jeff King, git, Junio C Hamano, Johannes Schindelin,
	Christian Couder

On Thu, Jun 20, 2019 at 2:39 PM Derrick Stolee <stolee@gmail.com> wrote:
>
> On 6/20/2019 4:50 AM, Jeff King wrote:
> > On Thu, Jun 20, 2019 at 10:30:26AM +0200, Christian Couder wrote:
> >
> >> Currently the OBJECT_INFO_FOR_PREFETCH flag is used to check
> >> if we should fetch objects from promisor remotes when we
> >> haven't found them elsewhere.
> >>
> >> Now that OBJECT_INFO_NO_FETCH_IF_MISSING exists, let's use
> >> it instead to be more correct in case this new flag is ever
> >> used without OBJECT_INFO_QUICK.
> >
> > I said earlier that this one would need to be tweaked for the new
> > upstream name. But actually, I think it is not necessary after Stolee's
> > patch.
>
> Yes, I believe that 31f5256c82  does an equivalent thing to the
> combination of these patches.

Yeah, I agree. Thanks Stolee for having already fixed that, and sorry
for bothering everyone with this.

Christian.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag
  2019-06-20  8:30 [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Christian Couder
  2019-06-20  8:30 ` [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
  2019-06-20  8:30 ` [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
@ 2019-06-20 20:52 ` Junio C Hamano
  2019-06-21 10:47   ` Christian Couder
  2 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2019-06-20 20:52 UTC (permalink / raw)
  To: Christian Couder
  Cc: git, Jeff King, Derrick Stolee, Johannes Schindelin,
	Christian Couder

Christian Couder <christian.couder@gmail.com> writes:

> In a review[1] of my "many promisor remotes" patch series[2] and in
> the following thread, it was suggested that a flag should be passed to
> tell oid_object_info_extended() that it should not fetch objects from
> promisor remotes if they are missing, instead of using the ugly
> fetch_if_missing global.
>
> It looks like the OBJECT_INFO_FOR_PREFETCH flag already exists but
> unfortunately conflates 2 separate things.
>
> This patch series introduces OBJECT_INFO_NO_FETCH_IF_MISSING to
> disambiguate the different meanings and then uses it instead of
> OBJECT_INFO_FOR_PREFETCH where it makes sense.
>
> 1: https://public-inbox.org/git/b4d69d2b-dc0d-fffb-2909-c54060fe9cd1@gmail.com/
> 2: https://public-inbox.org/git/20190409161116.30256-1-chriscool@tuxfamily.org/

What commit did you base these two patches on?

>
> Christian Couder (2):
>   object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING
>   sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING
>
>  object-store.h | 9 +++++++--
>  sha1-file.c    | 2 +-
>  2 files changed, 8 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING
  2019-06-20 14:08       ` Christian Couder
@ 2019-06-20 20:57         ` Junio C Hamano
  0 siblings, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2019-06-20 20:57 UTC (permalink / raw)
  To: Christian Couder
  Cc: Derrick Stolee, Jeff King, git, Johannes Schindelin,
	Christian Couder

Christian Couder <christian.couder@gmail.com> writes:

> On Thu, Jun 20, 2019 at 2:39 PM Derrick Stolee <stolee@gmail.com> wrote:
>>
>> On 6/20/2019 4:50 AM, Jeff King wrote:
>> > On Thu, Jun 20, 2019 at 10:30:26AM +0200, Christian Couder wrote:
>> >
>> >> Currently the OBJECT_INFO_FOR_PREFETCH flag is used to check
>> >> if we should fetch objects from promisor remotes when we
>> >> haven't found them elsewhere.
>> >>
>> >> Now that OBJECT_INFO_NO_FETCH_IF_MISSING exists, let's use
>> >> it instead to be more correct in case this new flag is ever
>> >> used without OBJECT_INFO_QUICK.
>> >
>> > I said earlier that this one would need to be tweaked for the new
>> > upstream name. But actually, I think it is not necessary after Stolee's
>> > patch.
>>
>> Yes, I believe that 31f5256c82  does an equivalent thing to the
>> combination of these patches.
>
> Yeah, I agree. Thanks Stolee for having already fixed that, and sorry
> for bothering everyone with this.

OK, I'll stop looking at this patch.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag
  2019-06-20 20:52 ` [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Junio C Hamano
@ 2019-06-21 10:47   ` Christian Couder
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Couder @ 2019-06-21 10:47 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: git, Jeff King, Derrick Stolee, Johannes Schindelin,
	Christian Couder

On Thu, Jun 20, 2019 at 10:52 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> Christian Couder <christian.couder@gmail.com> writes:
>
> > In a review[1] of my "many promisor remotes" patch series[2] and in
> > the following thread, it was suggested that a flag should be passed to
> > tell oid_object_info_extended() that it should not fetch objects from
> > promisor remotes if they are missing, instead of using the ugly
> > fetch_if_missing global.
> >
> > It looks like the OBJECT_INFO_FOR_PREFETCH flag already exists but
> > unfortunately conflates 2 separate things.
> >
> > This patch series introduces OBJECT_INFO_NO_FETCH_IF_MISSING to
> > disambiguate the different meanings and then uses it instead of
> > OBJECT_INFO_FOR_PREFETCH where it makes sense.
> >
> > 1: https://public-inbox.org/git/b4d69d2b-dc0d-fffb-2909-c54060fe9cd1@gmail.com/
> > 2: https://public-inbox.org/git/20190409161116.30256-1-chriscool@tuxfamily.org/
>
> What commit did you base these two patches on?

They were based on master at v2.22.0 when I worked on them, but I
didn't send them right away. And I didn't rebase them before I later
sent them.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-06-21 10:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20  8:30 [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Christian Couder
2019-06-20  8:30 ` [PATCH 1/2] object-store: introduce OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
2019-06-20  8:48   ` Jeff King
2019-06-20  8:30 ` [PATCH 2/2] sha1-file: use OBJECT_INFO_NO_FETCH_IF_MISSING Christian Couder
2019-06-20  8:50   ` Jeff King
2019-06-20 12:39     ` Derrick Stolee
2019-06-20 14:08       ` Christian Couder
2019-06-20 20:57         ` Junio C Hamano
2019-06-20 20:52 ` [PATCH 0/2] Add OBJECT_INFO_NO_FETCH_IF_MISSING flag Junio C Hamano
2019-06-21 10:47   ` Christian Couder

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).