From 20eb43ac377ec3a64a9b34b6978265290fd977c2 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 2 Aug 2012 18:31:02 +0000 Subject: [PATCH] Code tightening. --- src/backend/utils/hash/chash.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/backend/utils/hash/chash.c b/src/backend/utils/hash/chash.c index 2da735ab4c..d82582d952 100644 --- a/src/backend/utils/hash/chash.c +++ b/src/backend/utils/hash/chash.c @@ -539,7 +539,6 @@ CHashDelete(CHashTable table, void *entry) uint32 hashcode = hash_any(entry, table->desc.key_size); uint32 bucket = hashcode & table->bucket_mask; CHashPtr *b = &table->bucket[bucket]; - bool cleanup_scan = false; CHashScanResult scan; /* Prevent garbage collection for this bucket. */ @@ -577,27 +576,25 @@ CHashDelete(CHashTable table, void *entry) CHashPtrUnmark(next))) CHashAddToGarbage(table, bucket, scan.target); else - cleanup_scan = true; + { + CHashScanResult cleanup_scan; + + /* + * If we weren't able to remove the deleted item, rescan + * the bucket to make sure it's really gone. This is just + * like a regular bucket scan, except that we don't care + * about the results. We're just doing it to achieve the + * side-effect of removing delete-marked nodes from the + * bucket chain. + */ + CHashTableIncrementStatistic(table, CHS_Cleanup_Scan); + CHashBucketScan(table, b, hashcode, entry, &cleanup_scan); + } break; } CHashTableIncrementStatistic(table, CHS_Delete_Retry); } - /* - * If we weren't able to remove the deleted item, rescan the bucket - * to make sure it's really gone. This is just like a regular bucket - * scan, except that we don't care about the results. We're just doing - * it to achieve the side-effect of removing delete-marked nodes from - * the bucket chain. - */ - if (cleanup_scan) - { - CHashScanResult cleanup_scan; - - CHashTableIncrementStatistic(table, CHS_Cleanup_Scan); - CHashBucketScan(table, b, hashcode, entry, &cleanup_scan); - } - /* Allow garbage collection for this bucket. */ Assert(MyProc->hazard[0] != NULL); pg_memory_barrier(); -- 2.39.5