<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/reftable/reftable-stack.h, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-04-02T17:45:43Z</updated>
<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='http://git.kilabit.info/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='http://git.kilabit.info/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: allow passing flags to `reftable_stack_add()`</title>
<updated>2025-08-12T14:40:59Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-08-12T09:54:19Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=178c5885007b83dd10cac1e09b72ef8d9fe2ac29'/>
<id>urn:sha1:178c5885007b83dd10cac1e09b72ef8d9fe2ac29</id>
<content type='text'>
The `reftable_stack_add()` function is a simple wrapper to lock the
stack, add records to it via a callback and then commit the
result. One problem with it though is that it doesn't accept any flags
for creating the addition. This makes it impossible to automatically
reload the stack in case it was modified before we managed to lock the
stack.

Add a `flags` field to plug this gap and pass it through accordingly.
For now this new flag won't be used by us, but it will be used by
libgit2.

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: fix formatting of the license header</title>
<updated>2025-04-07T21:53:09Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2025-04-07T13:16:13Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=6dcc05ffc3ead0745d19decd0e8ecd65edc9d414'/>
<id>urn:sha1:6dcc05ffc3ead0745d19decd0e8ecd65edc9d414</id>
<content type='text'>
The license headers used across the reftable library doesn't follow our
typical coding style for multi-line comments. Fix it.

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 accessor for the hash ID</title>
<updated>2024-11-26T08:18:36Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-11-26T06:42:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=c9f76fc7d197d9ed2624400d5fc34d6ab53b7a22'/>
<id>urn:sha1:c9f76fc7d197d9ed2624400d5fc34d6ab53b7a22</id>
<content type='text'>
Add an accessor function that allows callers to access the hash ID of a
reftable stack. This function will be used in a subsequent commit.

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>Merge branch 'ps/reftable-alloc-failures'</title>
<updated>2024-10-10T21:22:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-10-10T21:22:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=5575c713c2a398f4723c544fb732c44b8e1d5e45'/>
<id>urn:sha1:5575c713c2a398f4723c544fb732c44b8e1d5e45</id>
<content type='text'>
The reftable library is now prepared to expect that the memory
allocation function given to it may fail to allocate and to deal
with such an error.

* ps/reftable-alloc-failures: (26 commits)
  reftable/basics: fix segfault when growing `names` array fails
  reftable/basics: ban standard allocator functions
  reftable: introduce `REFTABLE_FREE_AND_NULL()`
  reftable: fix calls to free(3P)
  reftable: handle trivial allocation failures
  reftable/tree: handle allocation failures
  reftable/pq: handle allocation failures when adding entries
  reftable/block: handle allocation failures
  reftable/blocksource: handle allocation failures
  reftable/iter: handle allocation failures when creating indexed table iter
  reftable/stack: handle allocation failures in auto compaction
  reftable/stack: handle allocation failures in `stack_compact_range()`
  reftable/stack: handle allocation failures in `reftable_new_stack()`
  reftable/stack: handle allocation failures on reload
  reftable/reader: handle allocation failures in `reader_init_iter()`
  reftable/reader: handle allocation failures for unindexed reader
  reftable/merged: handle allocation failures in `merged_table_init_iter()`
  reftable/writer: handle allocation failures in `reftable_new_writer()`
  reftable/writer: handle allocation failures in `writer_index_hash()`
  reftable/record: handle allocation failures when decoding records
  ...
</content>
</entry>
<entry>
<title>reftable/merged: handle allocation failures in `merged_table_init_iter()`</title>
<updated>2024-10-02T14:53:53Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-10-02T10:55:54Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=802c0646ac3c04a16adafde5e7cf899f5fc46821'/>
<id>urn:sha1:802c0646ac3c04a16adafde5e7cf899f5fc46821</id>
<content type='text'>
Handle allocation failures in `merged_table_init_iter()`. While at it,
merge `merged_iter_init()` into the function. It only has a single
caller and merging them makes it easier to handle allocation failures
consistently.

This change also requires us to adapt `reftable_stack_init_*_iterator()`
to bubble up the new error codes of `merged_table_iter_init()`. Adapt
callsites accordingly.

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: allow locking of outdated stacks</title>
<updated>2024-09-24T16:45:25Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-09-24T05:33:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=80e7342ea8ecda48bdf034e77c32ac1c5d2bda85'/>
<id>urn:sha1:80e7342ea8ecda48bdf034e77c32ac1c5d2bda85</id>
<content type='text'>
In `reftable_stack_new_addition()` we first lock the stack and then
check whether it is still up-to-date. If it is not we return an error to
the caller indicating that the stack is outdated.

This is overly restrictive in our ref transaction interface though: we
lock the stack right before we start to verify the transaction, so we do
not really care whether it is outdated or not. What we really want is
that the stack is up-to-date after it has been locked so that we can
verify queued updates against its current state while we know that it is
locked for concurrent modification.

Introduce a new flag `REFTABLE_STACK_NEW_ADDITION_RELOAD` that alters
the behaviour of `reftable_stack_init_addition()` in this case: when we
notice that it is out-of-date we reload it instead of returning an error
to the caller.

This logic will be wired up in the reftable backend in the next commit.

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>t/helper: inline `reftable_stack_print_directory()`</title>
<updated>2024-08-22T14:59:47Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-08-22T06:35:12Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=ca74ef6ffb7388d862379d5016282340aff1f68b'/>
<id>urn:sha1:ca74ef6ffb7388d862379d5016282340aff1f68b</id>
<content type='text'>
Move `reftable_stack_print_directory()` into the "dump-reftable" helper.
This follows the same reasoning as the preceding commit.

Note that this requires us to remove the tests for this functionality in
`reftable/stack_test.c`. The test does not really add much anyway,
because all it verifies is that we do not crash or run into an error,
and it specifically doesn't check the outputted data. Also, as the code
is now part of the test helper, it doesn't make much sense to have a
unit test for it in the first place.

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>Merge branch 'ps/reftable-reusable-iterator'</title>
<updated>2024-05-30T21:15:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-05-30T21:15:12Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=67ce50ba26507e99c53dcd4b1d85ad8565a31c23'/>
<id>urn:sha1:67ce50ba26507e99c53dcd4b1d85ad8565a31c23</id>
<content type='text'>
Code clean-up to make the reftable iterator closer to be reusable.

* ps/reftable-reusable-iterator:
  reftable/merged: adapt interface to allow reuse of iterators
  reftable/stack: provide convenience functions to create iterators
  reftable/reader: adapt interface to allow reuse of iterators
  reftable/generic: adapt interface to allow reuse of iterators
  reftable/generic: move seeking of records into the iterator
  reftable/merged: simplify indices for subiterators
  reftable/merged: split up initialization and seeking of records
  reftable/reader: set up the reader when initializing table iterator
  reftable/reader: inline `reader_seek_internal()`
  reftable/reader: separate concerns of table iter and reftable reader
  reftable/reader: unify indexed and linear seeking
  reftable/reader: avoid copying index iterator
  reftable/block: use `size_t` to track restart point index
</content>
</entry>
</feed>
