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/[email protected]
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

-4
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)