mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Extend the ProcSignal mechanism to support barriers.
A new function EmitProcSignalBarrier() can be used to emit a global barrier which all backends that participate in the ProcSignal mechanism must absorb, and a new function WaitForProcSignalBarrier() can be used to wait until all relevant backends have in fact absorbed the barrier. This can be used to coordinate global state changes, such as turning checksums on while the system is running. There's no real client of this mechanism yet, although two are proposed, but an enum has to have at least one element, so this includes a placeholder type (PROCSIGNAL_BARRIER_PLACEHOLDER) which should be replaced by the first real client of this mechanism to get committed. Andres Freund and Robert Haas, reviewed by Daniel Gustafsson and, in earlier versions, by Magnus Hagander. Discussion: http://postgr.es/m/CA+TgmoZwDk=BguVDVa+qdA6SBKef=PKbaKDQALTC_9qoz1mJqg@mail.gmail.com
This commit is contained in:
@@ -45,6 +45,16 @@ typedef enum
|
||||
NUM_PROCSIGNALS /* Must be last! */
|
||||
} ProcSignalReason;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/*
|
||||
* XXX. PROCSIGNAL_BARRIER_PLACEHOLDER should be replaced when the first
|
||||
* real user of the ProcSignalBarrier mechanism is added. It's just here
|
||||
* for now because we can't have an empty enum.
|
||||
*/
|
||||
PROCSIGNAL_BARRIER_PLACEHOLDER = 0
|
||||
} ProcSignalBarrierType;
|
||||
|
||||
/*
|
||||
* prototypes for functions in procsignal.c
|
||||
*/
|
||||
@@ -55,6 +65,10 @@ extern void ProcSignalInit(int pss_idx);
|
||||
extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
|
||||
BackendId backendId);
|
||||
|
||||
extern uint64 EmitProcSignalBarrier(ProcSignalBarrierType type);
|
||||
extern void WaitForProcSignalBarrier(uint64 generation);
|
||||
extern void ProcessProcSignalBarrier(void);
|
||||
|
||||
extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
|
||||
|
||||
#endif /* PROCSIGNAL_H */
|
||||
|
Reference in New Issue
Block a user