forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitbb16aba
committed
Enable parallel query with SERIALIZABLE isolation.
Previously, the SERIALIZABLE isolation level prevented parallel queryfrom being used. Allow the two features to be used together bysharing the leader's SERIALIZABLEXACT with parallel workers.An extra per-SERIALIZABLEXACT LWLock is introduced to make it safe toshare, and new logic is introduced to coordinate the early releaseof the SERIALIZABLEXACT required for the SXACT_FLAG_RO_SAFEoptimization, as follows:The first backend to observe the SXACT_FLAG_RO_SAFE flag (set bysome other transaction) will 'partially release' the SERIALIZABLEXACT,meaning that the conflicts and locks it holds are released, but theSERIALIZABLEXACT itself will remain active because other backendsmight still have a pointer to it.Whenever any backend notices the SXACT_FLAG_RO_SAFE flag, it clearsits own MySerializableXact variable and frees local resources so thatit can skip SSI checks for the rest of the transaction. In thespecial case of the leader process, it transfers the SERIALIZABLEXACTto a new variable SavedSerializableXact, so that it can be completelyreleased at the end of the transaction after all workers have exited.Remove the serializable_okay flag added to CreateParallelContext() bycommit9da0cc3, because it's now redundant.Author: Thomas MunroReviewed-by: Haribabu Kommi, Robert Haas, Masahiko Sawada, Kevin GrittnerDiscussion:https://postgr.es/m/CAEepm=0gXGYhtrVDWOTHS8SQQy_=S9xo+8oCxGLWZAOoeJ=yzQ@mail.gmail.com1 parent13e8643 commitbb16aba
File tree
19 files changed
+429
-67
lines changed- doc/src/sgml
- src
- backend
- access
- nbtree
- transam
- executor
- optimizer/plan
- storage/lmgr
- utils/resowner
- include
- access
- storage
- test/isolation
- expected
- specs
19 files changed
+429
-67
lines changedLines changed: 6 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
861 | 861 |
| |
862 | 862 |
| |
863 | 863 |
| |
864 |
| - | |
| 864 | + | |
865 | 865 |
| |
866 | 866 |
| |
867 | 867 |
| |
| |||
1121 | 1121 |
| |
1122 | 1122 |
| |
1123 | 1123 |
| |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1124 | 1129 |
| |
1125 | 1130 |
| |
1126 | 1131 |
| |
|
Lines changed: 0 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
184 | 184 |
| |
185 | 185 |
| |
186 | 186 |
| |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 | 187 |
| |
195 | 188 |
| |
196 | 189 |
| |
| |||
233 | 226 |
| |
234 | 227 |
| |
235 | 228 |
| |
236 |
| - | |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 | 229 |
| |
247 | 230 |
| |
248 | 231 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1265 | 1265 |
| |
1266 | 1266 |
| |
1267 | 1267 |
| |
1268 |
| - | |
| 1268 | + | |
1269 | 1269 |
| |
1270 | 1270 |
| |
1271 | 1271 |
| |
|
Lines changed: 7 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| 34 | + | |
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| |||
91 | 92 |
| |
92 | 93 |
| |
93 | 94 |
| |
| 95 | + | |
94 | 96 |
| |
95 | 97 |
| |
96 | 98 |
| |
| |||
155 | 157 |
| |
156 | 158 |
| |
157 | 159 |
| |
158 |
| - | |
| 160 | + | |
159 | 161 |
| |
160 | 162 |
| |
161 | 163 |
| |
| |||
166 | 168 |
| |
167 | 169 |
| |
168 | 170 |
| |
169 |
| - | |
170 |
| - | |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
176 |
| - | |
177 |
| - | |
178 |
| - | |
179 | 171 |
| |
180 | 172 |
| |
181 | 173 |
| |
| |||
327 | 319 |
| |
328 | 320 |
| |
329 | 321 |
| |
| 322 | + | |
330 | 323 |
| |
331 | 324 |
| |
332 | 325 |
| |
| |||
1422 | 1415 |
| |
1423 | 1416 |
| |
1424 | 1417 |
| |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1425 | 1421 |
| |
1426 | 1422 |
| |
1427 | 1423 |
| |
|
Lines changed: 5 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2024 | 2024 |
| |
2025 | 2025 |
| |
2026 | 2026 |
| |
2027 |
| - | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
2028 | 2030 |
| |
2029 |
| - | |
| 2031 | + | |
| 2032 | + | |
2030 | 2033 |
| |
2031 | 2034 |
| |
2032 | 2035 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
604 | 604 |
| |
605 | 605 |
| |
606 | 606 |
| |
607 |
| - | |
| 607 | + | |
608 | 608 |
| |
609 | 609 |
| |
610 | 610 |
| |
|
Lines changed: 1 addition & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
337 | 337 |
| |
338 | 338 |
| |
339 | 339 |
| |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 | 340 |
| |
349 | 341 |
| |
350 | 342 |
| |
351 | 343 |
| |
352 | 344 |
| |
353 | 345 |
| |
354 |
| - | |
355 |
| - | |
| 346 | + | |
356 | 347 |
| |
357 | 348 |
| |
358 | 349 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
521 | 521 |
| |
522 | 522 |
| |
523 | 523 |
| |
| 524 | + | |
524 | 525 |
| |
525 | 526 |
| |
526 | 527 |
| |
|
0 commit comments
Comments
(0)