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

Re: [PATCH v2] Perform cheaper connectivity check when pack is used as medium

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Mar 3, 2012, 10:09 UTC
Message-ID
<CACsJy8ANF+tqMzXrYamSHv0N==6Wc2sVbQwJO40+=f+R+HMnbA@mail.gmail.com>
In-Reply-To
<7vfwdq8914.fsf@alter.siamese.dyndns.org>
On Sat, Mar 3, 2012 at 1:59 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
>>> I also suspect that more than trivial amount of computation is needed to
>>> determine if a given object exists only in a single pack, so the end
>>> result may not be that much cheaper than the current --verify-object code.
>>
>> Objects can exist in multiple packs right now if they are base
>> objects. I'm not sure why you need to check for object existence in a
>> single pack.
>
> What I meant to say was not "it is in this pack and nowhere else", but
> about a check like this:
>
>        static void finish_object(struct object *obj, ...)
>        {
>                struct packed_git *fetched_pack = cb_data->fetched_pack;
>
>                if (obj->type == OBJ_BLOB && !has_sha1_file(obj->sha1))
>                        die("missing");
>                if (!info->revs->verify_objects)
>                        return;
>                if (find_pack_entry_one(obj->sha1, fetched_pack))
>                        return; /* we just fetched and ran index-pack on it */
>                if (!obj->parsed && obj->type != OBJ_COMMIT)
>                        parse_object(obj->sha1);
>        }
>
> I think this is the kind of "passing identity down the callchain" both of
> us have in mind.  I was trying to say that find_pack_entry() may not be
> trivially cheap.  But probably I am being worried too much.

This is after index-pack is run and .idx file created, I think determining object's storage type should be relatively cheap compared to rehashing. We'll know when I update the patch.

Show 6 quoted lines
> But now you brought it up, I think we may also need to worry about a
> corrupt pre-existing loose blob object.  In general, we tend to always
> favor reading objects from packs over loose objects, but I do not know
> offhand what repacking would do when there are two places it can read the
> same object from (it should be allowed to pick whichever is easier to
> read).

.. which should be pack for pack-objects/repack because they can do a straight copy from pack to pack. --no-reuse-objects delegates object reading back to read_sha1_file(), and this one prefers packs too.

-- 
Duy
Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 12 of 23 in “Perform cheaper connectivity check when pack is used as medium”
  1. Perform cheaper connectivity check when pack is used as mediumNguyễn Thái Ngọc Duy, Feb 27, 2012
  2. Junio C HamanoFeb 27, 2012
  3. Perform cheaper connectivity check when pack is used as mediumNguyễn Thái Ngọc Duy, Feb 28, 2012
  4. Johannes SixtFeb 28, 2012
  5. Andreas EricssonFeb 28, 2012
  6. Nguyen Thai Ngoc DuyFeb 29, 2012
  7. Junio C HamanoMar 2, 2012
  8. Nguyen Thai Ngoc DuyMar 2, 2012
  9. Junio C HamanoMar 2, 2012
  10. Nguyen Thai Ngoc DuyMar 3, 2012
  11. Junio C HamanoMar 3, 2012
  12. Nguyen Thai Ngoc DuyMar 3, 2012
  13. Nguyen Thai Ngoc DuyMar 6, 2012
  14. Junio C HamanoMar 6, 2012
  15. {fetch,receive}-pack: skip sha-1 integrity test on objects from new packNguyễn Thái Ngọc Duy, Mar 14, 2012
  16. Junio C HamanoMar 14, 2012
  17. Junio C HamanoMar 15, 2012
  18. Junio C HamanoMar 15, 2012
  19. Nguyen Thai Ngoc DuyMar 16, 2012
  20. Junio C HamanoMar 16, 2012
  21. Nguyen Thai Ngoc DuyMar 16, 2012
  22. Nguyen Thai Ngoc DuyMar 16, 2012
  23. Junio C HamanoMar 16, 2012

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.