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
releasehim.
> 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