mbox series

[0/6] refs/reftable: wire up exclude patterns

Message ID cover.1725881266.git.ps@pks.im (mailing list archive)
Headers show
Series refs/reftable: wire up exclude patterns | expand

Message

Patrick Steinhardt Sept. 9, 2024, 11:31 a.m. UTC
Hi,

this patch series wires up exclude patterns for the reftable backend.
Exclude patterns allow the backend to skip references internally that
match a specific pattern. This avoids having to read references that the
caller would discard immediately anyway.

The series is structured as follows:

  - Patches 1 and 2 fix two separate bugs in how we currently handle
    exclude patterns in combination with namespaces. We didn't happen to
    stumble over these bugs before because exclude patterns are only
    implemented for the "packed" backend. But once you start to pack
    refs we exclude references based on their full name instead of the
    name with the prefixed stripped. For the reftable backend we'd
    always hit those bugs because it always uses exclude patterns when
    passed.

  - Patches 3 to 5 wire up proper re-seeking of reftable iterators and
    adds some tests to demonstrate that this works as expected. This is
    a prerequisite for handling exclude patterns.

  - Patch 6 wires up exclude patterns in the reftable backend by
    re-seeking iterators once we hit an excluded reference.

Thanks!

Patrick

Patrick Steinhardt (6):
  refs: properly apply exclude patterns to namespaced refs
  builtin/receive-pack: fix exclude patterns when announcing refs
  Makefile: stop listing test library objects twice
  t/unit-tests: introduce reftable library
  reftable/reader: make table iterator reseekable
  refs/reftable: wire up support for exclude patterns

 Makefile                            |   8 +-
 builtin/receive-pack.c              |  18 ++-
 refs.c                              |  35 +++++-
 refs.h                              |   9 ++
 refs/reftable-backend.c             | 125 ++++++++++++++++++++-
 reftable/reader.c                   |   1 +
 t/t1419-exclude-refs.sh             |  33 ++++--
 t/t5509-fetch-push-namespaces.sh    |   9 ++
 t/unit-tests/lib-reftable.c         |  93 ++++++++++++++++
 t/unit-tests/lib-reftable.h         |  20 ++++
 t/unit-tests/t-reftable-merged.c    | 163 +++++++++++++++-------------
 t/unit-tests/t-reftable-reader.c    |  96 ++++++++++++++++
 t/unit-tests/t-reftable-readwrite.c | 130 +++++++---------------
 t/unit-tests/t-reftable-stack.c     |  25 ++---
 trace2.h                            |   1 +
 trace2/tr2_ctr.c                    |   5 +
 16 files changed, 570 insertions(+), 201 deletions(-)
 create mode 100644 t/unit-tests/lib-reftable.c
 create mode 100644 t/unit-tests/lib-reftable.h
 create mode 100644 t/unit-tests/t-reftable-reader.c

Comments

karthik nayak Sept. 13, 2024, 12:48 p.m. UTC | #1
Patrick Steinhardt <ps@pks.im> writes:

> Hi,
>
> this patch series wires up exclude patterns for the reftable backend.
> Exclude patterns allow the backend to skip references internally that
> match a specific pattern. This avoids having to read references that the
> caller would discard immediately anyway.
>
> The series is structured as follows:
>
>   - Patches 1 and 2 fix two separate bugs in how we currently handle
>     exclude patterns in combination with namespaces. We didn't happen to
>     stumble over these bugs before because exclude patterns are only
>     implemented for the "packed" backend. But once you start to pack
>     refs we exclude references based on their full name instead of the
>     name with the prefixed stripped. For the reftable backend we'd
>     always hit those bugs because it always uses exclude patterns when
>     passed.
>
>   - Patches 3 to 5 wire up proper re-seeking of reftable iterators and
>     adds some tests to demonstrate that this works as expected. This is
>     a prerequisite for handling exclude patterns.
>
>   - Patch 6 wires up exclude patterns in the reftable backend by
>     re-seeking iterators once we hit an excluded reference.
>
> Thanks!
>
> Patrick
>

This was a bit more intensive so I took my time with the review. Overall
I have some questions/comments. But the series looks good. Thanks!

Karthik
Patrick Steinhardt Sept. 16, 2024, 6:56 a.m. UTC | #2
On Fri, Sep 13, 2024 at 07:48:02AM -0500, karthik nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Hi,
> >
> > this patch series wires up exclude patterns for the reftable backend.
> > Exclude patterns allow the backend to skip references internally that
> > match a specific pattern. This avoids having to read references that the
> > caller would discard immediately anyway.
> >
> > The series is structured as follows:
> >
> >   - Patches 1 and 2 fix two separate bugs in how we currently handle
> >     exclude patterns in combination with namespaces. We didn't happen to
> >     stumble over these bugs before because exclude patterns are only
> >     implemented for the "packed" backend. But once you start to pack
> >     refs we exclude references based on their full name instead of the
> >     name with the prefixed stripped. For the reftable backend we'd
> >     always hit those bugs because it always uses exclude patterns when
> >     passed.
> >
> >   - Patches 3 to 5 wire up proper re-seeking of reftable iterators and
> >     adds some tests to demonstrate that this works as expected. This is
> >     a prerequisite for handling exclude patterns.
> >
> >   - Patch 6 wires up exclude patterns in the reftable backend by
> >     re-seeking iterators once we hit an excluded reference.
> >
> > Thanks!
> >
> > Patrick
> >
> 
> This was a bit more intensive so I took my time with the review. Overall
> I have some questions/comments. But the series looks good. Thanks!

Thanks for your review!

Patrick