Thread (2 messages) 2 messages, 2 authors, 2025-11-03

Re: [PATCH 2/5] reftable/stack: add function to check if optimization is required

From: Karthik Nayak <hidden>
Date: 2025-11-03 16:20:12

Junio C Hamano [off-list ref] writes:
Justin Tobler [off-list ref] writes:
quoted
quoted
+	err = stack_segments_for_compaction(st, &seg);
+	if (err)
+		return err;
+
+	*required = segment_size(&seg) > 0;
As mentioned on the previous patch, I wonder if we could just return the
number of tables in the compaction segment as part of
`stack_segments_for_compaction()`. A negative value could indicate an
error. All other values would reflect the number of tables to be
compacted.

This way callers interested in whether compaction should be performed
could just do: stack_segments_for_compaction > 0. We could maybe avoid
having a separate function like we do here and just expose
`stack_segments_for_compaction()`.
Is the cost of compacting a single table expected to be roughly the
same across tables?  The number of tables to be compacted would not
be a useful information to help making a better decision otherwise,
so I am guessing that it is the underlying assumption the above
suggestion comes from.
It would be sufficient information to know whether or not we can
compact. But only when in 'git refs optimize --auto' mode.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help