Skip to content

Commit c70e49f

Browse files
derrickstoleedscho
authored andcommitted
gvfs-helper: don't fallback with new config
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. Signed-off-by: Derrick Stolee <stolee@gmail.com>
1 parent 90b1c78 commit c70e49f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Diff for: Documentation/config/gvfs.txt

+5
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ gvfs.cache-server::
33

44
gvfs.sharedcache::
55
TODO
6+
7+
gvfs.fallback::
8+
If set to `false`, then never fallback to the origin server when the cache
9+
server fails to connect. This will alert users to failures with the cache
10+
server, but avoid causing throttling on the origin server.

Diff for: gvfs-helper-client.c

+10-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "quote.h"
1515
#include "packfile.h"
1616
#include "hex.h"
17+
#include "config.h"
1718

1819
static struct oidset gh_client__oidset_queued = OIDSET_INIT;
1920
static unsigned long gh_client__oidset_count;
@@ -340,17 +341,25 @@ static struct gh_server__process *gh_client__find_long_running_process(
340341
struct gh_server__process *entry;
341342
struct strvec argv = STRVEC_INIT;
342343
struct strbuf quoted = STRBUF_INIT;
344+
int fallback;
343345

344346
gh_client__choose_odb();
345347

346348
/*
347349
* TODO decide what defaults we want.
348350
*/
349351
strvec_push(&argv, "gvfs-helper");
350-
strvec_push(&argv, "--fallback");
351352
strvec_push(&argv, "--cache-server=trust");
352353
strvec_pushf(&argv, "--shared-cache=%s",
353354
gh_client__chosen_odb->path);
355+
356+
/* If gvfs.fallback=false, then don't add --fallback. */
357+
if (!git_config_get_bool("gvfs.fallback", &fallback) &&
358+
!fallback)
359+
strvec_push(&argv, "--no-fallback");
360+
else
361+
strvec_push(&argv, "--fallback");
362+
354363
strvec_push(&argv, "server");
355364

356365
sq_quote_argv_pretty(&quoted, argv.v);

0 commit comments

Comments
 (0)