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

Re: RFC: Enable delayed responses to Git clean/smudge filter requests

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 15, 2016, 18:03 UTC
Message-ID
<xmqqvavotych.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<5BC69AC1-5499-4F73-816A-D8786106D796@gmail.com>
Lars Schneider <larsxschneider@gmail.com> writes:
>> The filter itself would need to be aware of parallelism
>> if it lives for multiple objects, right?
>
> Correct. This way Git doesn't need to deal with threading...

I think you need to be careful about three things (at least; there may be more):

 * Codepaths that check out multiple cache entries do rely on the
   order of checkout.  We checkout removals first to make room so
   that creation of a path X can succeed if an existing path X/Y
   that used to want to see X as a directory can succeed (see the
   use of checkout_entry() by "git checkout", which does have two
   separate loops to explicitly guarantee this), for example.  I
   think "remove all and then create" you do not specifically have
   to worry about with the proposed change, but you may need to
   inspect and verify there aren't other kind of order dependency.
 * Done naively, it will lead to unmaintainable code, like this:
   + struct list_of_cache_entries *list = ...;
     for (i = 0; i < active_nr; i++)
   -    checkout_entry(active_cache[i], state, NULL);
   +    if (checkout_entry(active_cache[i], state, NULL) == DELAYED)
   +       add_cache_to_queue(&list, active_cache[i]);
   + while (list) {
   +    wait_for_checkout_to_finish(*list);
   +    list = list->next;
   + }
   I do not think we want to see such a rewrite all over the
   codepaths.  It might be OK to add such a "these entries are known
   to be delayed" list in struct checkout so that the above becomes
   more like this:
     for (i = 0; i < active_nr; i++)
        checkout_entry(active_cache[i], state, NULL);
   + checkout_entry_finish(state);
   That is, addition of a single "some of the checkout_entry() calls
   done so far might have been lazy, and I'll give them a chance to
   clean up" might be palatable.  Anything more than that on the
   caller side is not.
 * You'd need to rein in the maximum parallelism somehow, as you do
   not want to see hundreds of competing filter processes starting
   only to tell the main loop over an index with hundreds of entries
   that they are delayed checkouts.
Previous: Lars SchneiderNext: Lars Schneider
Message 4 of 16 in “RFC: Enable delayed responses to Git clean/smudge filter requests”
  1. Lars SchneiderNov 14, 2016
  2. Eric WongNov 15, 2016
  3. Lars SchneiderNov 15, 2016
  4. Junio C HamanoNov 15, 2016
  5. Lars SchneiderNov 16, 2016
  6. Junio C HamanoNov 16, 2016
  7. Lars SchneiderNov 16, 2016
  8. Junio C HamanoNov 16, 2016
  9. Jakub NarębskiNov 16, 2016
  10. Junio C HamanoNov 16, 2016
  11. Lars SchneiderNov 17, 2016
  12. Lars SchneiderNov 24, 2016
  13. Junio C HamanoNov 28, 2016
  14. Eric WongNov 15, 2016
  15. Stefan BellerJan 9, 2017
  16. Lars SchneiderJan 11, 2017

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.