Introduce timeout capability for ConditionVariableSleep

Поиск
Список
Период
Сортировка
От Shawn Debnath
Тема Introduce timeout capability for ConditionVariableSleep
Дата
Msg-id eeb06007ccfe46e399df6af18bfcd15a@EX13D05UWC002.ant.amazon.com
обсуждение исходный текст
Ответы Re: Introduce timeout capability for ConditionVariableSleep
Список pgsql-hackers
Hello,

Postgres today doesn't support waiting for a condition variable with a 
timeout, although the framework it relies upon, does. This change wraps 
the existing ConditionVariableSleep functionality and introduces a new 
API, ConditionVariableTimedSleep, to allow callers to specify a timeout 
value.

A scenario that highlights this use case is a backend is waiting on 
status update from multiple workers but needs to time out if that signal 
doesn't arrive within a certain period. There was a workaround prior 
to aced5a92, but with that change, the semantics are now different.

I chose to go with -1 instead of 0 for the return from 
ConditionVariableTimedSleep to indicate timeout error  as it seems 
cleaner for this API. WaitEventSetWaitBlock returns -1 for timeout but 
WaitEventSetWait treats timeout as 0 (to represent 0 events indicating 
timeout).

If there's an alternative, cleaner way to achieve this outcome, I am all 
ears.

Thanks.

-- 
Shawn Debnath
Amazon Web Services (AWS)


Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Using condition variables to wait for checkpoints
Следующее
От: David Rowley
Дата:
Сообщение: Re: Should we add GUCs to allow partition pruning to be disabled?