Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ae2bn-0008SC-I2 for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Mar 2016 15:34:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ae2bn-00037f-4K for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Mar 2016 15:34:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ae2bm-00037J-4t for pgsql-bugs@postgresql.org; Thu, 10 Mar 2016 15:34:38 +0000 Received: from out.smtp-auth.no-ip.com ([8.23.224.60]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ae2bf-0008IE-7I for pgsql-bugs@postgresql.org; Thu, 10 Mar 2016 15:34:36 +0000 X-No-IP: alvh.no-ip.org@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from alvin.alvh.no-ip.org (unknown [190.8.79.154]) (Authenticated sender: alvh.no-ip.org@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id EBCE8400A43; Thu, 10 Mar 2016 07:34:29 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 72E8D517; Thu, 10 Mar 2016 12:34:12 -0300 (CLT) Date: Thu, 10 Mar 2016 12:34:12 -0300 From: Alvaro Herrera To: Dmitriy Sarafannikov Cc: PostgreSQL Bugs Subject: Re: Too many files in pg_replslot folder Message-ID: <20160310153412.GA53338@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1457621358.355011041@f382.i.mail.ru> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -0.4 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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