Thread

  1. Address the bug in 041_checkpoint_at_promote.pl

    Nitin Jadhav <nitinjadhavpostgres@gmail.com> — 2025-02-12T07:58:55Z

    While testing, I discovered an issue in 041_checkpoint_at_promote.pl.
    
    # Wait until the previous restart point completes on the newly-promoted
    # standby, checking the logs for that.
    my $checkpoint_complete = 0;
    foreach my $i (0 .. 10 * $PostgreSQL::Test::Utils::timeout_default)
    {
        if ($node_standby->log_contains("restartpoint complete"), $logstart)
        {
            $checkpoint_complete = 1;
            last;
        }
        usleep(100_000);
    }
    is($checkpoint_complete, 1, 'restart point has completed');
    
    The code is intended to wait for the restart point to complete before
    proceeding. However, it doesn't actually wait. Regardless of whether
    the restart point completes, the loop exits after the first iteration
    because the if condition always evaluates to true. This happens
    because $logstart is not passed as an argument to log_contains() by
    mistake. If the restart point operation is quick, this issue might not
    be noticeable, which is often the case.
    
    I've attached a patch to fix this issue. Please review and share your feedback.
    
    
    Best Regards,
    Nitin Jadhav
    Azure Database for PostgreSQL
    Microsoft