mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Improve memory use in logical replication apply
Previously, the memory used by the logical replication apply worker for processing messages would never be freed, so that could end up using a lot of memory. To improve that, change the existing ApplyContext memory context to ApplyMessageContext and reset that after every message (similar to MessageContext used elsewhere). For consistency of naming, rename the ApplyCacheContext to ApplyContext. Author: Stas Kelvich <s.kelvich@postgrespro.ru>
This commit is contained in:
@@ -265,6 +265,17 @@ from prepared statements simply reference the prepared statements' trees,
|
||||
and don't actually need any storage allocated in their private contexts.
|
||||
|
||||
|
||||
Logical Replication Worker Contexts
|
||||
-----------------------------------
|
||||
|
||||
ApplyContext --- permanent during whole lifetime of apply worker. It
|
||||
is possible to use TopMemoryContext here as well, but for simplicity
|
||||
of memory usage analysis we spin up different context.
|
||||
|
||||
ApplyMessageContext --- short-lived context that is reset after each
|
||||
logical replication protocol message is processed.
|
||||
|
||||
|
||||
Transient Contexts During Execution
|
||||
-----------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user