forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit73da6b8
committed
Refactor WaitForLSNReplay() to return the result of waiting
Currently, WaitForLSNReplay() immediately throws an error if waiting for LSNreplay is not successful. This commit teaches WaitForLSNReplay() to returnthe result of waiting, while making pg_wal_replay_wait() responsible forthrowing an appropriate error.This is preparation to adding 'no_error' argument to pg_wal_replay_wait() andnew function pg_wal_replay_wait_status(), which returns the last wait resultstatus.Additionally, we stop distinguishing situations when we find our instance tobe not in a recovery state before entering the waiting loop and insidethe waiting loop. Standby promotion may happen at any moment, even betweenissuing a procedure call statement and pg_wal_replay_wait() doing a firstcheck of recovery status. Thus, there is no pointing distinguishing thesesituations.Also, since we may exit the waiting loop and see our instance not in recoverywithout throwing an error, we need to deleteLSNWaiter() in that case. We dothis unconditionally for the sake of simplicity, even if standby was alreadypromoted after reaching the target LSN, the startup process surely alreadydeleted us.Reported-by: Michael PaquierDiscussion:https://postgr.es/m/ZtUF17gF0pNpwZDI%40paquier.xyzReviewed-by: Michael Paquier, Pavel Borisov1 parent6cfebfe commit73da6b8
File tree
4 files changed
+54
-24
lines changed- src
- backend/access/transam
- include/access
- tools/pgindent
4 files changed
+54
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
759 | 759 | | |
760 | 760 | | |
761 | 761 | | |
| 762 | + | |
762 | 763 | | |
763 | 764 | | |
764 | 765 | | |
| |||
799 | 800 | | |
800 | 801 | | |
801 | 802 | | |
802 | | - | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
803 | 832 | | |
804 | 833 | | |
805 | 834 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 243 | + | |
| 244 | + | |
248 | 245 | | |
249 | 246 | | |
250 | 247 | | |
251 | 248 | | |
252 | 249 | | |
253 | | - | |
| 250 | + | |
254 | 251 | | |
255 | 252 | | |
256 | 253 | | |
| |||
276 | 273 | | |
277 | 274 | | |
278 | 275 | | |
279 | | - | |
| 276 | + | |
280 | 277 | | |
| 278 | + | |
281 | 279 | | |
282 | 280 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
| 281 | + | |
| 282 | + | |
290 | 283 | | |
291 | 284 | | |
292 | 285 | | |
| |||
338 | 331 | | |
339 | 332 | | |
340 | 333 | | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
348 | 337 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
73 | 84 | | |
74 | 85 | | |
75 | 86 | | |
76 | 87 | | |
77 | 88 | | |
78 | 89 | | |
79 | | - | |
| 90 | + | |
80 | 91 | | |
81 | 92 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3126 | 3126 | | |
3127 | 3127 | | |
3128 | 3128 | | |
| 3129 | + | |
3129 | 3130 | | |
3130 | 3131 | | |
3131 | 3132 | | |
| |||
0 commit comments
Comments
(0)