pg_ctl wait exit code (was Re: [COMMITTERS] pgsql: Additional tests for subtransactions in recovery)

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_ctl wait exit code (was Re: [COMMITTERS] pgsql: Additional tests for subtransactions in recovery)
Date: 2017-05-01 16:19:10
Message-ID: f02aae4d-0063-7d73-ba35-74c608bbdb8c@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 4/27/17 08:41, Michael Paquier wrote:
> +$node_slave->promote;
> +$node_slave->poll_query_until('postgres',
> + "SELECT NOT pg_is_in_recovery()")
> + or die "Timed out while waiting for promotion of standby";
>
> This reminds me that we should really switch PostgresNode::promote to
> use the wait mode of pg_ctl promote, and remove all those polling
> queries...

I was going to say: This should all be obsolete already, because pg_ctl
promote waits by default.

However: Failure to complete promotion within the waiting time does not
lead to an error exit, so you will not get a failure if the promotion
does not finish. This is probably a mistake. Looking around pg_ctl, I
found that this was handled seemingly inconsistently in do_start(), but
do_stop() errors when it does not complete.

Possible patches for this attached.

Perhaps we need a separate exit code in pg_ctl to distinguish general
errors from did not finish within timeout?

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-pg_ctl-Make-failure-to-complete-operation-a-nonzero-.patch invalid/octet-stream 2.0 KB
0002-Remove-unnecessary-pg_is_in_recovery-calls-in-tests.patch invalid/octet-stream 4.8 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-05-01 18:39:23 pgsql: Fix mis-optimization of semijoins with more than one LHS relatio
Previous Message Tom Lane 2017-05-01 15:54:18 pgsql: Update time zone data files to tzdata release 2017b.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2017-05-01 16:32:07 Re: snapbuild woes
Previous Message Kevin Grittner 2017-05-01 16:10:52 Re: transition table behavior with inheritance appears broken (was: Declarative partitioning - another take)