HAWQ-627. Fix core dump in metadata cache
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/fa2600cf Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/fa2600cf Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/fa2600cf Branch: refs/heads/HAWQ-617 Commit: fa2600cfbf24d193a63f25e3286e238278348c6d Parents: ec8e791 Author: ivan <iw...@pivotal.io> Authored: Tue Apr 5 14:15:14 2016 +0800 Committer: ivan <iw...@pivotal.io> Committed: Tue Apr 5 14:15:14 2016 +0800 ---------------------------------------------------------------------- src/backend/cdb/cdbmetadatacache_process.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/fa2600cf/src/backend/cdb/cdbmetadatacache_process.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/cdbmetadatacache_process.c b/src/backend/cdb/cdbmetadatacache_process.c index 6d1292c..7553d09 100644 --- a/src/backend/cdb/cdbmetadatacache_process.c +++ b/src/backend/cdb/cdbmetadatacache_process.c @@ -326,14 +326,14 @@ GenerateMetadataCacheLRUList() { HASH_SEQ_STATUS hstat; MetadataCacheEntry *entry; - long cache_entry_num = hash_get_num_entries(MetadataCache); + long cache_entry_num = 0; LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE); + cache_entry_num = hash_get_num_entries(MetadataCache); - if (MetadataCacheLRUList) - { - list_free_deep(MetadataCacheLRUList); - MetadataCacheLRUList = NULL; + if (cache_entry_num == 0) { + LWLockRelease(MetadataCacheLock); + return; } MetadataCacheEntry** entry_vector = (MetadataCacheEntry**)palloc(sizeof(MetadataCacheEntry*) * cache_entry_num);