Skip to content

Commit f518d91

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f663d34 commit f518d91

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Documentation/config/reftable.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,13 @@ reftable.indexObjects::
3636
are a reverse mapping of object ID to the references pointing to them.
3737
+
3838
The default value is `true`.
39+
40+
reftable.geometricFactor::
41+
Whenever the reftable backend appends a new table to the stack, it
42+
performs auto compaction to ensure that there is only a handful of
43+
tables. The backend does this by ensuring that tables form a geometric
44+
sequence regarding the respective sizes of each table.
45+
+
46+
By default, the geometric sequence uses a factor of 2, meaning that for any
47+
table, the next-biggest table must at least be twice as big. A maximum factor
48+
of 256 is supported.

refs/reftable-backend.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ static int reftable_be_config(const char *var, const char *value,
247247
opts->restart_interval = restart_interval;
248248
} else if (!strcmp(var, "reftable.indexobjects")) {
249249
opts->skip_index_objects = !git_config_bool(var, value);
250+
} else if (!strcmp(var, "reftable.geometricfactor")) {
251+
unsigned long factor = git_config_ulong(var, value, ctx->kvi);
252+
if (factor > UINT8_MAX)
253+
die("reftable geometric factor cannot exceed %u", (unsigned)UINT8_MAX);
254+
opts->auto_compaction_factor = factor;
250255
}
251256

252257
return 0;

0 commit comments

Comments
 (0)