[PATCH v2 10/13] http-walker: don't fetch objects via promisor remotes
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 25, 2025, 07:09 UTC
- Message-ID
- <20250425-pks-object-store-cleanups-v2-10-63f1695b7700@pks.im>
- In-Reply-To
- <20250425-pks-object-store-cleanups-v2-0-63f1695b7700@pks.im>
The HTTP walker is responsible for fetching objects via the dumb HTTP protocol. To avoid re-fetching objects that we already have locally we first check whether the object already exists in the local repository before issuing the requests.
This existence check is done by calling `repo_has_object_file()`, which will fetch the object via a promisor remote in case it is in a promisor pack. This fetch does not make any sense for us though: we're already in the process of fetching the object anyway, so fetching it via a separate connection is wasteful, but should otherwise be harmless.
Fix the issue by converting to `has_object()`, which knows to not fetch objects via promisor remotes by default.
Signed-off-by: Patrick Steinhardt <ps@pks.im> --- http-walker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/http-walker.c b/http-walker.c index 95458e2f638..5ad2eae9a11 100644 --- a/http-walker.c +++ b/http-walker.c @@ -138,7 +138,7 @@ static int fill_active_slot(void *data UNUSED) list_for_each_safe(pos, tmp, head) { obj_req = list_entry(pos, struct object_request, node); if (obj_req->state == WAITING) { - if (repo_has_object_file(the_repository, &obj_req->oid)) + if (has_object(the_repository, &obj_req->oid, HAS_OBJECT_RECHECK_PACKED)) obj_req->state = COMPLETE; else { start_object_request(obj_req); @@ -496,7 +496,7 @@ static int fetch_object(struct walker *walker, const struct object_id *oid) if (!obj_req) return error("Couldn't find request for %s in the queue", hex); - if (repo_has_object_file(the_repository, &obj_req->oid)) { + if (has_object(the_repository, &obj_req->oid, HAS_OBJECT_RECHECK_PACKED)) { if (obj_req->req) abort_http_object_request(&obj_req->req); abort_object_request(obj_req);
-- 2.49.0.901.g37484f566f.dirty