forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf32678c
committed
Reduce delay for last logicalrep feedback message when master goes idle.
The regression tests contain numerous cases where we do some activity on amaster server and then wait till the slave has ack'd flushing its copy ofthat transaction. Because WAL flush on the slave is asynchronous to thelogicalrep worker process, the worker cannot send such a feedback messageduring the LogicalRepApplyLoop iteration where it processes the last datafrom the master. In the previous coding, the feedback message would comeout only when the loop's WaitLatchOrSocket call returned WL_TIMEOUT. Thatrequires one full second of delay (NAPTIME_PER_CYCLE); and to add insultto injury, it could take more than that if the WaitLatchOrSocket wasinterrupted a few times by latch-setting events.In reality we can expect the slave's walwriter process to have flushed theWAL data after, more or less, WalWriterDelay (typically 200ms). Hence,if there are unacked transactions pending, make the wait delay only thatlong rather than the full NAPTIME_PER_CYCLE. Also, move one of thesend_feedback() calls into the loop main line, so that we'll check for theneed to send feedback even if we were woken by a latch event and not eithersocket data or timeout.It's not clear how much this matters for production purposes, butit's definitely helpful for testing.Discussion:https://postgr.es/m/30864.1498861103@sss.pgh.pa.us1 parent799f8bc commitf32678c
1 file changed
+16
-5
lines changedLines changed: 16 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| 55 | + | |
55 | 56 |
| |
56 | 57 |
| |
57 | 58 |
| |
| |||
1027 | 1028 |
| |
1028 | 1029 |
| |
1029 | 1030 |
| |
| 1031 | + | |
1030 | 1032 |
| |
1031 | 1033 |
| |
1032 | 1034 |
| |
| |||
1114 | 1116 |
| |
1115 | 1117 |
| |
1116 | 1118 |
| |
1117 |
| - | |
1118 |
| - | |
1119 |
| - | |
1120 | 1119 |
| |
1121 | 1120 |
| |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1122 | 1124 |
| |
1123 | 1125 |
| |
1124 | 1126 |
| |
| |||
1147 | 1149 |
| |
1148 | 1150 |
| |
1149 | 1151 |
| |
1150 |
| - | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
1151 | 1157 |
| |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
1152 | 1163 |
| |
1153 | 1164 |
| |
1154 | 1165 |
| |
1155 |
| - | |
| 1166 | + | |
1156 | 1167 |
| |
1157 | 1168 |
| |
1158 | 1169 |
| |
|
0 commit comments
Comments
(0)