Skip to content

Commit

Permalink
refs/reftable: allow configuring geometric factor
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
pks-t authored and gitster committed May 14, 2024
1 parent f663d34 commit f518d91
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Documentation/config/reftable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
5 changes: 5 additions & 0 deletions refs/reftable-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f518d91

Please sign in to comment.