GitHub user interma opened a pull request:
https://github.com/apache/incubator-hawq/pull/1373
HAWQ-1618. Segment panic at workfile_mgr_close_file() when transaction
ROLLBACK
**Fix what?**
Segment panic sometimes when transaction rollback.
Core at at `workfile_mgr_close_file() `
**How to fix?**
Workfile memory is alloced in `ExecWorkFile_Create()/ExecWorkFile_Open()`'s
current memory context, and this context will be released early in some cases,
then segment panic in `ntuplestore_cleanup()`.
So should use a appropriate memory context to hold them: its life is the
same as `NTupleStore`.
This fix borrow from gpdb:
https://github.com/greenplum-db/gpdb/commit/f0a0a593bde8cf0c9b9bbc79061a09f7164b54f7#diff-b37908413e016b54a45d549cf0539121
**Test?**
No test, reason:
It's a memory bug, need a appropriate time to cancel query and access a
recycled memory context does always cause panic, very hard to test them.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/interma/interma-hawq workfile
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-hawq/pull/1373.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1373
----
commit 3a933afd4710bc42648600a24bcca4574d11adec
Author: interma <interma@...>
Date: 2018-05-30T06:26:01Z
HAWQ-1618. Segment panic at workfile_mgr_close_file() when transaction
ROLLBACK
----
---