Hi,

I just committed the tests for AIO, and unfortunately they (so far) fail on
one buildfarm animal:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bumblebee&dt=2025-04-01%2018%3A55%3A01


The reason for the failure is simple, the buildfarm animal specifies
io_method=io_uring (thanks to "cookt" for setting that up so quickly, whoever
you are :)) and the test is assuming that the -c io_method=... it passes to
initdb is actually going to be used, but it's overwritten by the TEMP_CONFIG.


I had hardened the test, with some pain, against PG_TEST_INITDB_EXTRA_OPTS
containing -c io_method=...:
        # Want to test initdb for each IO method, otherwise we could just reuse
        # the cluster.
        #
        # Unfortunately Cluster::init() puts PG_TEST_INITDB_EXTRA_OPTS after the
        # options specified by ->extra, if somebody puts -c io_method=xyz in
        # PG_TEST_INITDB_EXTRA_OPTS it would break this test. Fix that up if we
        # detect it.
        local $ENV{PG_TEST_INITDB_EXTRA_OPTS} = $ENV{PG_TEST_INITDB_EXTRA_OPTS};
        if (defined $ENV{PG_TEST_INITDB_EXTRA_OPTS}
                && $ENV{PG_TEST_INITDB_EXTRA_OPTS} =~ m/io_method=/)
        {
                $ENV{PG_TEST_INITDB_EXTRA_OPTS} .= " -c io_method=$io_method";
        }

        $node->init(extra => [ '-c', "io_method=$io_method" ]);

But somehow I didn't think about TEMP_CONFIG.

The reason that the test passes -c io_method= to initdb is that I want to
ensure initdb passes with all the supported io_methods.  That still happens
with TEMP_CONFIG specified, it's just afterwards over-written.

I could just append io_method=$io_method again after $node->init(), but then I
couldn't verify that initdb actually ran with the to-be-tested io method.


Does anybody have a good suggestion for how to fix this?


The least bad idea I can think of is for the test to check if
PostgreSQL::Test::Utils::slurp_file($ENV{TEMP_CONFIG}) contains the string
io_method and to append the io_method again to the config if it does.  But
that seems rather ugly.


Does anybody have a better idea?

Greetings,

Andres Freund


Reply via email to