Jeff Janes <> wrote:

> On Fri, Sep 1, 2017 at 1:32 PM, Jeff Janes <> wrote:
>  The "-r" option to pg_basebackup is supposed to throttle the rate of the
>  backup. But it only works properly if the server is mostly idle.
>  Every non-trivial call to XLogFlush or XLogBackgroundFlush will wake up the
>  wal sender (the one which is not really sending wal, but base files), and
>  the throttling routine doesn't go back to sleep after being awoke
>  early. Rather, it releases another 32kb of data.

Sorry, I missed this fact when coding the feature.

>  Should the basebackup.c throttle sleep in a loop until its time has
>  expired?

I think this is the correct approach because latch can be set for unrelated

The patch makes sense to me. I just recommend moving this part in front of the
loop because elapsed_min does not have to be re-computed each time:

    /* How much should have elapsed at minimum? */
    elapsed_min = elapsed_min_unit * (throttling_counter / throttling_sample);

And also a comment explaining the purpose of the loop would be
appreciated. Thanks.

Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to