11 Commits

Author SHA1 Message Date
Matvey Arye
78d36b52d4 Handle subtxn for cache pinning
This commit adds logic for cache pinning to handle subtxn. It also makes
it easier to find cache pinning leaks. Finally, it fixes handling of
cross-commit operations like VACUUM and CLUSTER. Previously, such
operations incorrectly released that cache pin on the first commit
even though the object was used after that.
2018-01-11 09:35:37 -05:00
Erik Nordström
55bfdf753a Release all cache pins when a transaction ends
Currently, if a transaction ends (normally or abnormally) while a
cache is pinned, that cache will never be released, leading to a
memory leak. This change ensures that all taken cache pins are
released when a transaction ends by registering all pins in a list and
cleaning it up in a transaction end callback. This makes the use of
cache_release() optional. However, timely calls to cache_release() is
still encouraged since it is better to release memory as soon as
possible during long-running transactions.
2017-08-09 13:53:03 +02:00
Matvey Arye
aca7f326b3 Fix extension drop handling
Previously, the extension could end up in a bad state if it
was dropped as part of a cascade. This PR fixes that by
checking explicitly for the presence of the proxy table
to make sure we are not in the middle of an extension
drop. Fixes #73.
2017-06-27 10:57:10 -04:00
Matvey Arye
14ac892c88 Fix possible segfault
Previously cache_destroy NULLed out memory in a MemoryContext that it
just deleted. This could cause a segfault and is fixed by this PR.
2017-06-27 09:27:17 -04:00
Robin Thomas
7b2097a975 ran pgindent successfully with local typedefs; ended up correcting
several code style discrepancies from master.
2017-04-29 18:32:07 -04:00
Erik Nordström
5c2bef47f1 Use a cache's own memory context on cache updates
In case new allocations are made during a cache entry update, we
should use the cache's internal memory context to ensure that new data
is allocated and freed in a way consistent with the rest of the cache.
2017-03-24 08:16:36 +01:00
Erik Nordström
89692c9761 Add cache statistics and do minor cleanup
Track statistics for cache hits and misses in the cache module.
Currently not exposed to SQL, but might be useful for internal
debugging.
2017-03-22 09:57:44 +01:00
Matvey Arye
32c45b75b2 formatting with pgindent 2017-03-06 15:20:00 -05:00
Matvey Arye
4d4ac78ef5 cleanup 2017-03-05 10:13:45 -05:00
Matvey Arye
64e8ec1877 Ordering inserts to avoid deadlocks 2017-03-03 10:10:14 -05:00
Matvey Arye
67ad21ee36 Cache hypertable metadata information for faster inserts.
Add caches for hypertable metadata to make it faster to map
INSERT rows to the chunk they should go into.
2017-03-02 12:24:53 +01:00