forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita780b2f
committed
Fix broken snapshot handling in parallel workers.
Pengchengliu reported an assertion failure in a parallel woker whileperforming a parallel scan using an overflowed snapshot. The proximatecause is that TransactionXmin was set to an incorrect value. Theunderlying cause is incorrect snapshot handling in parallel.c.In particular, InitializeParallelDSM() was unconditionally callingGetTransactionSnapshot(), because I (rhaas) mistakenly thought thatwas always retrieving an existing snapshot whereas, at isolationlevels less than REPEATABLE READ, it's actually taking a new one. Soinstead do this only at higher isolation levels where there actuallyis a single snapshot for the whole transaction.By itself, this is not a sufficient fix, because we still need toguarantee that TransactionXmin gets set properly in the workers. Theeasiest way to do that seems to be to install the leader's activesnapshot as the transaction snapshot if the leader did not serialize atransaction snapshot. This doesn't affect the results of futureGetTrasnactionSnapshot() calls since those have to take a new snapshotanyway; what we care about is the side effect of setting TransactionXmin.Report by Pengchengliu. Patch by Greg Nancarrow, except for some commenttext which I supplied.Discussion:https://postgr.es/m/002f01d748ac$eaa781a0$bff684e0$@tju.edu.cn1 parent43d4dd8 commita780b2f
1 file changed
+38
-14
lines changedLines changed: 38 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
254 | 254 |
| |
255 | 255 |
| |
256 | 256 |
| |
257 |
| - | |
258 |
| - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
259 | 262 |
| |
260 | 263 |
| |
261 | 264 |
| |
| |||
366 | 369 |
| |
367 | 370 |
| |
368 | 371 |
| |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
374 | 385 |
| |
375 | 386 |
| |
376 | 387 |
| |
| |||
1261 | 1272 |
| |
1262 | 1273 |
| |
1263 | 1274 |
| |
| 1275 | + | |
| 1276 | + | |
1264 | 1277 |
| |
1265 | 1278 |
| |
1266 | 1279 |
| |
| |||
1408 | 1421 |
| |
1409 | 1422 |
| |
1410 | 1423 |
| |
1411 |
| - | |
1412 |
| - | |
1413 |
| - | |
1414 |
| - | |
1415 |
| - | |
1416 |
| - | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
1417 | 1436 |
| |
1418 |
| - | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
1419 | 1443 |
| |
1420 | 1444 |
| |
1421 | 1445 |
| |
|
0 commit comments
Comments
(0)