model-writtenrun 523 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Korotkov reported that Append rescans cleared callback_pending while postgres_fdw still tracked an outstanding request, and proposed deferring cleanup until ExecAppendAsyncBegin() in #1; Alexander Pyhalov initially endorsed the analysis and fix in #3.
- Gleb Kashkin demonstrated in #4 that deferred cleanup could deliver a stale tuple from a partition pruned on the next scan, establishing that the original approach did not preserve query correctness.
- Etsuro Fujita replaced deferred cleanup with draining during ExecReScanAppend() in #5, leaving possible performance optimization for v20 because he lacked a backpatchable approach.
- Korotkov offered to commit the fix in #6, but Fujita requested responsibility and further refinement in #7, then scheduled completion before the August releases in #9.
- Pyhalov identified a possible busy loop caused by as_syncdone in #10; Fujita addressed it in #11, added interrupt checks, consolidated draining and reset, removed redundant postgres_fdw cleanup, and expanded tests, earning Pyhalov’s approval in #12.
- Kashkin found another hang when stale as_needrequest markers prevented event registration on a connection shared by different Appends in #14, and supplied a delta with a reproducer in #15.
- Fujita incorporated Kashkin’s loop-state cleanup into #16, adding assertions and revising comments, but omitted the environment-dependent reproducer to avoid increasing regression-test runtime.
- Fujita committed #16 as f57df20681 with a comment clarification and regression-query operand reordering, then confirmed backpatching through PostgreSQL 14 in #18.
- The fix was landed by the final message, but Fujita explained in #18 that the new tests were omitted from the PostgreSQL 14 backpatch because they did not exercise asynchronous execution there; he left suitable v14 tests as possible follow-up work and documented another slow reproducer without adding it to the suite.