Skip to content

Commit

Permalink
Manage life-cycle of connections via memory contexts
Browse files Browse the repository at this point in the history
Tie the life cycle of a data node connection to the memory context it
is created on. Previously, a data node connection was automatically
closed at the end of a transaction, although often a connection needs
to live beyond a single transaction. For example, a connection cache
is maintained for data node connections, and, for such cases, a flag
was set on a connection to avoid closing it automatically.

Instead of tying connections to transactions, they are now life-cycle
managed via memory contexts. This simplifies the handling of
connections and avoids having to create exceptions to closing
connections at transaction end.
  • Loading branch information
erimatnor committed Jan 30, 2023
1 parent 8721284 commit cce0e18
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 273 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ accidentally triggering the load of a previous DB version.**

**Features**
* #5241 Allow RETURNING clause when inserting into compressed chunks
* #5245 Mange life-cycle of connections via memory contexts

**Bugfixes**
* #4804 Skip bucketing when start or end of refresh job is null
Expand Down
4 changes: 1 addition & 3 deletions src/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ extern TSDLLEXPORT void ts_cache_init(Cache *cache);
extern TSDLLEXPORT void ts_cache_invalidate(Cache *cache);
extern TSDLLEXPORT void *ts_cache_fetch(Cache *cache, CacheQuery *query);
extern TSDLLEXPORT bool ts_cache_remove(Cache *cache, void *key);

extern MemoryContext ts_cache_memory_ctx(Cache *cache);

extern TSDLLEXPORT MemoryContext ts_cache_memory_ctx(Cache *cache);
extern TSDLLEXPORT Cache *ts_cache_pin(Cache *cache);
extern TSDLLEXPORT int ts_cache_release(Cache *cache);

Expand Down
Loading

0 comments on commit cce0e18

Please sign in to comment.