Re: Backup throttling

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
Cc: Antonin Houska <antonin(dot)houska(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Backup throttling
Date: 2013-12-09 14:49:11
Message-ID: CAHGQGwGn8mo5mV0_M0hipecxjsXypZcEMcPC+hXckokk34=4=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 6, 2013 at 6:43 PM, Boszormenyi Zoltan <zb(at)cybertec(dot)at> wrote:
> Hi,
>
> 2013-12-05 15:36 keltezéssel, Antonin Houska írta:
>
>> On 12/02/2013 02:23 PM, Boszormenyi Zoltan wrote:
>>>
>>> Hi,
>>>
>>> I am reviewing your patch.
>>
>> Thanks. New version attached.
>
>
> I have reviewed and tested it and marked it as ready for committer.

Here are the review comments:

+ <term><option>-r</option></term>
+ <term><option>--max-rate</option></term>

You need to add something like <replaceable
class="parameter">rate</replaceable>.

+ The purpose is to limit impact of
<application>pg_basebackup</application>
+ on a running master server.

s/"master server"/"server" because we can take a backup from also the standby.

I think that it's better to document the default value and the accepted range of
the rate that we can specify.

You need to change the protocol.sgml because you changed BASE_BACKUP
replication command.

+ printf(_(" -r, --max-rate maximum transfer rate to
transfer data directory\n"));

You need to add something like =RATE just after --max-rate.

+ result = strtol(src, &after_num, 0);

errno should be set to 0 just before calling strtol().

+ if (errno_copy == ERANGE || result != (uint64) ((uint32) result))
+ {
+ fprintf(stderr, _("%s: transfer rate \"%s\" exceeds integer
range\n"), progname, src);
+ exit(1);
+ }

We can move this check after the check of "src == after_num" like
parse_int() in guc.c does.
If we do this, the local variable 'errno_copy' is no longer necessary.

I think that it's better to output the hint message like "Valid units for
the transfer rate are \"k\" and \"M\"." when a user specified wrong unit.

+ /*
+ * THROTTLING_SAMPLE_MIN / MAX_RATE_LOWER (in seconds) should be the
+ * longest possible time to sleep. Thus the cast to long is safe.
+ */
+ pg_usleep((long) sleep);

It's better to use the latch here so that we can interrupt immediately.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Serge Negodyuck 2013-12-09 14:55:21 Re: BUG #8673: Could not open file "pg_multixact/members/xxxx" on slave during hot_standby
Previous Message Peter Eisentraut 2013-12-09 14:29:07 Re: WITHIN GROUP patch