Repository: incubator-hawq
Updated Branches:
  refs/heads/master 4cd0c565b -> 9f76faa70


HAWQ-1525. Segmentation fault occurs if reindex database when loading data from 
Hive to HAWQ using hcatalog


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/9f76faa7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/9f76faa7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/9f76faa7

Branch: refs/heads/master
Commit: 9f76faa70545f0aefa38b6b1b4506f13dd16cdb4
Parents: 4cd0c56
Author: wcl14 <[email protected]>
Authored: Thu Sep 14 14:35:24 2017 +0800
Committer: wcl14 <[email protected]>
Committed: Thu Sep 14 14:35:24 2017 +0800

----------------------------------------------------------------------
 src/backend/cdb/cdbinmemheapam.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/9f76faa7/src/backend/cdb/cdbinmemheapam.c
----------------------------------------------------------------------
diff --git a/src/backend/cdb/cdbinmemheapam.c b/src/backend/cdb/cdbinmemheapam.c
index 7f15790..db08bbf 100644
--- a/src/backend/cdb/cdbinmemheapam.c
+++ b/src/backend/cdb/cdbinmemheapam.c
@@ -310,6 +310,16 @@ InMemHeap_BeginScan(InMemHeapRelation memheap, int nkeys,
     InMemHeapScanDesc scan = palloc0(sizeof (InMemHeapScanDescData));
     Assert(NULL != scan);
 
+    /*
+     * HAWQ-1525
+     *
+     * The rel in InMemHeapRelation is a pointer, which is the address of heap 
relation
+     * in relcache. When the heap relation in relcache is clear for some 
reason,
+     * the value of rel in InMemHeapRelation is wrong. So we should reopen 
this relation
+     * to make sure it's correct.
+     */
+    memheap->rel = RelationIdGetRelation(memheap->relid);
+
     scan->rs_rd = memheap;
     scan->rs_nkeys = nkeys;
     scan->rs_index = -1;
@@ -408,6 +418,8 @@ InMemHeap_EndScan(InMemHeapScanDesc scan)
 {
     Assert(NULL != scan);
 
+    RelationClose(scan->rs_rd->rel);
+
     if (NULL != scan->rs_key)
     {
         pfree(scan->rs_key);

Reply via email to