Code tightening.
authorRobert Haas <[email protected]>
Thu, 2 Aug 2012 18:31:02 +0000 (18:31 +0000)
committerRobert Haas <[email protected]>
Thu, 2 Aug 2012 18:31:02 +0000 (18:31 +0000)
src/backend/utils/hash/chash.c

index 2da735ab4cdd913e1d54ec99554e82e684e73106..d82582d952f8f96e449a53df352bd544e58c2789 100644 (file)
@@ -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();