forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitcb988b0
committed
Reduce memory block size for decoded tuple storage to 8kB.
Commita4ccc1c introduced the Generation Context and modified thelogical decoding process to use a Generation Context with a fixedblock size of 8MB for storing tuple data decoded during logicaldecoding (i.e., rb->tup_context). Several reports have indicated thatthe logical decoding process can be terminated due toout-of-memory (OOM) situations caused by excessive memory usage inrb->tup_context.This issue can occur when decoding a workload involving severalconcurrent transactions, including a long-running transaction thatmodifies tuples. By design, the Generation Context does not free amemory block until all chunks within that block arereleased. Consequently, if tuples modified by the long-runningtransaction are stored across multiple memory blocks, these blocksremain allocated until the long-running transaction completes, leadingto substantial memory fragmentation. The memory usage during logicaldecoding, tracked by rb->size, does not account for memoryfragmentation, resulting in potentially much higher memory consumptionthan the value of the logical_decoding_work_mem parameter.Various improvement strategies were discussed in the relevantthread. This change reduces the block size of the Generation Contextused in rb->tup_context from 8MB to 8kB. This modificationsignificantly decreases the likelihood of substantial memoryfragmentation occurring and is relatively straightforward tobackport. Performance testing across multiple platforms has confirmedthat this change will not introduce any performance degradation thatwould impact actual operation.Backport to all supported branches.Reported-by: Alex Richman, Michael Guissine, Avi WeinbergReviewed-by: Amit Kapila, Fujii Masao, David RowleyTested-by: Hayato Kuroda, Shlok KyalDiscussion:https://postgr.es/m/CAD21AoBTY1LATZUmvSXEssvq07qDZufV4AF-OHh9VD2pC0VY2A%40mail.gmail.comBackpatch-through: 121 parent76de4b1 commitcb988b0
1 file changed
+9
-1
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
300 | 300 |
| |
301 | 301 |
| |
302 | 302 |
| |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
303 | 311 |
| |
304 | 312 |
| |
305 |
| - | |
| 313 | + | |
306 | 314 |
| |
307 | 315 |
| |
308 | 316 |
| |
|
0 commit comments
Comments
(0)