forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita0c632c
committed
Force immediate commit after CREATE DATABASE etc in extended protocol.
We have a few commands that "can't run in a transaction block",meaning that if they complete their processing but then we failto COMMIT, we'll be left with inconsistent on-disk state.However, the existing defenses for this are only watertight forsimple query protocol. In extended protocol, we didn't commituntil receiving a Sync message. Since the client is allowed toissue another command instead of Sync, we're in trouble if thatcommand fails or is an explicit ROLLBACK. In any case, sittingin an inconsistent state while waiting for a client messagethat might not come seems pretty risky.This case wasn't reachable via libpq before we introduced pipelinemode, but it's always been an intended aspect of extended queryprotocol, and likely there are other clients that could reach itbefore.To fix, set a flag in PreventInTransactionBlock that tellsexec_execute_message to force an immediate commit. This seemsto be the approach that does least damage to existing workingcases while still preventing the undesirable outcomes.While here, add some documentation to protocol.sgml that explicitlysays how to use pipelining. That's latent in the existing docs ifyou know what to look for, but it's better to spell it out; and itprovides a place to document this new behavior.Per bug #17434 from Yugo Nagata. It's been wrong for ages,so back-patch to all supported branches.Discussion:https://postgr.es/m/17434-d9f7a064ce2a88a3@postgresql.org1 parent7977ac1 commita0c632c
File tree
4 files changed
+104
-26
lines changed- doc/src/sgml
- src
- backend
- access/transam
- tcop
- include/access
4 files changed
+104
-26
lines changedLines changed: 58 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1050 | 1050 |
| |
1051 | 1051 |
| |
1052 | 1052 |
| |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1053 | 1111 |
| |
1054 | 1112 |
| |
1055 | 1113 |
| |
|
Lines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3453 | 3453 |
| |
3454 | 3454 |
| |
3455 | 3455 |
| |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
3456 | 3459 |
| |
3457 | 3460 |
| |
3458 | 3461 |
| |
| |||
3494 | 3497 |
| |
3495 | 3498 |
| |
3496 | 3499 |
| |
3497 |
| - | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
3498 | 3503 |
| |
3499 | 3504 |
| |
3500 | 3505 |
| |
| |||
3591 | 3596 |
| |
3592 | 3597 |
| |
3593 | 3598 |
| |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
3594 | 3606 |
| |
3595 | 3607 |
| |
3596 | 3608 |
| |
|
Lines changed: 27 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1284 | 1284 |
| |
1285 | 1285 |
| |
1286 | 1286 |
| |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
1287 | 1294 |
| |
1288 | 1295 |
| |
1289 | 1296 |
| |
| |||
2099 | 2106 |
| |
2100 | 2107 |
| |
2101 | 2108 |
| |
2102 |
| - | |
2103 |
| - | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
2104 | 2112 |
| |
2105 |
| - | |
2106 |
| - | |
2107 |
| - | |
2108 |
| - | |
2109 |
| - | |
2110 |
| - | |
2111 |
| - | |
2112 |
| - | |
2113 |
| - | |
2114 |
| - | |
2115 |
| - | |
2116 |
| - | |
2117 |
| - | |
2118 |
| - | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2119 | 2116 |
| |
2120 |
| - | |
2121 |
| - | |
2122 |
| - | |
2123 |
| - | |
2124 |
| - | |
2125 |
| - | |
2126 |
| - | |
2127 |
| - | |
| 2117 | + | |
| 2118 | + | |
2128 | 2119 |
| |
2129 | 2120 |
| |
2130 | 2121 |
| |
| |||
2223 | 2214 |
| |
2224 | 2215 |
| |
2225 | 2216 |
| |
2226 |
| - | |
| 2217 | + | |
2227 | 2218 |
| |
2228 | 2219 |
| |
2229 | 2220 |
| |
2230 | 2221 |
| |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
2231 | 2226 |
| |
2232 | 2227 |
| |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
2233 | 2235 |
| |
2234 | 2236 |
| |
2235 | 2237 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
110 | 116 |
| |
111 | 117 |
| |
112 | 118 |
| |
|
0 commit comments
Comments
(0)