You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by wa...@apache.org on 2016/02/15 08:27:55 UTC
incubator-hawq git commit: HAWQ-409. dangling pointer is used in
AORelRemoveHashEntry
Repository: incubator-hawq
Updated Branches:
refs/heads/HAWQ-409 [created] 3f173db35
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/3f173db3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/3f173db3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/3f173db3
Branch: refs/heads/HAWQ-409
Commit: 3f173db355fecfcdcd01bd50dce1b36eda7bda82
Parents: bf1cab1
Author: Zhanwei Wang <wa...@apache.org>
Authored: Mon Feb 15 15:27:02 2016 +0800
Committer: Zhanwei Wang <wa...@apache.org>
Committed: Mon Feb 15 15:27:02 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/3f173db3/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 "