Remove attempt to make EXPLAIN print something even on error.
Compared to upstream, there was a bunch of changes to the error handling in EXPLAIN, to try to catch errors and produce EXPLAIN output even when an error happens. I don't understand how it was supposed to work, but I don't remember it ever doing anything too useful. And it has the strange effect that if an ERROR happens during EXPLAIN ANALYZE, it is reported to the client as merely a NOTICE. So, revert this to the way it is in the upstream. Also reorder the end-of-EXPLAIN steps so that the "Total runtime" is printed at the very end, like in the upstream. I don't see any reason to differ from upstream on that, and this makes the "Total runtime" numbers more comparable with PostgreSQL's, for what it's worth. I dug up the commit that made these changes in the old git repository, from before GPDB was open sourced: --- commit 1413010e71cb8eae860160ac9d5246216b2a80b4 Date: Thu Apr 12 12:34:18 2007 -0800 MPP-1177. EXPLAIN ANALYZE now can usually produce a report, perhaps a partial one, even if the query encounters a runtime error. The Slice Statistics indicate 'ok' for slices whose worker processes all completed successfully; otherwise it shows how many workers returned errors, were canceled, or were not dispatched. The error message from EXPLAIN in such cases will appear as a NOTICE instead of an ERROR. The client is first sent a successful completion response, followed by the NOTICE. (psql displays the NOTICE before the EXPLAIN report, however.) Although presented to the client as a NOTICE, the backend handles it just like an ERROR with regard to logging, rollback, etc. --- I couldn't figure out under what circumstances that would be helpful, and couldn't come up with an example. Perhaps it used to work differently when it was originally committed, but not anymore? I also looked up the MPP-1177 ticket in the old bug tracking system. The description for that was: --- EXPLAIN ANALYZE should report on the amount of data spilled to temporary workfiles on disk, and how much work_mem would be required to complete the query without spilling to disk. ---- Unfortunately, that description, and the comments that followed it, didn't say anything about suppressing errors or being able to print out EXPLAIN output even if an error happens. So I don't know why that change was made as part of MPP-1177. It was seemingly for a different issue.
Showing
想要评论请 注册 或 登录