<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/reftable, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2026-04-02T17:45:44Z</updated>
<entry>
<title>reftable/system: add abstraction to mmap files</title>
<updated>2026-04-02T17:45:44Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-04-02T07:31:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=87e4eee3f94ec261a92a76d06261b227b00de461'/>
<id>urn:sha1:87e4eee3f94ec261a92a76d06261b227b00de461</id>
<content type='text'>
In our codebase we have a couple of wrappers around mmap(3p) that allow
us to reimplement the syscall on platforms that don't have it natively,
like for example Windows. Other projects that embed the reftable library
may have a different infra though to hook up mmap wrappers, but these
are currently hard to integrate.

Provide the infrastructure to let projects easily define the mmap
interface with a custom struct and custom functions.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable/system: add abstraction to retrieve time in milliseconds</title>
<updated>2026-04-02T17:45:43Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-04-02T07:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cb0882de1979522b2fc3dc4c3064b0ad21d50b06'/>
<id>urn:sha1:cb0882de1979522b2fc3dc4c3064b0ad21d50b06</id>
<content type='text'>
We directly call gettimeofday(3p), which may not be available on some
platforms. Provide the infrastructure to let projects easily use their
own implementations of this function.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable/fsck: use REFTABLE_UNUSED instead of UNUSED</title>
<updated>2026-04-02T17:45:43Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-04-02T07:31:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa8938573050e6ab44a46e3b9f26c0e442f835aa'/>
<id>urn:sha1:aa8938573050e6ab44a46e3b9f26c0e442f835aa</id>
<content type='text'>
While we have the reftable-specific `REFTABLE_UNUSED` header, we
accidentally introduced a new usage of the Git-specific `UNUSED` header
into the reftable library in 9051638519 (reftable: add code to
facilitate consistency checks, 2025-10-07).

Convert the site to use `REFTABLE_UNUSED`.

Ideally, we'd move the definition of `UNUSED` into "git-compat-util.h"
so that it becomes in accessible to the reftable library. But this is
unfortunately not easily possible as "compat/mingw-posix.h" requires
this macro, and this header is included by "compat/posix.h".

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable/stack: provide fsync(3p) via system header</title>
<updated>2026-04-02T17:45:43Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-04-02T07:31:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b45ea595e6f6b03a749abc2c8e508504429a4cf3'/>
<id>urn:sha1:b45ea595e6f6b03a749abc2c8e508504429a4cf3</id>
<content type='text'>
Users of the reftable library are expected to provide their own function
callback in cases they want to sync(3p) data to disk via the reftable
write options. But if no such function was provided we end up calling
fsync(3p) directly, which may not even be available on some systems.

While dropping the explicit call to fsync(3p) would work, it would lead
to an unsafe default behaviour where a project may have forgotten to set
up the callback function, and that could lead to potential data loss. So
this is not a great solution.

Instead, drop the callback function and make it mandatory for the
project to define fsync(3p). In the case of Git, we can then easily
inject our custom implementation via the "reftable-system.h" header so
that we continue to use `fsync_component()`.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable: introduce "reftable-system.h" header</title>
<updated>2026-04-02T17:45:43Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-04-02T07:31:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=34c17b840d5bdb8060ef6309aee04f919616c9de'/>
<id>urn:sha1:34c17b840d5bdb8060ef6309aee04f919616c9de</id>
<content type='text'>
We're including a couple of standard headers like &lt;stdint.h&gt; in a bunch
of locations, which makes it hard for a project to plug in their own
logic for making required functionality available. For us this is for
example via "compat/posix.h", which already includes all of the system
headers relevant to us.

Introduce a new "reftable-system.h" header that allows projects to
provide their own headers. This new header is supposed to contain all
the project-specific bits to provide the POSIX-like environment, and some
additional supporting code. With this change, we thus have the following
split in our system-specific code:

  - "reftable/reftable-system.h" is the project-specific header that
    provides a POSIX-like environment. Every project is expected to
    provide their own implementation.

  - "reftable/system.h" contains the project-independent definition of
    the interfaces that a project needs to implement. This file should
    not be touched by a project.

  - "reftable/system.c" contains the project-specific implementation of
    the interfaces defined in "system.h". Again, every project is
    expected to provide their own implementation.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable/stack: add function to check if optimization is required</title>
<updated>2025-11-10T17:28:47Z</updated>
<author>
<name>Karthik Nayak</name>
<email>karthik.188@gmail.com</email>
</author>
<published>2025-11-08T21:51:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e35155588aa9f0355eb7e116ea418c189479f62d'/>
<id>urn:sha1:e35155588aa9f0355eb7e116ea418c189479f62d</id>
<content type='text'>
The reftable backend performs auto-compaction as part of its regular
flow, which is required to keep the number of tables part of a stack at
bay. This allows it to stay optimized.

Compaction can also be triggered voluntarily by the user via the 'git
pack-refs' or the 'git refs optimize' command. However, currently there
is no way for the user to check if optimization is required without
actually performing it.

Extract out the heuristics logic from 'reftable_stack_auto_compact()'
into an internal function 'update_segment_if_compaction_required()'.
Then use this to add and expose `reftable_stack_compaction_required()`
which will allow users to check if the reftable backend can be
optimized.

Signed-off-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Acked-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable/stack: return stack segments directly</title>
<updated>2025-11-10T17:28:47Z</updated>
<author>
<name>Karthik Nayak</name>
<email>karthik.188@gmail.com</email>
</author>
<published>2025-11-08T21:51:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=135f491f83d4763bdc61642eb0126ce2e6ada286'/>
<id>urn:sha1:135f491f83d4763bdc61642eb0126ce2e6ada286</id>
<content type='text'>
The `stack_table_sizes_for_compaction()` function returns individual
sizes of each reftable table. This function is only called by
`reftable_stack_auto_compact()` to decide which tables need to be
compacted, if any.

Modify the function to directly return the segments, which avoids the
extra step of receiving the sizes only to pass it to
`suggest_compaction_segment()`.

A future commit will also add functionality for checking whether
auto-compaction is necessary without performing it. This change allows
code re-usability in that context.

Signed-off-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Acked-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'kn/reftable-consistency-checks'</title>
<updated>2025-10-14T05:00:35Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2025-10-14T05:00:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f50f046794a06cfb97c4ccc879b08788629dd067'/>
<id>urn:sha1:f50f046794a06cfb97c4ccc879b08788629dd067</id>
<content type='text'>
The reftable backend learned to sanity check its on-disk data more
carefully.

* kn/reftable-consistency-checks:
  refs/reftable: add fsck check for checking the table name
  reftable: add code to facilitate consistency checks
  fsck: order 'fsck_msg_type' alphabetically
  Documentation/fsck-msgids: remove duplicate msg id
  reftable: check for trailing newline in 'tables.list'
  refs: move consistency check msg to generic layer
  refs: remove unused headers
</content>
</entry>
<entry>
<title>reftable: add code to facilitate consistency checks</title>
<updated>2025-10-07T16:22:58Z</updated>
<author>
<name>Karthik Nayak</name>
<email>karthik.188@gmail.com</email>
</author>
<published>2025-10-07T12:11:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9051638519e7f9d52ce87d1baa88b35141f073aa'/>
<id>urn:sha1:9051638519e7f9d52ce87d1baa88b35141f073aa</id>
<content type='text'>
The `git refs verify` command is used to run consistency checks on the
reference backends. This command is also invoked when users run 'git
fsck'. While the files-backend has some fsck checks added, the reftable
backend lacks such checks. Let's add the required infrastructure and a
check to test for the files present in the reftable directory.

Since the reftable library is treated as an independent library we
should ensure that the library code works independently without
knowledge about Git's internals. To do this, add both 'reftable/fsck.c'
and 'reftable/reftable-fsck.h'. Which provide an entry point
'reftable_fsck_check' for running fsck checks over a provided reftable
stack. The callee provides the function with callbacks to handle issue
and information reporting.

The added check, goes over all tables in the reftable stack validates
that they have a valid name. It not, it raises an error.

While here, move 'reftable/error.o' in the Makefile to retain
lexicographic ordering.

Signed-off-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reftable: check for trailing newline in 'tables.list'</title>
<updated>2025-10-07T16:22:57Z</updated>
<author>
<name>Karthik Nayak</name>
<email>karthik.188@gmail.com</email>
</author>
<published>2025-10-07T12:11:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f6442063775b68d9eeaeb9088379fba3298c80ac'/>
<id>urn:sha1:f6442063775b68d9eeaeb9088379fba3298c80ac</id>
<content type='text'>
In the reftable format, the 'tables.list' file contains a
newline separated list of tables. While we parse this file, we do not
check or care about the last newline. Tighten the parser in
`parse_names()` to return an appropriate error if the last newline is
missing.

This requires modification to `parse_names()` to now return the error
while accepting the output as a third argument.

Signed-off-by: Karthik Nayak &lt;karthik.188@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
