forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9a56dc3
committed
Fix various possible problems with synchronous replication.
1. Don't ignore query cancel interrupts. Instead, if the user asks tocancel the query after we've already committed it, but before it's onthe standby, just emit a warning and let the COMMIT finish.2. Don't ignore die interrupts (pg_terminate_backend or fast shutdown).Instead, emit a warning message and close the connection withoutacknowledging the commit. Other backends will still see the effect ofthe commit, but there's no getting around that; it's too late to abortat this point, and ignoring die interrupts altogether doesn't seem likea good idea.3. If synchronous_standby_names becomes empty, wake up all backendswaiting for synchronous replication to complete. Without this, someoneattempting to shut synchronous replication off could easily wedge theentire system instead.4. Avoid depending on the assumption that if a walsender updatesMyProc->syncRepState, we'll see the change even if we read it withoutholding the lock. The window for this appears to be quite narrow (andprobably doesn't exist at all on machines with strong memory ordering)but protecting against it is practically free, so do that.5. Remove useless state SYNC_REP_MUST_DISCONNECT, which isn't needed anddoesn't actually do anything.There's still some further work needed here to make the behavior of fastshutdown plausible, but that looks complex, so I'm leaving it for aseparate commit. Review by Fujii Masao.1 parente148443 commit9a56dc3
File tree
6 files changed
+214
-114
lines changed- doc/src/sgml
- src
- backend
- postmaster
- replication
- tcop
- include/replication
6 files changed
+214
-114
lines changedLines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2100 | 2100 |
| |
2101 | 2101 |
| |
2102 | 2102 |
| |
2103 |
| - | |
2104 |
| - | |
| 2103 | + | |
2105 | 2104 |
| |
2106 | 2105 |
| |
2107 | 2106 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
| 52 | + | |
52 | 53 |
| |
53 | 54 |
| |
54 | 55 |
| |
| |||
216 | 217 |
| |
217 | 218 |
| |
218 | 219 |
| |
| 220 | + | |
| 221 | + | |
| 222 | + | |
219 | 223 |
| |
220 | 224 |
| |
221 | 225 |
| |
| |||
237 | 241 |
| |
238 | 242 |
| |
239 | 243 |
| |
| 244 | + | |
| 245 | + | |
240 | 246 |
| |
241 | 247 |
| |
242 | 248 |
| |
|
0 commit comments
Comments
(0)