forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit92c4c26
committed
Move memory accounting Asserts for Result Cache code
In9eacee2, I included some code to verify the cache's memory trackingis correct by counting up the number of entries and the memory they useeach time we evict something from the cache. Those values are thencompared to the expected values using Assert. The problem is that thisrequires looping over the entire cache hash table each time we evict anentry from the cache. That can be pretty expensive, as noted by PavelStehule.Here we move this memory accounting checking code so that we only verifyit on cassert builds once when shutting down the Result Cache node.Aside from the performance increase, this has two distinct advantages:1) We do the memory checks at the last possible moment before destroying the cache. This means we'll now catch accounting problems that might sneak in after a cache eviction.2) We now do the memory Assert checks when there were no cache evictions. This increases the coverage.One small disadvantage is that we'll now miss any memory tracking issuesthat somehow managed to resolve themselves by the end of execution.However, it seems to me that such a memory tracking problem would be quiteunlikely, and likely somewhat less harmful if one were to exist.In passing, adjust the loop over the hash table to use the standardsimplehash.h method of iteration.Reported-by: Pavel StehuleDiscussion:https://postgr.es/m/CAFj8pRAzgoSkdEiqrKbT=7yG9FA5fjUAP3jmJywuDqYq6Ki5ug@mail.gmail.com1 parenta55a984 commit92c4c26
1 file changed
+29
-35
lines changedLines changed: 29 additions & 35 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
298 | 298 |
| |
299 | 299 |
| |
300 | 300 |
| |
301 |
| - | |
302 |
| - | |
303 |
| - | |
304 |
| - | |
305 |
| - | |
306 |
| - | |
307 |
| - | |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 |
| - | |
313 |
| - | |
314 |
| - | |
315 |
| - | |
316 |
| - | |
317 |
| - | |
318 |
| - | |
319 |
| - | |
320 |
| - | |
321 |
| - | |
322 |
| - | |
323 |
| - | |
324 |
| - | |
325 |
| - | |
326 |
| - | |
327 |
| - | |
328 |
| - | |
329 |
| - | |
330 |
| - | |
331 |
| - | |
332 |
| - | |
333 |
| - | |
334 |
| - | |
335 |
| - | |
336 | 301 |
| |
337 | 302 |
| |
338 | 303 |
| |
| |||
977 | 942 |
| |
978 | 943 |
| |
979 | 944 |
| |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
980 | 974 |
| |
981 | 975 |
| |
982 | 976 |
| |
|
0 commit comments
Comments
(0)