mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Use ProcNumbers instead of direct Latch pointers to address other procs
This is in preparation for replacing Latches with a new abstraction. That's still work in progress, but this seems a little tidier anyway, so let's get this refactoring out of the way already. Discussion: https://www.postgresql.org/message-id/391abe21-413e-4d91-a650-b663af49500c%40iki.fi
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "replication/logicalproto.h"
|
||||
#include "replication/walsender.h"
|
||||
#include "storage/condition_variable.h"
|
||||
#include "storage/latch.h"
|
||||
#include "storage/spin.h"
|
||||
#include "utils/tuplestore.h"
|
||||
|
||||
@@ -58,13 +57,24 @@ typedef enum
|
||||
typedef struct
|
||||
{
|
||||
/*
|
||||
* PID of currently active walreceiver process, its current state and
|
||||
* start time (actually, the time at which it was requested to be
|
||||
* started).
|
||||
* Currently active walreceiver process's proc number and PID.
|
||||
*
|
||||
* The startup process uses the proc number to wake it up after telling it
|
||||
* where to start streaming (after setting receiveStart and
|
||||
* receiveStartTLI), and also to tell it to send apply feedback to the
|
||||
* primary whenever specially marked commit records are applied.
|
||||
*/
|
||||
ProcNumber procno;
|
||||
pid_t pid;
|
||||
|
||||
/* Its current state */
|
||||
WalRcvState walRcvState;
|
||||
ConditionVariable walRcvStoppedCV;
|
||||
|
||||
/*
|
||||
* Its start time (actually, the time at which it was requested to be
|
||||
* started).
|
||||
*/
|
||||
pg_time_t startTime;
|
||||
|
||||
/*
|
||||
@@ -134,15 +144,6 @@ typedef struct
|
||||
/* set true once conninfo is ready to display (obfuscated pwds etc) */
|
||||
bool ready_to_display;
|
||||
|
||||
/*
|
||||
* Latch used by startup process to wake up walreceiver after telling it
|
||||
* where to start streaming (after setting receiveStart and
|
||||
* receiveStartTLI), and also to tell it to send apply feedback to the
|
||||
* primary whenever specially marked commit records are applied. This is
|
||||
* normally mapped to procLatch when walreceiver is running.
|
||||
*/
|
||||
Latch *latch;
|
||||
|
||||
slock_t mutex; /* locks shared variables shown above */
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user