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

Re: [PATCH v1] read_index_from(): Skip verification of the cache entry order to speed index loading

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 19, 2017, 05:22 UTC
Message-ID
<xmqq4lqvk8ze.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20171018142725.10948-1-benpeart@microsoft.com>
Ben Peart <benpeart@microsoft.com> writes:
> There is code in post_read_index_from() to catch out of order entries
> when reading an index file.  This order verification is ~13% of the cost
> of every call to read_index_from().

I find this a bit over-generalized claim---wouldn't the overhead depend on various conditions, e.g. the size of the index and if split-index is in effect?

In general, I get very skeptical towards any change that makes the integrity of the data less certain based only on microbenchmarks, and prefer to see a solution that can absorb the overhead in some other way.

When we are using split-index, the current code is not validating the two input files from the disk. Because merge_base_index() depends on the base to be properly sorted before the overriding entries are added into it, if the input from disk is in a wrong order, we are screwed already, and the order check in post processing is pointless. If we want to do this order validation, I think we should be doing it in do_read_index() where it does create_from_disk() and the set_index_entry(), instead of having it as a separate phase that scans a potentially large index array one more time. And doing so will not penalize the case where we do not use split-index, either.

So, I think I like the direction of getting rid of the order validation in post_read_index_from(), not only during the normal operation but also in fsck. I think it makes more sense to do so incrementally inside do_read_index() all the time and see how fast we can make it do so.

Previous: Ben PeartNext: Ben Peart
Message 2 of 18 in “read_index_from(): Skip verification of the cache entry order to speed index loading”
  1. read_index_from(): Skip verification of the cache entry order to speed index loadingBen Peart, Oct 18, 2017
  2. Junio C HamanoOct 19, 2017
  3. Ben PeartOct 19, 2017
  4. Jeff KingOct 19, 2017
  5. Junio C HamanoOct 20, 2017
  6. Stefan BellerOct 19, 2017
  7. Johannes SchindelinOct 20, 2017
  8. Stefan BellerOct 20, 2017
  9. Junio C HamanoOct 21, 2017
  10. read_index_from(): Skip verification of the cache entry order to speed index loadingBen Peart, Oct 24, 2017
  11. Ben PeartOct 30, 2017
  12. Jeff KingOct 30, 2017
  13. Alex VandiverOct 31, 2017
  14. Ben PeartOct 31, 2017
  15. Jeff KingOct 31, 2017
  16. Junio C HamanoNov 1, 2017
  17. Junio C HamanoOct 31, 2017
  18. Ben PeartOct 31, 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.