Wal receiver进程描述结构
进程 结构 描述 WAL receiver
2023-06-13 09:12:02 时间
WalReceiver进程的描述结构WalRcvData,仅当作记录
typedef struct
{
pid_t pid;//当前walreciver进程的pid
WalRcvState walRcvState;//标记进程状态
pg_time_t startTime;//RequestXLogStream函数调用的开始时间
//startup进程第一次启动walreceiver进程时,是流复制需要的开始位置
XLogRecPtr receiveStart;//拉取日志的起始位置,文件对齐了,也就是从段文件头开始
TimeLineID receiveStartTLI;//拉取日志的时间线
/*receiver进程第一次启动时,设置为receiveStart和receiveStartTLI,后续每次接收的日志刷盘时更新*/
XLogRecPtr receivedUpto;
TimeLineID receivedTLI;
//第一次启动时,拉取日志的起始位置
XLogRecPtr latestChunkStart;
/*
* Time of send and receive of any message received.
*/
TimestampTz lastMsgSendTime;
TimestampTz lastMsgReceiptTime;
/*
* Latest reported end of WAL on the sender
*/
XLogRecPtr latestWalEnd;
TimestampTz latestWalEndTime;
//连接信息:PrimaryConnInfo<---primary_conninfo
char conninfo[MAXCONNINFO];
/*
* Host name (this can be a host name, an IP address, or a directory path)
* and port number of the active replication connection.
*/
char sender_host[NI_MAXHOST];
int sender_port;
//复制槽名:PrimarySlotName <--- primary_slot_name
char slotname[NAMEDATALEN];
/* 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 */
/*
* force walreceiver reply? This doesn't need to be locked; memory
* barriers for ordering are sufficient. But we do need atomic fetch and
* store semantics, so use sig_atomic_t.
*/
sig_atomic_t force_reply; /* used as a bool */
}
typedef enum
{
WALRCV_STOPPED, /* stopped and mustn't start up again */
WALRCV_STARTING, /* launched, but the process hasn't
* initialized yet */
WALRCV_STREAMING, /* walreceiver is streaming */
WALRCV_WAITING, /* stopped streaming, waiting for orders */
WALRCV_RESTARTING, /* asked to restart streaming */
WALRCV_STOPPING /* requested to stop, but still running */
} WalRcvState;
相关文章
- 【Linux 内核】Linux 操作系统结构 ( Linux 内核在操作系统中的层级 | Linux 内核子系统及关系 | 进程调度 | 内存管理 | 虚拟文件系统 | 网络管理 | 进程间通信 )
- 【Linux 内核】进程管理 task_struct 结构体 ① ( task_struct 结构体引入 | task_struct 代码示例 )
- Linux进程间互斥:实现共同资源并行访问(linux进程间互斥)
- Linux下的进程控制:一次简单的指令解析(linux进程控制块)
- Linux进程管理之写文件(linux进程写文件)
- Linux 系统的进程管理与监控(linux进程监控软件)
- Linux自动启动进程:实现持续运行(linux自动启动进程)
- 管理Linux进程:查看与杀死(linux查看并杀死进程)
- 深入探究:Linux 进程内存结构原理及特点(linux进程内存结构)
- 掌握Linux停止命令,轻松结束进程和关闭系统(linux停止命令)
- 深入了解Linux进程的结构和功能(linux进程内容)