Re: pg_basebackup throttling doesn't throttle as promised

From: Antonin Houska <ah(at)cybertec(dot)at>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup throttling doesn't throttle as promised
Date: 2017-09-02 08:32:53
Message-ID: 5299.1504341173@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:

> On Fri, Sep 1, 2017 at 1:32 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> 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
reasons.

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
Web: http://www.postgresql-support.de, http://www.cybertec.at

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Devrim Gündüz 2017-09-02 11:28:03 Re: configure issue - warnings sort: No such file or directory
Previous Message Noah Misch 2017-09-02 06:51:31 Re: Parallel worker error