pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix ReorderBuffer memory overflow check.
Date: Wed, 10 Jun 2020 05:15:11 +0000
Message-ID: <E1jit4x-0005KK-AA@gemulon.postgresql.org> (raw)

Fix ReorderBuffer memory overflow check.

Commit cec2edfa78 introduced logical_decoding_work_mem to limit
ReorderBuffer memory usage. We spill the changes once the memory occupied
by changes exceeds logical_decoding_work_mem.  There was an assumption
in the code that by evicting the largest (sub)transaction we will come
under the memory limit as the selected transaction will be at least as
large as the most recent change (which caused us to go over the memory
limit).  However, that is not true because a user can reduce the
logical_decoding_work_mem to a smaller value before the most recent
change.

We fix it by allowing to evict the transactions until we reach under the
memory limit.

Reported-by: Fujii Masao
Author: Amit Kapila
Reviewed-by: Fujii Masao
Backpatch-through: 13, where it was introduced
Discussion: https://postgr.es/m/2b7ba291-22e0-a187-d167-9e5309a3458d@oss.nttdata.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/16a8d5cf0337724affc4bbb3e8ba07f748f00898

Modified Files
--------------
src/backend/replication/logical/reorderbuffer.c | 54 +++++++++++++------------
1 file changed, 29 insertions(+), 25 deletions(-)



view thread (2+ messages)

Message-ID: <E1jit4x-0005KK-AA@gemulon.postgresql.org>
Permalink:  ../E1jit4x-0005KK-AA@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jit4x-0005KK-AA@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org
  Subject: Re: pgsql: Fix ReorderBuffer memory overflow check.
  In-Reply-To: <E1jit4x-0005KK-AA@gemulon.postgresql.org>
  References: <E1jit4x-0005KK-AA@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox