Re: [RFC/PATCH 0/8] Add configuration options for split-index
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jul 25, 2016, 16:04 UTC
- Message-ID
- <CACsJy8DRmcUzG+Uj65nqmyjbohbWq1Us4c7YkNkG15fjGijfEA@mail.gmail.com>
- In-Reply-To
- <CAP8UFD20WtCPLb3VzCJnYZSreUM7Q8GOC_VBG3h1j3wjOcR=_w@mail.gmail.com>
On Sat, Jul 23, 2016 at 6:11 PM, Christian Couder <christian.couder@gmail.com> wrote:
Show 12 quoted lines
> Ok, I started working on automatically pushing back all changes to the > shared index when the percentage of entries in linked vs shared > indexes is greater than 25% (maybe I will make it configurable later). > It is very basic and doesn't work well for now (for one thing it is > missing added entries), see: > > https://github.com/chriscool/git/commits/config-split-index8 > > Basically I would like a way to count then entries that are only in > the linked index without modifying them to be safe, but I have a hard > time seeing how I could modify prepare_to_write_split_index() to get > that.
Hmm.. can you do the counting separately? A shared cache_entry must have its field "index" greater than zero. By counting the number of entries whose index is zero (i.e. not shared) against the total number of real (*) entries, you should have a decent estimate when to split. Then you can do exactly what "git update-index --no-split-index" and "git update-index --split-index" sequence does, but in write_index(). It's easier than messing inside split-index.c. If we hit performance problem, then we can look into changing split-index.c
(*) remember that some entries may be marked CE_REMOVE, which are dead entries and should not be counted because they will never be written down on disk.
-- Duy