git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Justin Tobler via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Karthik Nayak <karthik.188@gmail.com>,
	Han-Wen Nienhuys <hanwenn@gmail.com>,
	Justin Tobler <jltobler@gmail.com>
Subject: Re: [PATCH v5 2/3] reftable/stack: add env to disable autocompaction
Date: Mon, 8 Apr 2024 08:12:43 +0200	[thread overview]
Message-ID: <ZhOK262a5WCxS9MN@tanuki> (raw)
In-Reply-To: <7c4fe0e9ec597203ee37d2c2503be319e87ff5ee.1712255369.git.gitgitgadget@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2726 bytes --]

On Thu, Apr 04, 2024 at 06:29:28PM +0000, Justin Tobler via GitGitGadget wrote:
> From: Justin Tobler <jltobler@gmail.com>
> 
> In future tests it will be neccesary to create repositories with a set
> number of tables. To make this easier, introduce the
> `GIT_TEST_REFTABLE_AUTOCOMPACTION` environment variable that, when set
> to false, disables autocompaction of reftables.
> 
> Signed-off-by: Justin Tobler <jltobler@gmail.com>
> ---
>  refs/reftable-backend.c    |  4 ++++
>  t/t0610-reftable-basics.sh | 21 +++++++++++++++++++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
> index 0bed6d2ab48..6b6191f89dd 100644
> --- a/refs/reftable-backend.c
> +++ b/refs/reftable-backend.c
> @@ -18,6 +18,7 @@
>  #include "../reftable/reftable-merged.h"
>  #include "../setup.h"
>  #include "../strmap.h"
> +#include "parse.h"
>  #include "refs-internal.h"
>  
>  /*
> @@ -248,6 +249,9 @@ static struct ref_store *reftable_be_init(struct repository *repo,
>  	refs->write_options.hash_id = repo->hash_algo->format_id;
>  	refs->write_options.default_permissions = calc_shared_perm(0666 & ~mask);
>  
> +	if (!git_env_bool("GIT_TEST_REFTABLE_AUTOCOMPACTION", 1))
> +		refs->write_options.disable_auto_compact = 1;
> +

This could be simplified to:

    ```
    refs->write_options.disable_auto_compact =
            !git_env_bool("GIT_TEST_REFTABLE_AUTOCOMPACTION", 1);
    ```

Patrick

>  	/*
>  	 * Set up the main reftable stack that is hosted in GIT_COMMON_DIR.
>  	 * This stack contains both the shared and the main worktree refs.
> diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
> index 931d888bbbc..c9e10b34684 100755
> --- a/t/t0610-reftable-basics.sh
> +++ b/t/t0610-reftable-basics.sh
> @@ -299,6 +299,27 @@ test_expect_success 'ref transaction: writes cause auto-compaction' '
>  	test_line_count = 1 repo/.git/reftable/tables.list
>  '
>  
> +test_expect_success 'ref transaction: env var disables compaction' '
> +	test_when_finished "rm -rf repo" &&
> +
> +	git init repo &&
> +	test_commit -C repo A &&
> +
> +	start=$(wc -l <repo/.git/reftable/tables.list) &&
> +	iterations=5 &&
> +	expected=$((start + iterations)) &&
> +
> +	for i in $(test_seq $iterations)
> +	do
> +		GIT_TEST_REFTABLE_AUTOCOMPACTION=false \
> +		git -C repo update-ref branch-$i HEAD || return 1
> +	done &&
> +	test_line_count = $expected repo/.git/reftable/tables.list &&
> +
> +	git -C repo update-ref foo HEAD &&
> +	test_line_count -lt $expected repo/.git/reftable/tables.list
> +'
> +
>  check_fsync_events () {
>  	local trace="$1" &&
>  	shift &&
> -- 
> gitgitgadget
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-04-08  6:13 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 20:03 [PATCH] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-03-06 12:30 ` Patrick Steinhardt
2024-03-06 12:37 ` Patrick Steinhardt
2024-03-21 22:48   ` Justin Tobler
2024-03-21 22:40 ` [PATCH v2 0/3] " Justin Tobler via GitGitGadget
2024-03-21 22:40   ` [PATCH v2 1/3] reftable/stack: add env to disable autocompaction Justin Tobler via GitGitGadget
2024-03-22  1:25     ` Patrick Steinhardt
2024-03-21 22:40   ` [PATCH v2 2/3] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-03-22  1:25     ` Patrick Steinhardt
2024-03-27 13:24     ` Karthik Nayak
2024-03-21 22:40   ` [PATCH v2 3/3] reftable/segment: make segment end inclusive Justin Tobler via GitGitGadget
2024-03-22  1:25   ` [PATCH v2 0/3] reftable/stack: use geometric table compaction Patrick Steinhardt
2024-04-03 10:13     ` Han-Wen Nienhuys
2024-04-03 10:18       ` Patrick Steinhardt
2024-04-03 15:14         ` Justin Tobler
2024-04-03 16:40         ` Junio C Hamano
2024-03-29  4:16   ` [PATCH v3 " Justin Tobler via GitGitGadget
2024-03-29  4:16     ` [PATCH v3 1/3] reftable/stack: add env to disable autocompaction Justin Tobler via GitGitGadget
2024-03-29 18:25       ` Junio C Hamano
2024-03-29 21:56       ` Junio C Hamano
2024-04-02  7:23       ` Patrick Steinhardt
2024-04-02 17:23         ` Junio C Hamano
2024-03-29  4:16     ` [PATCH v3 2/3] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-04-02  7:23       ` Patrick Steinhardt
2024-03-29  4:16     ` [PATCH v3 3/3] reftable/stack: make segment end inclusive Justin Tobler via GitGitGadget
2024-03-29 18:36       ` Junio C Hamano
2024-04-02  7:23         ` Patrick Steinhardt
2024-04-03  0:20     ` [PATCH v4 0/2] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-04-03  0:20       ` [PATCH v4 1/2] reftable/stack: add env to disable autocompaction Justin Tobler via GitGitGadget
2024-04-03  0:20       ` [PATCH v4 2/2] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-04-03  4:47       ` [PATCH v4 0/2] " Patrick Steinhardt
2024-04-03 11:12       ` Karthik Nayak
2024-04-03 16:56         ` Junio C Hamano
2024-04-04 18:29       ` [PATCH v5 0/3] " Justin Tobler via GitGitGadget
2024-04-04 18:29         ` [PATCH v5 1/3] reftable/stack: allow disabling of auto-compaction Justin Tobler via GitGitGadget
2024-04-08  6:12           ` Patrick Steinhardt
2024-04-04 18:29         ` [PATCH v5 2/3] reftable/stack: add env to disable autocompaction Justin Tobler via GitGitGadget
2024-04-08  6:12           ` Patrick Steinhardt [this message]
2024-04-08 16:18             ` Junio C Hamano
2024-04-04 18:29         ` [PATCH v5 3/3] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-04-08  6:12         ` [PATCH v5 0/3] " Patrick Steinhardt
2024-04-08 16:17           ` Justin Tobler
2024-04-08 16:16         ` [PATCH v6 " Justin Tobler via GitGitGadget
2024-04-08 16:16           ` [PATCH v6 1/3] reftable/stack: expose option to disable auto-compaction Justin Tobler via GitGitGadget
2024-04-08 16:16           ` [PATCH v6 2/3] reftable/stack: add env to disable autocompaction Justin Tobler via GitGitGadget
2024-04-08 16:16           ` [PATCH v6 3/3] reftable/stack: use geometric table compaction Justin Tobler via GitGitGadget
2024-04-08 16:20           ` [PATCH v6 0/3] " Patrick Steinhardt
2024-04-08 19:12             ` Junio C Hamano
2024-04-03 19:12   ` [PATCH v2 " Junio C Hamano
2024-04-03 19:30     ` Patrick Steinhardt
2024-04-04  5:34       ` Patrick Steinhardt
2024-04-04 18:28         ` Justin Tobler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZhOK262a5WCxS9MN@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=hanwenn@gmail.com \
    --cc=jltobler@gmail.com \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).