Re: Help troubleshooting SubtransControlLock problems - Mailing list pgsql-general

From Scott Frazer
Subject Re: Help troubleshooting SubtransControlLock problems
Date
Msg-id CA+ey=amxyG=vvr5ednb+-PC=3nTWZ7TcNyrOGzSDRGZURaZ3mA@mail.gmail.com
Whole thread Raw
In response to Re: Help troubleshooting SubtransControlLock problems  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Help troubleshooting SubtransControlLock problems  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-general
On Wed, Mar 7, 2018 at 10:39 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> Laurenz Albe wrote:
> I think you could get in this situation if the range of open
> transactions exceeds what fits in the buffers for subtrans.c pages, and
> the subtransaction cache overflows (64 entries apiece;
> PGPROC_MAX_CACHED_SUBXIDS in src/include/storage/proc.h).  Each page is
> 2048 transactions (4 bytes per xact, 8192 bytes per page;
> SUBTRANS_XACTS_PER_PAGE in src/backend/access/transam/subtrans.c), and
> we keep 32 pages (NUM_SUBTRANS_BUFFERS src/include/access/subtrans.h).
> So if your oldest transaction is over 64k XIDs old, and you have
> transactions with more than 64 subtransactions, you get in trouble.
>
> A simple solution is to increase NUM_SUBTRANS_BUFFERS and recompile.

Currently this seems to be happening when the server just starts taking connections. It doesn't even need time to scale up anymore (previously it took about 8 hours for the problem to re-appear)

It's only happening on the read replicas, though. I've just set my master to handle all the traffic, but that's not really sustainable

pgsql-general by date:

Previous
From: PegoraroF10
Date:
Subject: Re: Replication pull instead of push
Next
From: Alvaro Herrera
Date:
Subject: Re: Help troubleshooting SubtransControlLock problems