<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs, branch v2.45.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.45.3</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.45.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-04-08T19:11:10Z</updated>
<entry>
<title>reftable/stack: add env to disable autocompaction</title>
<updated>2024-04-08T19:11:10Z</updated>
<author>
<name>Justin Tobler</name>
<email>jltobler@gmail.com</email>
</author>
<published>2024-04-08T16:16:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c8eb5928f3ae504f9ce92b67a1eb41db82d81f7'/>
<id>urn:sha1:7c8eb5928f3ae504f9ce92b67a1eb41db82d81f7</id>
<content type='text'>
In future tests it will be neccesary to create repositories with a set
number of tables. To make this easier, introduce the
`GIT_TEST_REFTABLE_AUTOCOMPACTION` environment variable that, when set
to false, disables autocompaction of reftables.

Signed-off-by: Justin Tobler &lt;jltobler@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 'ps/pack-refs-auto' into jt/reftable-geometric-compaction</title>
<updated>2024-04-05T17:34:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-04-05T17:34:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7424fb779752c77f68d1cc793cd5c6cc3cc60971'/>
<id>urn:sha1:7424fb779752c77f68d1cc793cd5c6cc3cc60971</id>
<content type='text'>
* ps/pack-refs-auto:
  builtin/gc: pack refs when using `git maintenance run --auto`
  builtin/gc: forward git-gc(1)'s `--auto` flag when packing refs
  t6500: extract objects with "17" prefix
  builtin/gc: move `struct maintenance_run_opts`
  builtin/pack-refs: introduce new "--auto" flag
  builtin/pack-refs: release allocated memory
  refs/reftable: expose auto compaction via new flag
  refs: remove `PACK_REFS_ALL` flag
  refs: move `struct pack_refs_opts` to where it's used
  t/helper: drop pack-refs wrapper
  refs/reftable: print errors on compaction failure
  reftable/stack: gracefully handle failed auto-compaction due to locks
  reftable/stack: use error codes when locking fails during compaction
  reftable/error: discern locked/outdated errors
  reftable/stack: fix error handling in `reftable_stack_init_addition()`
</content>
</entry>
<entry>
<title>refs/reftable: expose auto compaction via new flag</title>
<updated>2024-03-25T16:54:07Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-03-25T10:03:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f89356db4a26eef47aceb2d03039fff6b1a4180d'/>
<id>urn:sha1:f89356db4a26eef47aceb2d03039fff6b1a4180d</id>
<content type='text'>
Under normal circumstances, the "reftable" backend will automatically
perform compaction after appending to the stack. It is thus not
necessary and may even be considered wasteful to run git-pack-refs(1) in
"reftable"-backed repositories as it will cause the backend to compact
all tables into a single one. We do exactly that though when running
`git maintenance run --auto` or `git gc --auto`, which gets spawned by
Git after running some specific commands.

The `--auto` mode is typically only executing optimizations as needed.
To do so, we already use several heuristics for the various different
data structures in Git to determine whether to optimize them or not.
We do not use any heuristics for refs though and instead always optimize
them.

Introduce a new `PACK_REFS_AUTO` flag that can be passed to the backend.
When not handled by the backend we will continue to behave the exact
same as we do right now, that is we optimize refs unconditionally. This
is done for the "files" backend for now to retain current behaviour,
even though we may eventually also want to introduce heuristics here.
For the "reftable" backend though we already do have auto-compaction, so
we can easily reuse that logic to implement the new auto-packing flag.

Note that under normal circumstances, this should always end up being a
no-op. After all, we already invoke the code for every single addition
to the stack. But there are special cases where it can still be helpful
to execute the auto-compaction code explicitly:

  - Concurrent writers may cause compaction to not run due to locks.

  - Callers may decide to disable compaction altogether and then pack
    refs at a later point due to various reasons.

  - Other implementations of the reftable format may do compaction
    differently or even not at all.

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>refs/reftable: print errors on compaction failure</title>
<updated>2024-03-25T16:54:07Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-03-25T10:02:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4ccf7060d8d0a3c08d1fb03b038a164eb4913d02'/>
<id>urn:sha1:4ccf7060d8d0a3c08d1fb03b038a164eb4913d02</id>
<content type='text'>
When git-pack-refs(1) fails in the reftable backend we end up printing
no error message at all, leaving the caller puzzled as to why compaction
has failed. Fix this.

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-reflog-iteration-perf'</title>
<updated>2024-03-21T21:55:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-21T21:55:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e8c1cda9a952d4ffce87976ef72f5ad6cc71c519'/>
<id>urn:sha1:e8c1cda9a952d4ffce87976ef72f5ad6cc71c519</id>
<content type='text'>
The code to iterate over reflogs in the reftable has been optimized
to reduce memory allocation and deallocation.

Reviewed-by: Josh Steadmon &lt;steadmon@google.com&gt;
cf. &lt;Ze9eX-aaWoVaqsPP@google.com&gt;

* ps/reftable-reflog-iteration-perf:
  refs/reftable: track last log record name via strbuf
  reftable/record: use scratch buffer when decoding records
  reftable/record: reuse message when decoding log records
  reftable/record: reuse refnames when decoding log records
  reftable/record: avoid copying author info
  reftable/record: convert old and new object IDs to arrays
  refs/reftable: reload correct stack when creating reflog iter
</content>
</entry>
<entry>
<title>Merge branch 'ps/reftable-iteration-perf-part2'</title>
<updated>2024-03-14T21:05:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-14T21:05:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=448a74e1515ca63bc0877a0461624d7beb1bec2e'/>
<id>urn:sha1:448a74e1515ca63bc0877a0461624d7beb1bec2e</id>
<content type='text'>
The code to iterate over refs with the reftable backend has seen
some optimization.

* ps/reftable-iteration-perf-part2:
  refs/reftable: precompute prefix length
  reftable: allow inlining of a few functions
  reftable/record: decode keys in place
  reftable/record: reuse refname when copying
  reftable/record: reuse refname when decoding
  reftable/merged: avoid duplicate pqueue emptiness check
  reftable/merged: circumvent pqueue with single subiter
  reftable/merged: handle subiter cleanup on close only
  reftable/merged: remove unnecessary null check for subiters
  reftable/merged: make subiters own their records
  reftable/merged: advance subiter on subsequent iteration
  reftable/merged: make `merged_iter` structure private
  reftable/pq: use `size_t` to track iterator index
</content>
</entry>
<entry>
<title>Merge branch 'ps/reftable-repo-init-fix'</title>
<updated>2024-03-07T23:59:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-07T23:59:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=963a277a521adfa33f6e710e71c7d2a9f4d87a9c'/>
<id>urn:sha1:963a277a521adfa33f6e710e71c7d2a9f4d87a9c</id>
<content type='text'>
Clear the fallout from a fix for 2.44 regression.

* ps/reftable-repo-init-fix:
  t0610: remove unused variable assignment
  refs/reftable: don't fail empty transactions in repo without HEAD
</content>
</entry>
<entry>
<title>Merge branch 'kn/for-all-refs'</title>
<updated>2024-03-05T17:44:44Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-03-05T17:44:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d037212d973351ced4a3f0bb0705575bee4f8566'/>
<id>urn:sha1:d037212d973351ced4a3f0bb0705575bee4f8566</id>
<content type='text'>
"git for-each-ref" learned "--include-root-refs" option to show
even the stuff outside the 'refs/' hierarchy.

* kn/for-all-refs:
  for-each-ref: add new option to include root refs
  ref-filter: rename 'FILTER_REFS_ALL' to 'FILTER_REFS_REGULAR'
  refs: introduce `refs_for_each_include_root_refs()`
  refs: extract out `loose_fill_ref_dir_regular_file()`
  refs: introduce `is_pseudoref()` and `is_headref()`
</content>
</entry>
<entry>
<title>refs/reftable: track last log record name via strbuf</title>
<updated>2024-03-05T17:10:07Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-03-05T12:11:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fcacc2b161b095c99dfd4e0b05dcc1ed8ca80a62'/>
<id>urn:sha1:fcacc2b161b095c99dfd4e0b05dcc1ed8ca80a62</id>
<content type='text'>
The reflog iterator enumerates all reflogs known to a ref backend. In
the "reftable" backend there is no way to list all existing reflogs
directly. Instead, we have to iterate through all reflog entries and
discard all those redundant entries for which we have already returned a
reflog entry.

This logic is implemented by tracking the last reflog name that we have
emitted to the iterator's user. If the next log record has the same name
we simply skip it until we find another record with a different refname.

This last reflog name is stored in a simple C string, which requires us
to free and reallocate it whenever we need to update the reflog name.
Convert it to use a `struct strbuf` instead, which reduces the number of
allocations. Before:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 1,068,485 allocs, 1,068,363 frees, 281,122,886 bytes allocated

After:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 68,485 allocs, 68,363 frees, 256,234,072 bytes allocated

Note that even after this change we still allocate quite a lot of data,
even though the number of allocations does not scale with the number of
log records anymore. This remainder comes mostly from decompressing the
log blocks, where we decompress each block into newly allocated memory.
This will be addressed at a later point in time.

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/record: convert old and new object IDs to arrays</title>
<updated>2024-03-05T17:10:06Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-03-05T12:10:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=87ff723018bfca588b5d68e110ab04494c451ebd'/>
<id>urn:sha1:87ff723018bfca588b5d68e110ab04494c451ebd</id>
<content type='text'>
In 7af607c58d (reftable/record: store "val1" hashes as static arrays,
2024-01-03) and b31e3cc620 (reftable/record: store "val2" hashes as
static arrays, 2024-01-03) we have converted ref records to store their
object IDs in a static array. Convert log records to do the same so that
their old and new object IDs are arrays, too.

This change results in two allocations less per log record that we're
iterating over. Before:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 8,068,495 allocs, 8,068,373 frees, 401,011,862 bytes allocated

After:

    HEAP SUMMARY:
        in use at exit: 13,473 bytes in 122 blocks
      total heap usage: 6,068,489 allocs, 6,068,367 frees, 361,011,822 bytes allocated

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
