forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1ec7fca

Etsuro Fujita
postgres_fdw: Fix handling of pending asynchronous requests.
A pending asynchronous request is handled by process_pending_request(),which previously not only processed an in-progress remote query butperformed ExecForeignScan() to produce a tuple to return to the localserver asynchronously from the result of the remote query. But that ledto a server crash when executing a query or led to an "InstrStartNodecalled twice in a row" or "InstrEndLoop called on running node" failurewhen doing EXPLAIN ANALYZE of it, in cases where the plan tree for itcontained multiple async-capable nodes accessing the sameinitplan/subplan that contained multiple async-capable nodes scanningthe same foreign tables as for the parent async-capable nodes, asreported by Andrey Lepikhov. The reason is that the second step inprocess_pending_request() invoked when executing the initplan/subplanfor one of the parent async-capable nodes caused recursive execution ofthe initplan/subplan for another of the parent async-capable nodes.To fix, split process_pending_request() into the two steps and postponethe second step until ForeignAsyncConfigureWait() is called for each ofthe pending asynchronous requests. Also, in ExecAppendAsyncEventWait()we assumed that FDWs would register at least one wait event in aWaitEventSet created there when they were called fromForeignAsyncConfigureWait() in that function, but allow FDWs to registerzero wait events in the WaitEventSet; modify ExecAppendAsyncEventWait()to just return in that case.Oversight in commit27e1f14. Back-patch to v14 where that commit wentin.Andrey Lepikhov and Etsuro FujitaDiscussion:https://postgr.es/m/fe5eaa19-1704-e4a4-76ee-3b9d37ade399@postgrespro.ru1 parent16bd4be commit1ec7fca
File tree
4 files changed
+126
-18
lines changed- contrib/postgres_fdw
- expected
- sql
- src/backend/executor
4 files changed
+126
-18
lines changedLines changed: 53 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10300 | 10300 |
| |
10301 | 10301 |
| |
10302 | 10302 |
| |
| 10303 | + | |
| 10304 | + | |
| 10305 | + | |
| 10306 | + | |
| 10307 | + | |
| 10308 | + | |
| 10309 | + | |
| 10310 | + | |
| 10311 | + | |
| 10312 | + | |
| 10313 | + | |
| 10314 | + | |
| 10315 | + | |
| 10316 | + | |
| 10317 | + | |
| 10318 | + | |
| 10319 | + | |
| 10320 | + | |
| 10321 | + | |
| 10322 | + | |
| 10323 | + | |
| 10324 | + | |
| 10325 | + | |
| 10326 | + | |
| 10327 | + | |
| 10328 | + | |
| 10329 | + | |
| 10330 | + | |
| 10331 | + | |
| 10332 | + | |
| 10333 | + | |
| 10334 | + | |
| 10335 | + | |
| 10336 | + | |
| 10337 | + | |
| 10338 | + | |
| 10339 | + | |
| 10340 | + | |
| 10341 | + | |
| 10342 | + | |
| 10343 | + | |
| 10344 | + | |
| 10345 | + | |
| 10346 | + | |
| 10347 | + | |
| 10348 | + | |
| 10349 | + | |
| 10350 | + | |
| 10351 | + | |
| 10352 | + | |
| 10353 | + | |
| 10354 | + | |
| 10355 | + | |
10303 | 10356 |
| |
10304 | 10357 |
| |
10305 | 10358 |
| |
| |||
10342 | 10395 |
| |
10343 | 10396 |
| |
10344 | 10397 |
| |
10345 |
| - | |
10346 |
| - | |
10347 | 10398 |
| |
10348 | 10399 |
| |
10349 | 10400 |
| |
|
Lines changed: 52 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
503 | 503 |
| |
504 | 504 |
| |
505 | 505 |
| |
| 506 | + | |
506 | 507 |
| |
507 | 508 |
| |
508 | 509 |
| |
| |||
6826 | 6827 |
| |
6827 | 6828 |
| |
6828 | 6829 |
| |
| 6830 | + | |
| 6831 | + | |
| 6832 | + | |
| 6833 | + | |
| 6834 | + | |
| 6835 | + | |
| 6836 | + | |
| 6837 | + | |
| 6838 | + | |
| 6839 | + | |
| 6840 | + | |
| 6841 | + | |
| 6842 | + | |
| 6843 | + | |
| 6844 | + | |
| 6845 | + | |
6829 | 6846 |
| |
6830 | 6847 |
| |
6831 | 6848 |
| |
| |||
6838 | 6855 |
| |
6839 | 6856 |
| |
6840 | 6857 |
| |
6841 |
| - | |
6842 |
| - | |
6843 |
| - | |
6844 |
| - | |
6845 |
| - | |
| 6858 | + | |
| 6859 | + | |
| 6860 | + | |
| 6861 | + | |
| 6862 | + | |
| 6863 | + | |
6846 | 6864 |
| |
| 6865 | + | |
| 6866 | + | |
6847 | 6867 |
| |
6848 | 6868 |
| |
6849 | 6869 |
| |
| |||
6995 | 7015 |
| |
6996 | 7016 |
| |
6997 | 7017 |
| |
6998 |
| - | |
6999 |
| - | |
| 7018 | + | |
| 7019 | + | |
| 7020 | + | |
7000 | 7021 |
| |
7001 | 7022 |
| |
7002 | 7023 |
| |
7003 | 7024 |
| |
7004 |
| - | |
| 7025 | + | |
7005 | 7026 |
| |
| 7027 | + | |
| 7028 | + | |
| 7029 | + | |
| 7030 | + | |
| 7031 | + | |
| 7032 | + | |
| 7033 | + | |
| 7034 | + | |
| 7035 | + | |
| 7036 | + | |
| 7037 | + | |
| 7038 | + | |
| 7039 | + | |
| 7040 | + | |
| 7041 | + | |
| 7042 | + | |
| 7043 | + | |
| 7044 | + | |
| 7045 | + | |
| 7046 | + | |
| 7047 | + | |
| 7048 | + | |
7006 | 7049 |
| |
7007 | 7050 |
| |
7008 | 7051 |
| |
7009 | 7052 |
| |
7010 | 7053 |
| |
7011 | 7054 |
| |
7012 |
| - | |
7013 |
| - | |
7014 |
| - | |
| 7055 | + | |
7015 | 7056 |
| |
7016 | 7057 |
| |
7017 | 7058 |
| |
| |||
7021 | 7062 |
| |
7022 | 7063 |
| |
7023 | 7064 |
| |
7024 |
| - | |
7025 |
| - | |
7026 | 7065 |
| |
7027 | 7066 |
| |
7028 | 7067 |
| |
|
Lines changed: 10 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3274 | 3274 |
| |
3275 | 3275 |
| |
3276 | 3276 |
| |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
3277 | 3287 |
| |
3278 | 3288 |
| |
3279 | 3289 |
| |
3280 | 3290 |
| |
3281 | 3291 |
| |
3282 | 3292 |
| |
3283 | 3293 |
| |
3284 |
| - | |
3285 |
| - | |
3286 |
| - | |
3287 | 3294 |
| |
3288 | 3295 |
| |
3289 | 3296 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1043 | 1043 |
| |
1044 | 1044 |
| |
1045 | 1045 |
| |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
1046 | 1057 |
| |
1047 | 1058 |
| |
1048 | 1059 |
| |
|
0 commit comments
Comments
(0)