Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
base: 2b49e41155d826d40ede07dfd4d34a7a36f9f64b
Choose a base ref
...
head repository: git/git
compare: a949ebd342440049a1ac77ca675f66884eae4187
Choose a head ref
  • 4 commits
  • 16 files changed
  • 2 contributors

Commits on Apr 5, 2024

  1. Merge branch 'ps/pack-refs-auto' into jt/reftable-geometric-compaction

    * 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()`
    gitster committed Apr 5, 2024
    Configuration menu
    Copy the full SHA
    7424fb7 View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2024

  1. reftable/stack: expose option to disable auto-compaction

    The reftable stack already has a variable to configure whether or not to
    run auto-compaction, but it is inaccessible to users of the library.
    There exist use cases where a caller may want to have more control over
    auto-compaction.
    
    Move the `disable_auto_compact` option into `reftable_write_options` to
    allow external callers to disable auto-compaction. This will be used in
    a subsequent commit.
    
    Signed-off-by: Justin Tobler <jltobler@gmail.com>
    Acked-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    jltobler authored and gitster committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    bc91330 View commit details
    Browse the repository at this point in the history
  2. reftable/stack: add env to disable autocompaction

    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 <jltobler@gmail.com>
    Acked-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    jltobler authored and gitster committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    7c8eb59 View commit details
    Browse the repository at this point in the history
  3. reftable/stack: use geometric table compaction

    To reduce the number of on-disk reftables, compaction is performed.
    Contiguous tables with the same binary log value of size are grouped
    into segments. The segment that has both the lowest binary log value and
    contains more than one table is set as the starting point when
    identifying the compaction segment.
    
    Since segments containing a single table are not initially considered
    for compaction, if the table appended to the list does not match the
    previous table log value, no compaction occurs for the new table. It is
    therefore possible for unbounded growth of the table list. This can be
    demonstrated by repeating the following sequence:
    
    git branch -f foo
    git branch -d foo
    
    Each operation results in a new table being written with no compaction
    occurring until a separate operation produces a table matching the
    previous table log value.
    
    Instead, to avoid unbounded growth of the table list, the compaction
    strategy is updated to ensure tables follow a geometric sequence after
    each operation by individually evaluating each table in reverse index
    order. This strategy results in a much simpler and more robust algorithm
    compared to the previous one while also maintaining a minimal ordered
    set of tables on-disk.
    
    When creating 10 thousand references, the new strategy has no
    performance impact:
    
    Benchmark 1: update-ref: create refs sequentially (revision = HEAD~)
      Time (mean ± σ):     26.516 s ±  0.047 s    [User: 17.864 s, System: 8.491 s]
      Range (min … max):   26.447 s … 26.569 s    10 runs
    
    Benchmark 2: update-ref: create refs sequentially (revision = HEAD)
      Time (mean ± σ):     26.417 s ±  0.028 s    [User: 17.738 s, System: 8.500 s]
      Range (min … max):   26.366 s … 26.444 s    10 runs
    
    Summary
      update-ref: create refs sequentially (revision = HEAD) ran
        1.00 ± 0.00 times faster than update-ref: create refs sequentially (revision = HEAD~)
    
    Some tests in `t0610-reftable-basics.sh` assert the on-disk state of
    tables and are therefore updated to specify the correct new table count.
    Since compaction is more aggressive in ensuring tables maintain a
    geometric sequence, the expected table count is reduced in these tests.
    In `reftable/stack_test.c` tests related to `sizes_to_segments()` are
    removed because the function is no longer needed. Also, the
    `test_suggest_compaction_segment()` test is updated to better showcase
    and reflect the new geometric compaction behavior.
    
    Signed-off-by: Justin Tobler <jltobler@gmail.com>
    Acked-by: Patrick Steinhardt <ps@pks.im>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    jltobler authored and gitster committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    a949ebd View commit details
    Browse the repository at this point in the history