microsoft / git

A fork of Git containing Microsoft-specific patches.
http://git-scm.com/
Other
761 stars 92 forks source link

gvfs-helper: add gvfs.fallback and unit tests #665

Closed jeffhostetler closed 2 months ago

jeffhostetler commented 2 months ago

By default, GVFS Protocol-enabled Scalar clones will fall back to the origin server if there is a network issue with the cache servers. However (and especially for the prefetch endpoint) this may be a very expensive operation for the origin server, leading to the user being throttled. This shows up later in cases such as 'git push' or other web operations.

To avoid this, create a new config option, 'gvfs.fallback', which defaults to true. When set to 'false', pass '--no-fallback' from the gvfs-helper client to the child gvfs-helper server process.

This will allow users who have hit this problem to avoid it in the future. In case this becomes a more widespread problem, engineering systems can enable the config option more broadly.

Enabling the config will of course lead to immediate failures for users, but at least that will help diagnose the problem when it occurs instead of later when the throttling shows up and the server load has already passed, damage done.

This change only applies to interactions with Azure DevOps and the GVFS Protocol.


jeffhostetler commented 2 months ago

@derrickstolee I took your https://github.com/microsoft/git/pull/664 and added new unit tests. Hopefully, it all makes sense.

I debated putting the config lookup in gvfs-helper.exe, rather than in the client code, but decided that was more risk than I wanted (not that it was hard, but that it would change the historical default behavior, since gvfs-helper.exe does not have fallback turned on and only does it when requested, so it felt kinda backwards to move the decision at this point.)

dscho commented 2 months ago

@jeffhostetler thank you so much for taking the time to add the tests. This will be an invaluable source of documentation for future changes to the gvfs-helper. ❤️

jeffhostetler commented 2 months ago

I just added enhanced comments in-line in the test script and in the commit messages.

dscho commented 2 months ago

I just added enhanced comments in-line in the test script and in the commit messages.

Thank you!

Please ignore the test failure, this is my mistake.

dscho commented 2 months ago

Please ignore the test failure, this is my mistake.

@jeffhostetler actually, if I could get your review of https://github.com/microsoft/git/pull/666, that would be nice...