hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wan...@apache.org
Subject [4/5] incubator-hawq git commit: HAWQ-409. dangling pointer is used in AORelRemoveHashEntry
Date Wed, 17 Feb 2016 02:26:22 GMT
HAWQ-409. dangling pointer is used in AORelRemoveHashEntry


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

Branch: refs/heads/HAWQ-414
Commit: 6dfef0db3e47cc1b5e82f8498941634e5342ef78
Parents: 4c3a091
Author: Zhanwei Wang <wangzw@apache.org>
Authored: Mon Feb 15 15:27:02 2016 +0800
Committer: Zhanwei Wang <wangzw@apache.org>
Committed: Wed Feb 17 10:19:00 2016 +0800

----------------------------------------------------------------------
 .../access/appendonly/appendonlywriter.c        | 27 +++++++++-----------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6dfef0db/src/backend/access/appendonly/appendonlywriter.c
----------------------------------------------------------------------
diff --git a/src/backend/access/appendonly/appendonlywriter.c b/src/backend/access/appendonly/appendonlywriter.c
index 766113c..35f84ee 100644
--- a/src/backend/access/appendonly/appendonlywriter.c
+++ b/src/backend/access/appendonly/appendonlywriter.c
@@ -504,24 +504,16 @@ AORelRemoveHashEntry(Oid relid, bool checkIsStale)
 	int old_next = 0;
 	Insist(Gp_role == GP_ROLE_DISPATCH);
 
-    if(checkIsStale)
-    {
-        aoentry = (AORelHashEntryData *)hash_search(AppendOnlyHash,
-                (void *) &relid,
-                HASH_FIND,
-                &found);
-        Insist(NULL!=aoentry && aoentry ->staleTid==GetTopTransactionId());
-    }
-
 	aoentry = (AORelHashEntryData *)hash_search(AppendOnlyHash,
-						  (void *) &relid,
-						  HASH_REMOVE,
-						  &found);
+							  (void *) &relid,
+							  HASH_FIND,
+							  &found);
 
-	if (aoentry == NULL)
-	{
+	if(checkIsStale)
+		Insist(NULL!=aoentry && aoentry->staleTid==GetTopTransactionId());
+
+	if (found == false)
 		return false;
-	}
 
 	/* Release all segment file statuses used by this relation. */
 	next = aoentry->head_rel_segfile.next;
@@ -534,6 +526,11 @@ AORelRemoveHashEntry(Oid relid, bool checkIsStale)
 	}
 	aoentry->head_rel_segfile.next = NEXT_END_OF_LIST;
 
+	aoentry = (AORelHashEntryData *)hash_search(AppendOnlyHash,
+							  (void *) &relid,
+							  HASH_REMOVE,
+							  &found);
+
 	if (Debug_appendonly_print_segfile_choice)
 	{
 		ereport(LOG, (errmsg("AORelRemoveHashEntry: Remove hash entry for inactive append-only
"


Mime
View raw message