Re: "cancelling statement due to user request error" occurs but the transaction has committed.
От | Tom Lane |
---|---|
Тема | Re: "cancelling statement due to user request error" occurs but the transaction has committed. |
Дата | |
Msg-id | 13406.1426807142@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: "cancelling statement due to user request error" occurs but the transaction has committed. (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: "cancelling statement due to user request error"
occurs but the transaction has committed.
|
Список | pgsql-hackers |
Bruce Momjian <bruce@momjian.us> writes: > On Thu, Mar 19, 2015 at 04:36:38PM -0400, Robert Haas wrote: >> So, either way, what happens if the query cancel shows up just an >> instant after you clear the flag? > Oh, good point. This version handles that case addressing only the > log_duration* block. This is just moving the failure cases around, and not by very much either. The core issue here, I think, is that xact.c only holds off interrupts during what it considers to be the commit critical section --- which is okay from the standpoint of transactional consistency. But the complaint has to do with what the client perceives to have happened if a SIGINT arrives somewhere between where xact.c has committed and where postgres.c has reported the commit to the client. If we want to address that, I think postgres.c needs to hold off interrupts for the entire duration from just before CommitTransactionCommand() to just after ReadyForQuery(). That's likely to be rather messy, because there are so many code paths there, especially when you consider error cases. A possible way to do this without incurring unacceptably high risk of breakage (in particular, ending up with interrupts still held off when they shouldn't be any longer) is to assume that there should never be a case where we reach ReadCommand() with interrupts still held off. Then we could invent an additional interrupt primitive "RESET_INTERRUPTS()" that forces InterruptHoldoffCount to zero (and, presumably, then does a CHECK_FOR_INTERRUPTS()); then putting a HOLD_INTERRUPTS() before calling CommitTransactionCommand() and a RESET_INTERRUPTS() before waiting for client input would presumably be pretty safe. On the other hand, that approach could easily mask interrupt holdoff mismatch bugs elsewhere in the code base. regards, tom lane
В списке pgsql-hackers по дате отправления: