From bbddf3508e08929872c777f9824f64ec2811fea8 Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Fri, 21 Jun 2024 17:18:59 -0400 Subject: [PATCH 1/3] wt-status: add trace2 data for sparse-checkout percentage When sparse-checkout is enabled, add the sparse-checkout percentage to the Trace2 data stream. This number was already computed and printed on the console in the "You are in a sparse checkout..." message. It would be helpful to log it too for performance monitoring. Signed-off-by: Jeff Hostetler --- wt-status.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/wt-status.c b/wt-status.c index b98e4f69942711..9ebbe405b387a4 100644 --- a/wt-status.c +++ b/wt-status.c @@ -2560,6 +2560,36 @@ void wt_status_print(struct wt_status *s) s->untracked.nr); trace2_data_intmax("status", s->repo, "count/ignored", s->ignored.nr); + switch (s->state.sparse_checkout_percentage) { + case SPARSE_CHECKOUT_DISABLED: + break; + case SPARSE_CHECKOUT_SPARSE_INDEX: + /* + * Log just the observed size of the sparse-index. + * + * When sparse-index is enabled we can have + * sparse-directory entries in addition to individual + * sparse-file entries, so we don't know the complete + * size of the index. And we do not want to force + * expand it just to emit some telemetry data. So we + * cannot report a percentage for the space savings. + * + * It is possible that if the telemetry data is + * aggregated, someone will have a good estimate for + * the size of a fully populated index and can compute + * a percentage after the fact. + */ + trace2_data_intmax("status", s->repo, + "sparse-index/size", + s->repo->index->cache_nr); + break; + default: + trace2_data_intmax("status", s->repo, + "sparse-checkout/percentage", + s->state.sparse_checkout_percentage); + break; + } + trace2_region_enter("status", "print", s->repo); switch (s->status_format) { From 8ef482097b6b08c64c35051e468c0304200d1079 Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Mon, 24 Jun 2024 11:24:20 -0400 Subject: [PATCH 2/3] wt-status: add VFS hydration percentage to normal `git status` output Add VFS checkout hydration percentage information to the default `git status` output. When VFS is enable, users will now see a "You are in a partially-hydrated checkout with of tracked files present." message. Upstream `git status` normally prints a "You are in a sparse checkout with of tracked files present." This message was hidden in `microsoft/git` when `core_virtualfilesystem` is set (because GVFS users are always (and secretly) in a sparse checkout) and it was thought that it would annoy users. However, we now believe that it may be helpful for users to always see the percentage and know when they are over-hyrdated, since over-hyrdation can occur by accident and may greatly impact their Git performance. Knowing this value may help with GVFS support. Helped-by: Johannes Schindelin Signed-off-by: Jeff Hostetler --- t/t1093-virtualfilesystem.sh | 2 ++ wt-status.c | 13 +++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/t/t1093-virtualfilesystem.sh b/t/t1093-virtualfilesystem.sh index cad13d680cb199..7786735dffec06 100755 --- a/t/t1093-virtualfilesystem.sh +++ b/t/t1093-virtualfilesystem.sh @@ -69,6 +69,8 @@ test_expect_success 'verify status is clean' ' git status > actual && cat > expected <<-\EOF && On branch main + You are in a partially-hydrated checkout with 75% of tracked files present. + nothing to commit, working tree clean EOF test_cmp expected actual diff --git a/wt-status.c b/wt-status.c index 9ebbe405b387a4..df770ff648a324 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1604,10 +1604,15 @@ static void show_sparse_checkout_in_use(struct wt_status *s, { if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_DISABLED) return; - if (core_virtualfilesystem) - return; - - if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_SPARSE_INDEX) + if (core_virtualfilesystem) { + if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_SPARSE_INDEX) + status_printf_ln(s, color, + _("You are in a partially-hydrated checkout with a sparse index.")); + else + status_printf_ln(s, color, + _("You are in a partially-hydrated checkout with %d%% of tracked files present."), + s->state.sparse_checkout_percentage); + } else if (s->state.sparse_checkout_percentage == SPARSE_CHECKOUT_SPARSE_INDEX) status_printf_ln(s, color, _("You are in a sparse checkout.")); else status_printf_ln(s, color, From e77422382a161a1b19173ad349cb9535bbf72ae5 Mon Sep 17 00:00:00 2001 From: Jeff Hostetler Date: Mon, 24 Jun 2024 13:20:50 -0400 Subject: [PATCH 3/3] scalar-functional-tests.yml: update macos-11 to macos-13 Target `macos-11` is deprecated now and is in scheduled brownouts. Update to `macos-13`. Signed-off-by: Jeff Hostetler --- .github/workflows/scalar-functional-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scalar-functional-tests.yml b/.github/workflows/scalar-functional-tests.yml index 7226054aebbcec..da9f3a0d14bb2f 100644 --- a/.github/workflows/scalar-functional-tests.yml +++ b/.github/workflows/scalar-functional-tests.yml @@ -20,7 +20,7 @@ jobs: fail-fast: false matrix: # Order by runtime (in descending order) - os: [windows-2019, macos-11, ubuntu-20.04, ubuntu-22.04] + os: [windows-2019, macos-13, ubuntu-20.04, ubuntu-22.04] # Scalar.NET used to be tested using `features: [false, experimental]` # But currently, Scalar/C ignores `feature.scalar` altogether, so let's # save some electrons and run only one of them...