diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-05-13 10:18:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-05-13 17:02:39 -0700 |
commit | f518d91a2b6465c9951f4ee1ab316ee81894000c (patch) | |
tree | 507ec792a9a9f0efc77d51c43c35ac85f9c54b5e | |
parent | f663d34306d414bca27cf6b5dc7affb00e8603fe (diff) | |
download | git-f518d91a2b6465c9951f4ee1ab316ee81894000c.tar.gz |
refs/reftable: allow configuring geometric factor
Allow configuring the geometric factor used by the auto-compaction
algorithm whenever a new table is appended to the stack of tables.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Documentation/config/reftable.txt | 10 | ||||
-rw-r--r-- | refs/reftable-backend.c | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/config/reftable.txt b/Documentation/config/reftable.txt index 68083876fa..0515727977 100644 --- a/Documentation/config/reftable.txt +++ b/Documentation/config/reftable.txt @@ -36,3 +36,13 @@ reftable.indexObjects:: are a reverse mapping of object ID to the references pointing to them. + The default value is `true`. + +reftable.geometricFactor:: + Whenever the reftable backend appends a new table to the stack, it + performs auto compaction to ensure that there is only a handful of + tables. The backend does this by ensuring that tables form a geometric + sequence regarding the respective sizes of each table. ++ +By default, the geometric sequence uses a factor of 2, meaning that for any +table, the next-biggest table must at least be twice as big. A maximum factor +of 256 is supported. diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c index 5ffb36770a..da620fd598 100644 --- a/refs/reftable-backend.c +++ b/refs/reftable-backend.c @@ -247,6 +247,11 @@ static int reftable_be_config(const char *var, const char *value, opts->restart_interval = restart_interval; } else if (!strcmp(var, "reftable.indexobjects")) { opts->skip_index_objects = !git_config_bool(var, value); + } else if (!strcmp(var, "reftable.geometricfactor")) { + unsigned long factor = git_config_ulong(var, value, ctx->kvi); + if (factor > UINT8_MAX) + die("reftable geometric factor cannot exceed %u", (unsigned)UINT8_MAX); + opts->auto_compaction_factor = factor; } return 0; |