Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: how to ensure untracked cache triggers #363

Closed
derrickstolee opened this issue Apr 7, 2020 · 11 comments
Closed

macOS: how to ensure untracked cache triggers #363

derrickstolee opened this issue Apr 7, 2020 · 11 comments
Assignees
Labels
no-activity Stale issue or PR that will be automatically closed soon. performance platform:mac Affects Mac only

Comments

@derrickstolee
Copy link
Contributor

I was doing some performance tests on macOS and my git status times were slower than expected. It turns out that the untracked cache was not kicking in. A git reset --hard followed by a (slow) git status triggered the untracked cache and following git status commands were very fast.

How can we help ensure the untracked cache is up-to-date? Should we run things in the background?

@derrickstolee derrickstolee self-assigned this Apr 7, 2020
@github-actions github-actions bot added the no-activity Stale issue or PR that will be automatically closed soon. label Jul 6, 2020
@derrickstolee derrickstolee removed the no-activity Stale issue or PR that will be automatically closed soon. label Jul 6, 2020
@microsoft microsoft deleted a comment from github-actions bot Jul 6, 2020
@github-actions
Copy link

github-actions bot commented Oct 4, 2020

Labeling this issue as stale. There has been no activity for 30 days. Remove stale label or comment or this issue will be closed in 7 days.

@github-actions github-actions bot added the no-activity Stale issue or PR that will be automatically closed soon. label Oct 4, 2020
@derrickstolee derrickstolee removed the no-activity Stale issue or PR that will be automatically closed soon. label Oct 5, 2020
@derrickstolee
Copy link
Contributor Author

Thanks for reminding me!

@github-actions
Copy link

github-actions bot commented Jan 3, 2021

Labeling this issue as stale. There has been no activity for 30 days. Remove stale label or comment or this issue will be closed in 7 days.

@github-actions github-actions bot added the no-activity Stale issue or PR that will be automatically closed soon. label Jan 3, 2021
@derrickstolee
Copy link
Contributor Author

@jeffhostetler: does this seem FSMonitor adjacent to you? It might be something you know how to handle.

@jeffhostetler jeffhostetler removed the no-activity Stale issue or PR that will be automatically closed soon. label Jan 4, 2021
@jeffhostetler
Copy link
Contributor

Let me take a look. I know there were some untracked-cache changes in 2.30 in this area, but I haven't studied them.

@jeffhostetler jeffhostetler self-assigned this Jan 4, 2021
@github-actions
Copy link

github-actions bot commented Apr 4, 2021

Labeling this issue as stale. There has been no activity for 30 days. Remove stale label or comment or this issue will be closed in 7 days.

@github-actions github-actions bot added the no-activity Stale issue or PR that will be automatically closed soon. label Apr 4, 2021
@jeffhostetler jeffhostetler removed the no-activity Stale issue or PR that will be automatically closed soon. label Apr 6, 2021
@TaoK
Copy link

TaoK commented Jun 24, 2021

Fwiw, this sounds like it could be related to the reproduction steps described at https://lore.kernel.org/git/CAPMMpogjr43111HfPzk23c98JBaiEF2YA_OTkQVG1a63zyeiOw@mail.gmail.com/ - I have encountered the same symptoms when doing manual performance testing.

I just retested, and I get this behavior (if an empty untracked cache is written to the index file, then the untracked cache "doesn't work" until something else causes an index file write) with or without fsmonitor enabled.

I tried correcting this by avoiding writing an empty untracked cache into the index file altogether (in read-cache.c#do_write_index(), where we check "istate->untracked", add an extra check on "istate->untracked->root"), because it was not clear to me when or why doing so would make sense, but that rapidly fell afoul of a bunch of test cases in t7063. Fundamentally, when you do "git update-index --untracked-cache" the tests expect to get precisely that - an empty untracked cache written into the index file, even though this should not happen in "natural" usage.

@derrickstolee seems to suggest here that this could be a "gradual creep" problem that might benefit from background maintenance; given that in real usage index files get regularly rewritten anyway, is it not more likely that these symptoms were from an "unlucky" sequence of events involving an index file with an empty untracked cache?

If so, isn't the right approach either to disallow having an empty cache in the file altogether, or to recognize "I just ended up doing all the same work as if the untracked cache had been completely absent" as a situation where "I should probably write my updated index file" (in git, rather than scalar)?

@TaoK
Copy link

TaoK commented Jun 24, 2021

Insofar as this "empty but present untracked cache causes same performance as no untracked cache" issue might be what @derrickstolee encountered above, I should mention I've now submitted a patch for this: https://lore.kernel.org/git/pull.986.git.1624559401.gitgitgadget@gmail.com/

@derrickstolee
Copy link
Contributor Author

@TaoK: thank you for your interest in this topic! We will take a close look at your upstream submission.

@github-actions
Copy link

Labeling this issue as stale. There has been no activity for 30 days. Remove stale label or comment or this issue will be closed in 7 days.

@github-actions github-actions bot added the no-activity Stale issue or PR that will be automatically closed soon. label Sep 23, 2021
@derrickstolee
Copy link
Contributor Author

This was fixed by microsoft/git#415.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-activity Stale issue or PR that will be automatically closed soon. performance platform:mac Affects Mac only
Projects
None yet
Development

No branches or pull requests

3 participants