recovery_min_delay casting problems lead to busy looping

Поиск
Список
Период
Сортировка
От Andres Freund
Тема recovery_min_delay casting problems lead to busy looping
Дата
Msg-id 20150323141819.GH26995@alap3.anarazel.de
обсуждение исходный текст
Ответы Re: recovery_min_delay casting problems lead to busy looping  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Hi,

recoveryApplyDelay() does:   TimestampDifference(GetCurrentTimestamp(), recoveryDelayUntilTime,
&secs,µsecs);
 
   if (secs <= 0 && microsecs <= 0)       break;
   elog(DEBUG2, "recovery apply delay %ld seconds, %d milliseconds",        secs, microsecs / 1000);
   WaitLatch(&XLogCtl->recoveryWakeupLatch,             WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
secs* 1000L + microsecs / 1000);
 

The problem is that the 'microsecs <= 0' comparison is done while in
microsecs, but the sleeping converts to milliseconds. Which will often
be 0. I've seen this cause ~15-20 iterations per loop. Annoying, but not
terrible.

I think we should simply make the abort condition '&& microsecs / 1000
<= 0'.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Order of enforcement of CHECK constraints?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: recovery_min_delay casting problems lead to busy looping