Thread

Commits

  1. Move isolation test index-killtuples to src/test/modules/index/

  1. make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-08-17T23:57:13Z

    Hi all,
    (CCing committer)
    
    The following command fails, because btree_gist is not installed in
    the context of the isolation tests:
    make -C src/test/isolation/
    
    This test has been added recently by 377b7ab14524.  Some efforts have
    been done lately to remove any dependency to contrib/ in
    src/test/regress/, like b1720fe63f34, and it does not strike me as a
    good idea to begin doing that in the main isolation test suite, so
    perhaps the best thing to do here is just move this test to
    contrib/btree_gist/?  Rewriting this test without the dependency to
    the contrib module seems tricky, and there's the matter of the test
    correctness.
    
    Regards,
    --
    Michael
    
  2. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Andres Freund <andres@anarazel.de> — 2025-08-18T13:58:28Z

    Hi,
    
    On 2025-08-18 08:57:13 +0900, Michael Paquier wrote:
    > The following command fails, because btree_gist is not installed in
    > the context of the isolation tests:
    > make -C src/test/isolation/
    > 
    > This test has been added recently by 377b7ab14524.  Some efforts have
    > been done lately to remove any dependency to contrib/ in
    > src/test/regress/, like b1720fe63f34
    
    I don't see what the point of that effort is. All it's doing is to make it
    ever harder to write tests. IMO we should go diametrically the opposite way
    and assume that we have fully built postgres when running tests.
    
    
    > and it does not strike me as a good idea to begin doing that in the main
    > isolation test suite, so perhaps the best thing to do here is just move this
    > test to contrib/btree_gist/?
    
    No, it makes absolutely no sense to test e.g. hash killtuples support in
    btree_gist.
    
    
    > and there's the matter of the test correctness.
    
    What are you trying to say here?
    
    Greetings,
    
    Andres Freund
    
    
    
    
  3. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-08-18T15:38:02Z

    Andres Freund <andres@anarazel.de> writes:
    > On 2025-08-18 08:57:13 +0900, Michael Paquier wrote:
    >> The following command fails, because btree_gist is not installed in
    >> the context of the isolation tests:
    >> make -C src/test/isolation/
    >> ...
    >> and it does not strike me as a good idea to begin doing that in the main
    >> isolation test suite, so perhaps the best thing to do here is just move this
    >> test to contrib/btree_gist/?
    
    > No, it makes absolutely no sense to test e.g. hash killtuples support in
    > btree_gist.
    
    I think the complaint is that nothing has been done to ensure that
    these modules have been installed.  You created a new dependency that
    developers have to work around, rather than teaching the build system
    to handle it.  As a comparison point, all of the tests in
    src/test/recovery, src/test/authentication, etc take care to install
    required modules when you say "make check" in those directories.
    You broke that for src/test/isolation, and you should fix it.
    It shouldn't be much harder than setting EXTRA_INSTALL in the
    Makefile case; I dunno about meson.
    
    			regards, tom lane
    
    
    
    
  4. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-08-18T23:15:06Z

    On Mon, Aug 18, 2025 at 11:38:02AM -0400, Tom Lane wrote:
    > Andres Freund <andres@anarazel.de> writes:
    >> No, it makes absolutely no sense to test e.g. hash killtuples support in
    >> btree_gist.
    > 
    > I think the complaint is that nothing has been done to ensure that
    > these modules have been installed.  You created a new dependency that
    > developers have to work around, rather than teaching the build system
    > to handle it.  As a comparison point, all of the tests in
    > src/test/recovery, src/test/authentication, etc take care to install
    > required modules when you say "make check" in those directories.
    > You broke that for src/test/isolation, and you should fix it.
    > It shouldn't be much harder than setting EXTRA_INSTALL in the
    > Makefile case; I dunno about meson.
    
    All these test suites can rely on EXTRA_INSTALL because they rely on
    the check/installcheck rules from Makefile.global, where checkprep is
    pulled in.  src/test/isolation defines its own check rules, so we
    would need a trick similar to what was done before b1720fe63f34.
    --
    Michael
    
  5. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-08-19T00:28:12Z

    On Mon, Aug 18, 2025 at 09:58:28AM -0400, Andres Freund wrote:
    > On 2025-08-18 08:57:13 +0900, Michael Paquier wrote:
    >> and it does not strike me as a good idea to begin doing that in the main
    >> isolation test suite, so perhaps the best thing to do here is just move this
    >> test to contrib/btree_gist/?
    > 
    > No, it makes absolutely no sense to test e.g. hash killtuples support in
    > btree_gist.
    
    Okay, then let's make sure that the build rules install it
    automatically if one runs only the isolation tests :)
    
    We do that everywhere else for other test suites with EXTRA_INSTALL.
    Being able to use make check is much more developer-friendly than
    requiring developers to use installcheck + a custom step to make sure
    that the module is installed in the instance running the tests.  make
    check has worked for years when run independently in
    src/test/isolation/, and I do quite a bit of concurrency testing
    myself over time when working on a specific step of a larger
    implementation.  I am pretty sure to not be the only one doing that.
    
    > What are you trying to say here?
    
    I've quickly looked at the possibility of *not* relying on btree_gist
    in this test, and also quickly concluded that you have made this
    choice to keep the test faster and easier to understand.  That's fine.
    --
    Michael
    
  6. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Andres Freund <andres@anarazel.de> — 2025-08-22T23:46:43Z

    Hi,
    
    On 2025-08-18 11:38:02 -0400, Tom Lane wrote:
    > Andres Freund <andres@anarazel.de> writes:
    > > On 2025-08-18 08:57:13 +0900, Michael Paquier wrote:
    > >> The following command fails, because btree_gist is not installed in
    > >> the context of the isolation tests:
    > >> make -C src/test/isolation/
    > >> ...
    > >> and it does not strike me as a good idea to begin doing that in the main
    > >> isolation test suite, so perhaps the best thing to do here is just move this
    > >> test to contrib/btree_gist/?
    > 
    > > No, it makes absolutely no sense to test e.g. hash killtuples support in
    > > btree_gist.
    > 
    > I think the complaint is that nothing has been done to ensure that
    > these modules have been installed.
    
    Yes, clearly that needs to be fixed. Not sure why I missed that. My point in
    my above - perhaps to flippant - response was just that moving it to
    btree_gist doesn't make sense.
    
    
    > You created a new dependency that developers have to work around, rather
    > than teaching the build system to handle it.  As a comparison point, all of
    > the tests in src/test/recovery, src/test/authentication, etc take care to
    > install required modules when you say "make check" in those directories.
    > You broke that for src/test/isolation, and you should fix it.  It shouldn't
    > be much harder than setting EXTRA_INSTALL in the Makefile case; I dunno
    > about meson.
    
    That would be the easiest fix - but I'm starting to wonder if it shouldn't
    just be its own test module, as annoying as the boilerplate for that is.
    
    While the test improved code coverage for the various indexes noticeably, I
    did subsequently realize that the new test doesn't end up testing the recovery
    path :(. Better than nothing, but having any coverage of those paths might be
    worth the boilerplate and the runtime overhead of a test module :/
    
    
    Greetings,
    
    Andres Freund
    
    
    
    
  7. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-10-28T07:55:49Z

    On Fri, Aug 22, 2025 at 07:46:43PM -0400, Andres Freund wrote:
    > That would be the easiest fix - but I'm starting to wonder if it shouldn't
    > just be its own test module, as annoying as the boilerplate for that is.
    >
    > While the test improved code coverage for the various indexes noticeably, I
    > did subsequently realize that the new test doesn't end up testing the recovery
    > path :(. Better than nothing, but having any coverage of those paths might be
    > worth the boilerplate and the runtime overhead of a test module :/
    
    Adding just an EXTRA_INSTALL to isolation's Makefile would not work,
    no?  This Makefile has its own rules, which implies that fixing this
    issue would be to duplicate what EXTRA_INSTALL does if we don't use
    the test module solution.  How about a new test/modules/gist/ then?
    --
    Michael
    
  8. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Andres Freund <andres@anarazel.de> — 2025-10-30T15:24:55Z

    Hi,
    
    On 2025-10-28 16:55:49 +0900, Michael Paquier wrote:
    > On Fri, Aug 22, 2025 at 07:46:43PM -0400, Andres Freund wrote:
    > > That would be the easiest fix - but I'm starting to wonder if it shouldn't
    > > just be its own test module, as annoying as the boilerplate for that is.
    > >
    > > While the test improved code coverage for the various indexes noticeably, I
    > > did subsequently realize that the new test doesn't end up testing the recovery
    > > path :(. Better than nothing, but having any coverage of those paths might be
    > > worth the boilerplate and the runtime overhead of a test module :/
    > 
    > Adding just an EXTRA_INSTALL to isolation's Makefile would not work,
    > no?
    
    How precisely to get the contrib module installed seems like a boring
    detail. It's not hard to do that, if we decide that that's the way to go, even
    without EXTRA_INSTALL.
    
    
    > How about a new test/modules/gist/ then?
    
    Well, it tests multiple index types, not just gist. I guess
    test/modules/indexes/ or so should work? Not sure about plural or not.
    
    Greetings,
    
    Andres Freund
    
    
    
    
  9. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-10-31T00:41:56Z

    On Thu, Oct 30, 2025 at 11:24:55AM -0400, Andres Freund wrote:
    > Well, it tests multiple index types, not just gist. I guess
    > test/modules/indexes/ or so should work? Not sure about plural or not.
    
    test/modules/index/ would work here.  If you feel strongly about being
    able to do an EXTRA_INSTALL in src/test/isolation/, I have no
    objections to that as that would also solve the original problem if
    that's the consensus.  My personal choice would be a test module for
    that, as it feels cleaner.
    --
    Michael
    
  10. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Nazir Bilal Yavuz <byavuz81@gmail.com> — 2025-11-17T15:45:30Z

    Hi,
    
    On Fri, 31 Oct 2025 at 03:42, Michael Paquier <michael@paquier.xyz> wrote:
    >
    > On Thu, Oct 30, 2025 at 11:24:55AM -0400, Andres Freund wrote:
    > > Well, it tests multiple index types, not just gist. I guess
    > > test/modules/indexes/ or so should work? Not sure about plural or not.
    >
    > test/modules/index/ would work here.  If you feel strongly about being
    > able to do an EXTRA_INSTALL in src/test/isolation/, I have no
    > objections to that as that would also solve the original problem if
    > that's the consensus.  My personal choice would be a test module for
    > that, as it feels cleaner.
    
    I have two patches to implement this: one moving the killtuples test
    under test/modules/index/, and another adding coverage for the
    recovery path.
    
    0001 moves killtuples test under the test/modules/index/ without any
    implementation change.
    
    0002 converts the killtuples isolation test to a TAP test to exercise
    the recovery path. This patch sets up a standby and additionally
    re-inserts into the table while testing the GiST index to ensure
    coverage of the gistRedoDeleteRecord() function.
    
    -- 
    Regards,
    Nazir Bilal Yavuz
    Microsoft
    
  11. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-11-17T23:31:41Z

    On Mon, Nov 17, 2025 at 06:45:30PM +0300, Nazir Bilal Yavuz wrote:
    > I have two patches to implement this: one moving the killtuples test
    > under test/modules/index/, and another adding coverage for the
    > recovery path.
    > 
    > 0001 moves killtuples test under the test/modules/index/ without any
    > implementation change.
    > 
    > 0002 converts the killtuples isolation test to a TAP test to exercise
    > the recovery path. This patch sets up a standby and additionally
    > re-inserts into the table while testing the GiST index to ensure
    > coverage of the gistRedoDeleteRecord() function.
    
    Hmm.  We should try to conclude over the benefit of TAP over
    isolation, and merge both patches together if the consensus is towards
    a TAP test.
    
    The isolation test feels much cleaner to me in terms of clarity and
    debugging output compared to the suggested TAP test as there are many
    SQL sequences the test depends on.  Other opinions?
    --
    Michael
    
  12. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-11-17T23:40:46Z

    On Tue, Nov 18, 2025 at 08:31:41AM +0900, Michael Paquier wrote:
    > Hmm.  We should try to conclude over the benefit of TAP over
    > isolation, and merge both patches together if the consensus is towards
    > a TAP test.
    > 
    > The isolation test feels much cleaner to me in terms of clarity and
    > debugging output compared to the suggested TAP test as there are many
    > SQL sequences the test depends on.  Other opinions?
    
    By the way, an extra argument in favor of an isolation test here: the
    proposed TAP tests only wants to make sure that replay is able to
    finish on a standby, we don't query it.  We are already doing the same
    in 027_stream_regress.pl for the main regression test suite, and we
    could expand this TAP test or add a new one that grabs the isolation
    test suite and runs it in a TAP test with a standby plugged.  Hence we
    would automatically test the replay path for all isolation tests added
    to the tree, including this one related to kill tuples.
    --
    Michael
    
  13. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Andres Freund <andres@anarazel.de> — 2025-11-18T14:00:39Z

    Hi,
    
    On 2025-11-18 08:40:46 +0900, Michael Paquier wrote:
    > On Tue, Nov 18, 2025 at 08:31:41AM +0900, Michael Paquier wrote:
    > > Hmm.  We should try to conclude over the benefit of TAP over
    > > isolation, and merge both patches together if the consensus is towards
    > > a TAP test.
    > > 
    > > The isolation test feels much cleaner to me in terms of clarity and
    > > debugging output compared to the suggested TAP test as there are many
    > > SQL sequences the test depends on.  Other opinions?
    > 
    > By the way, an extra argument in favor of an isolation test here: the
    > proposed TAP tests only wants to make sure that replay is able to
    > finish on a standby, we don't query it.
    
    I think we should eventually extend the test to run amcheck etc on both
    primary and standby.
    
    
    > We are already doing the same in 027_stream_regress.pl for the main
    > regression test suite, and we could expand this TAP test or add a new one
    > that grabs the isolation test suite and runs it in a TAP test with a standby
    > plugged.
    
    I don't think we should add new things to 027_stream_regress, it's already one
    of the two slowest tests and, at least for me, often the test that takes the
    longest to complete in a testrun.
    
    Greetings,
    
    Andres Freund
    
    
    
    
  14. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-11-19T02:30:30Z

    On Tue, Nov 18, 2025 at 09:00:39AM -0500, Andres Freund wrote:
    > On 2025-11-18 08:40:46 +0900, Michael Paquier wrote:
    >> By the way, an extra argument in favor of an isolation test here: the
    >> proposed TAP tests only wants to make sure that replay is able to
    >> finish on a standby, we don't query it.
    > 
    > I think we should eventually extend the test to run amcheck etc on both
    > primary and standby.
    
    It's also something that I was wondering we could do after a main
    regression test run for some subset of objects.  Not sure that it has
    to be part of one test.
    
    >> We are already doing the same in 027_stream_regress.pl for the main
    >> regression test suite, and we could expand this TAP test or add a new one
    >> that grabs the isolation test suite and runs it in a TAP test with a standby
    >> plugged.
    > 
    > I don't think we should add new things to 027_stream_regress, it's already one
    > of the two slowest tests and, at least for me, often the test that takes the
    > longest to complete in a testrun.
    
    Of course, agreed.  That's the part about adding a completely new TAP
    test that's able to run one or more isolation test suites, and this
    isolation test would be part of it when running things across a
    standby and a primary.  You're the author of the original test, so
    your opinion takes priority over mine, for sure.
    --
    Michael
    
  15. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Michael Paquier <michael@paquier.xyz> — 2025-11-24T10:35:55Z

    On Wed, Nov 19, 2025 at 11:30:30AM +0900, Michael Paquier wrote:
    > It's also something that I was wondering we could do after a main
    > regression test run for some subset of objects.  Not sure that it has
    > to be part of one test.
    
    FWIW, I still getting annoyed by this one (am I the only one?), so I
    have applied the patch moving the isolation test.
    --
    Michael
    
  16. Re: make -C src/test/isolation failure in index-killtuples due to btree_gist

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-11-24T15:47:49Z

    Michael Paquier <michael@paquier.xyz> writes:
    > FWIW, I still getting annoyed by this one (am I the only one?), so I
    > have applied the patch moving the isolation test.
    
    No, you weren't the only one --- it was in my way just yesterday
    while trying to update expected results for 572c40ba9.  I'd not paid
    attention to this thread, but the committed solution seems fine.
    
    			regards, tom lane