Re: Backup throttling
От | Andres Freund |
---|---|
Тема | Re: Backup throttling |
Дата | |
Msg-id | 20130903125155.GA18486@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: Backup throttling (Antonin Houska <antonin.houska@gmail.com>) |
Список | pgsql-hackers |
Hi, On 2013-09-03 14:35:18 +0200, Antonin Houska wrote: > + /* > + * THROTTLING_SAMPLE_MIN / MAX_RATE_LOWER (in seconds) should be the > + * longest possible time to sleep. > + */ > + pg_usleep((long) sleep); > + else > + > + /* > + * The actual transfer rate is below the limit. Negative value would > + * distort the adjustment of throttled_last. > + */ > + sleep = 0; > + > + /* > + * Only the whole multiples of throttling_sample processed. The rest will > + * be done during the next call of this function. > + */ > + throttling_counter %= throttling_sample; > + /* Once the (possible) sleep ends, new period starts. */ > + throttled_last += elapsed + sleep; > +} It's probably better to use latches for the waiting, those have properly defined interruption semantics. Whether pg_usleep will be interrupted is platform dependant... Greetings, Andres Freund
В списке pgsql-hackers по дате отправления: