Skip to content

Commit 1267d98

Browse files
committed
Remove useless Asserts in Result Cache code
Testing if an unsigned variable is >= 0 is pretty pointless. There's likely enough code in remove_cache_entry() to verify the cache memory accounting is correct in assert enabled builds. These Asserts were not adding much extra cover, even if they had been checking >= 0 on a signed variable. Reported-by: Andres Freund Discussion: https://postgr.es/m/20210402204734.6mo3nfacnljlicgn@alap3.anarazel.de
1 parent 84bc2b1 commit 1267d98

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/backend/executor/nodeResultCache.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ entry_purge_tuples(ResultCacheState *rcstate, ResultCacheEntry *entry)
286286

287287
/* Update the memory accounting */
288288
rcstate->mem_used -= freed_mem;
289-
290-
Assert(rcstate->mem_used >= 0);
291289
}
292290

293291
/*
@@ -346,8 +344,6 @@ remove_cache_entry(ResultCacheState *rcstate, ResultCacheEntry *entry)
346344
*/
347345
rcstate->mem_used -= EMPTY_ENTRY_MEMORY_BYTES(entry);
348346

349-
Assert(rcstate->mem_used >= 0);
350-
351347
/* Remove the entry from the cache */
352348
resultcache_delete_item(rcstate->hashtable, entry);
353349

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy