Hi hackers,
Bgwriter process will call `pgstat_send_bgwriter` to send statistics to stat collector, but stat collector is not started when standby is not in hot standby mode.
```
if (pmState == PM_RUN || pmState == PM_HOT_STANDBY)
PgStatPID = pgstat_start();
```
This would lead to the kernel Recv-Q buffer being filled up by checking `netstat -du`.
I think we should disable to send statistics in `pgstat_send_bgwriter` when stat collector is not running. So here are three questions about how to fix it.
- Is there any way we could effectively check the status of stat collector in bgwriter process?
- Is there any way we check the bgwriter is running on a standby but not in hot stanby mode?
- Is there any other process will send statistics except the bgwriter in standby? We should fix it one by one or add a check in `pgstat_send` directly?
Thanks,
Hubert Zhang