git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: karthik nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH 08/10] reftable/reader: keep readers alive during iteration
Date: Fri, 23 Aug 2024 15:42:45 +0200	[thread overview]
Message-ID: <ZsiRzzRqI-VDu0-S@tanuki> (raw)
In-Reply-To: <CAOLa=ZQarx37De=xmD73D3dPzxp0j8pfb-TBc4u6nKkJn_TT1g@mail.gmail.com>

On Fri, Aug 23, 2024 at 03:21:27AM -0700, karthik nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> > diff --git a/reftable/stack_test.c b/reftable/stack_test.c
> > index bc3bf77274..91e716dc0a 100644
> > --- a/reftable/stack_test.c
> > +++ b/reftable/stack_test.c
> > @@ -1076,6 +1076,54 @@ static void test_reftable_stack_compaction_concurrent_clean(void)
> >  	clear_dir(dir);
> >  }
> >
> > +static void test_reftable_stack_read_across_reload(void)
> > +{
> > +	struct reftable_write_options opts = { 0 };
> > +	struct reftable_stack *st1 = NULL, *st2 = NULL;
> > +	struct reftable_ref_record rec = { 0 };
> > +	struct reftable_iterator it = { 0 };
> > +	char *dir = get_tmp_dir(__LINE__);
> > +	int err;
> > +
> > +	/* Create a first stack and set up an iterator for it. */
> > +	err = reftable_new_stack(&st1, dir, &opts);
> > +	EXPECT_ERR(err);
> > +	write_n_ref_tables(st1, 2);
> > +	EXPECT(st1->merged->readers_len == 2);
> > +	reftable_stack_init_ref_iterator(st1, &it);
> > +	err = reftable_iterator_seek_ref(&it, "");
> > +	EXPECT_ERR(err);
> > +
> > +	/* Set up a second stack for the same directory and compact it. */
> > +	err = reftable_new_stack(&st2, dir, &opts);
> > +	EXPECT_ERR(err);
> > +	EXPECT(st2->merged->readers_len == 2);
> > +	err = reftable_stack_compact_all(st2, NULL);
> 
> Shouldn't we verify that `EXPECT(st2->merged->readers_len == 1);` here?

Yes, we should.

> > +	EXPECT_ERR(err);
> > +
> > +	/*
> > +	 * Verify that we can continue to use the old iterator even after we
> > +	 * have reloaded its stack.
> > +	 */
> > +	err = reftable_stack_reload(st1);
> > +	EXPECT_ERR(err);
> > +	EXPECT(st2->merged->readers_len == 1);
> 
> Oh we do it here, I would've expected it above the `st1` reload. And
> probably expected `EXPECT(st1->merged->readers_len == 2);` here to
> confirm that we still have the readers.

And yes, this was a typo, it should've been `st1` indeed. Good eyes,
thanks!

Patrick

  reply	other threads:[~2024-08-23 13:42 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 15:39 [PATCH 00/10] reftable: fix reload with active iterators Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 01/10] reftable/blocksource: drop malloc block source Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 02/10] reftable/stack: inline `stack_compact_range_stats()` Patrick Steinhardt
2024-08-22  8:23   ` karthik nayak
2024-08-19 15:39 ` [PATCH 03/10] reftable/reader: rename `reftable_new_reader()` Patrick Steinhardt
2024-08-22 18:51   ` Justin Tobler
2024-08-22 19:09     ` Junio C Hamano
2024-08-23  5:22       ` Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 04/10] reftable/reader: inline `init_reader()` Patrick Steinhardt
2024-08-19 15:39 ` [PATCH 05/10] reftable/reader: inline `reader_close()` Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 06/10] reftable/stack: fix broken refnames in `write_n_ref_tables()` Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 07/10] reftable/reader: introduce refcounting Patrick Steinhardt
2024-08-22  9:47   ` karthik nayak
2024-08-22 11:35     ` Patrick Steinhardt
2024-08-23 10:14       ` karthik nayak
2024-08-19 15:40 ` [PATCH 08/10] reftable/reader: keep readers alive during iteration Patrick Steinhardt
2024-08-23 10:21   ` karthik nayak
2024-08-23 13:42     ` Patrick Steinhardt [this message]
2024-08-19 15:40 ` [PATCH 09/10] reftable/stack: reorder swapping in the reloaded stack contents Patrick Steinhardt
2024-08-19 15:40 ` [PATCH 10/10] reftable/stack: fix segfault when reload with reused readers fails Patrick Steinhardt
2024-08-22  8:13 ` [PATCH 00/10] reftable: fix reload with active iterators karthik nayak
2024-08-22 12:41 ` Jeff King
2024-08-22 12:53   ` Patrick Steinhardt
2024-08-22 15:15     ` Junio C Hamano
2024-08-23  5:23       ` Patrick Steinhardt
2024-08-22 15:11   ` Junio C Hamano
2024-08-23 14:12 ` [PATCH v2 " Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 01/10] reftable/blocksource: drop malloc block source Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 02/10] reftable/stack: inline `stack_compact_range_stats()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 03/10] reftable/reader: rename `reftable_new_reader()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 04/10] reftable/reader: inline `init_reader()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 05/10] reftable/reader: inline `reader_close()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 06/10] reftable/stack: fix broken refnames in `write_n_ref_tables()` Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 07/10] reftable/reader: introduce refcounting Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 08/10] reftable/reader: keep readers alive during iteration Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 09/10] reftable/stack: reorder swapping in the reloaded stack contents Patrick Steinhardt
2024-08-23 14:12   ` [PATCH v2 10/10] reftable/stack: fix segfault when reload with reused readers fails Patrick Steinhardt
2024-08-23 16:49   ` [PATCH v2 00/10] reftable: fix reload with active iterators Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZsiRzzRqI-VDu0-S@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).