pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Dmitriy Sarafannikov <d.sarafannikov@bk.ru>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Too many files in pg_replslot folder
Date: Thu, 10 Mar 2016 12:34:12 -0300
Message-ID: <20160310153412.GA53338@alvherre.pgsql> (raw)
In-Reply-To: <1457621358.355011041@f382.i.mail.ru>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Dmitriy Sarafannikov wrote:
>  Hi, all.
> 
> I tried to test logical replication with 'test_decoding' plugin. 
> I created logical slot and launched pg_recvlogical utility on ~8 hours. 
> When i tried to drop replication slot via pg_drop_replication_slot, backend ate my disk on 100% and didn't want to release him. 
> I saw via strace, that he deletes files:
> 
> lstat("pg_replslot/test_slot.tmp/xid-2917185562-lsn-4981-AE000000.snap", {st_mode=S_IFREG|0600, st_size=169, ...}) = 0
> unlink("pg_replslot/test_slot.tmp/xid-2917185562-lsn-4981-AE000000.snap") = 0

> He seemed to be in infinite loop. 1109428 files were in the slot folder.
> It looks like abnormal behavior. Why are so many files?
> Maybe i'm doing something wrong? Or maybe it is bug?
> How i can avoid this?

Well, the files are all different in what you reported, so I would say
it's not a loop but a very long sequence.

This can happen if you have a very long transaction while the snapshot
for the slot is being built, and a million other transactions happen
before the long transaction commits.  One way in which this would go on
and on until it fills the disk is that you have a prepared transaction
that you forgot about (See select * from pg_prepared_xacts to diagnose
this one).  Or you could just have a very long transaction (see select *
from pg_stat_activity).

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (8+ messages)  latest in thread

Message-ID: <20160310153412.GA53338@alvherre.pgsql>
Permalink:  ../20160310153412.GA53338@alvherre.pgsql/
Also on:    postgresql.org/message-id/20160310153412.GA53338@alvherre.pgsql

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, d.sarafannikov@bk.ru
  Subject: Re: Too many files in pg_replslot folder
  In-Reply-To: <20160310153412.GA53338@alvherre.pgsql>

* 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