postgres.git / summary / log / commit / refs

commit    0036232ba8fb282979cff16c8751a361cb85fe76
Author:   Daniel Gustafsson <dgustafsson@postgresql.org>
Date:     Fri Apr 03 22:25:07 2026 +0000

    Make data checksum tests more resilient for slow machines
    
    The test for re-running checksum enabling was only checking for the
    data checksum state to transition to 'on', but didn't account for
    the launcher process having had time to exit, thus getting an error
    instead of the expected no-op.  Adding a pg_stat_activity check for
    the launcher exiting resolves the error, verified by inducing delay
    in the launcher.
    
    Also wrap a variable only used in injection point tests within the
    correct USE macros to avoid warning for an unused variable.
    
    All per the buildfarm.
    
    Author: Daniel Gustafsson <daniel@yesql.se>
    Reported-by: Buildfarm
    Discussion: https://postgr.es/m/1CB288C9-564B-4664-B096-C2F4377D17AB@yesql.se


src/test/modules/test_checksums/t/001_basic.pl | 6 +++++- src/test/modules/test_checksums/test_checksums.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/modules/test_checksums/t/001_basic.pl b/src/test/modules/test_checksums/t/001_basic.pl index c008e95fbff..5933c730da1 100644 --- a/src/test/modules/test_checksums/t/001_basic.pl +++ b/src/test/modules/test_checksums/t/001_basic.pl @@ -35,7 +35,11 @@ my $result = is($result, '9999', 'ensure checksummed pages can be read back'); # Enable data checksums again which should be a no-op so we explicitly don't -# wait for any state transition as none should happen here +# wait for any state transition as none should happen here. Make sure to let +# any running launcher finish in case it's still wrapping up. +$result = $node->poll_query_until('postgres', + "SELECT count(*) = 0 FROM pg_catalog.pg_stat_activity WHERE backend_type = 'datachecksum launcher';" +); enable_data_checksums($node); test_checksum_state($node, 'on'); # ..and make sure we can still read/write data diff --git a/src/test/modules/test_checksums/test_checksums.c b/src/test/modules/test_checksums/test_checksums.c index b087a3b4664..e2b91f9c78c 100644 --- a/src/test/modules/test_checksums/test_checksums.c +++ b/src/test/modules/test_checksums/test_checksums.c @@ -108,7 +108,9 @@ dcw_inject_startup_delay(PG_FUNCTION_ARGS) PG_RETURN_VOID(); } +#ifdef USE_INJECTION_POINTS static uint32 db_fail = DATACHECKSUMSWORKER_FAILED; +#endif void dc_modify_db_result(const char *name, const void *private_data, void *arg) [parent: 01876ace1369]