aboutsummaryrefslogtreecommitdiff
path: root/src/backend/jit/llvm/llvmjit_expr.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-06-07 13:44:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2020-06-07 13:44:13 -0400
commit7247e243a803044a79a2828ced51b05765e049a0 (patch)
treeb45e64782487848309fee82939f499c96399ba93 /src/backend/jit/llvm/llvmjit_expr.c
parent92f33bb7afd373ed562e23077c14831944d1b0d4 (diff)
downloadpostgresql-7247e243a803044a79a2828ced51b05765e049a0.tar.gz
postgresql-7247e243a803044a79a2828ced51b05765e049a0.zip
Try to read data from the socket in pqSendSome's write_failed paths.
Even when we've concluded that we have a hard write failure on the socket, we should continue to try to read data. This gives us an opportunity to collect any final error message that the backend might have sent before closing the connection; moreover it is the job of pqReadData not pqSendSome to close the socket once EOF is detected. Due to an oversight in 1f39a1c06, pqSendSome failed to try to collect data in the case where we'd already set write_failed. The problem was masked for ordinary query operations (which really only make one write attempt anyway), but COPY to the server would continue to send data indefinitely after a mid-COPY connection loss. Hence, add pqReadData calls into the paths where pqSendSome drops data because of write_failed. If we've lost the connection, this will eventually result in closing the socket and setting CONNECTION_BAD, which will cause PQputline and siblings to report failure, allowing the application to terminate the COPY sooner. (Basically this restores what happened before 1f39a1c06.) There are related issues that this does not solve; for example, if the backend sends an error but doesn't drop the connection, we did and still will keep pumping COPY data as long as the application sends it. Fixing that will require application-visible behavior changes though, and anyway it's an ancient behavior that we've had few complaints about. For now I'm just trying to fix the regression from 1f39a1c06. Per a complaint from Andres Freund. Back-patch into v12 where 1f39a1c06 came in. Discussion: https://postgr.es/m/20200603201242.ofvm4jztpqytwfye@alap3.anarazel.de
Diffstat (limited to 'src/backend/jit/llvm/llvmjit_expr.c')
0 files changed, 0 insertions, 0 deletions