Commit 089a1a4
authored
restore async replication connection keepalive when PullRecords is not active (#4405)
Prior to #4324, we had an async
`maintainReplConn` goroutine that was running on a ticker every 15
seconds. When we moved the keepalive inside of PullRecords, we
introduced an edge case where there can be _a large time gap_ between
PullRecords where we are no longer keeping the connection alive(e.g.
when normalize backpressure kicks in). This led to a new failure mode
when PullRecords resumes and tries to read from PG, it hit
wal_sender_timeout error.
This PR brings back the async goroutine ~but only run the keepalive when
PullRecords is not active; otherwise, it let the PullRecords handle the
keepalive logic in the loop.~
The keepalive is hard-coded to 15 seconds. When we merge
#4363 later, we can use the
computed keepalive instead. ~Also note it's still safe to remove
`replLock` because this ReplPing only runs when PullRecords is inactive,
so there should be no lock contention (but doesn't hurt if we wish to
keep it either for safety).~ There can be edge cases (see discussion
below) where a race condition can happen, so we will want to keep the
replLock around when.
Also note that #4404 addresses
slightly separate edge case, with the goal of ensuring ReplPing has full
coverage _inside_ a PullRecord cycle.1 parent ad79aec commit 089a1a4
2 files changed
Lines changed: 31 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
737 | 737 | | |
738 | 738 | | |
739 | 739 | | |
740 | | - | |
741 | | - | |
| 740 | + | |
| 741 | + | |
742 | 742 | | |
743 | 743 | | |
744 | 744 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | | - | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
88 | 115 | | |
89 | 116 | | |
90 | 117 | | |
| |||
0 commit comments