Skip to content

Commit 8375b94

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 e976c4d commit 8375b94

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎Documentation/config/gvfs.adoc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ gvfs.cache-server::
55
gvfs.sharedcache::
66
When set, place all object data downloaded via the GVFS Protocol into
77
this Git alternate.
8+
9+
gvfs.fallback::
10+
If set to `false`, then never fallback to the origin server when the cache
11+
server fails to connect. This will alert users to failures with the cache
12+
server, but avoid causing throttling on the origin server.

‎gvfs-helper-client.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#define USE_THE_REPOSITORY_VARIABLE
22
#include "git-compat-util.h"
3+
#include "config.h"
34
#include "dir.h"
45
#include "environment.h"
56
#include "gvfs-helper-client.h"
@@ -313,17 +314,25 @@ static struct gh_server__process *gh_client__find_long_running_process(
313314
struct gh_server__process *entry;
314315
struct strvec argv = STRVEC_INIT;
315316
struct strbuf quoted = STRBUF_INIT;
317+
int fallback;
316318

317319
gh_client__choose_odb();
318320

319321
/*
320322
* TODO decide what defaults we want.
321323
*/
322324
strvec_push(&argv, "gvfs-helper");
323-
strvec_push(&argv, "--fallback");
324325
strvec_push(&argv, "--cache-server=trust");
325326
strvec_pushf(&argv, "--shared-cache=%s",
326327
gh_client__chosen_odb->path);
328+
329+
/* If gvfs.fallback=false, then don't add --fallback. */
330+
if (!repo_config_get_bool(the_repository, "gvfs.fallback", &fallback) &&
331+
!fallback)
332+
strvec_push(&argv, "--no-fallback");
333+
else
334+
strvec_push(&argv, "--fallback");
335+
327336
strvec_push(&argv, "server");
328337

329338
sq_quote_argv_pretty(&quoted, argv.v);

0 commit comments

Comments
 (0)