Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWJGB-0000al-Kt for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Mar 2022 14:43:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nWJGA-000384-5T for pgsql-bugs@arkaria.postgresql.org; Mon, 21 Mar 2022 14:43:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWJG9-00037t-SZ for pgsql-bugs@lists.postgresql.org; Mon, 21 Mar 2022 14:43:49 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWJG3-0007jB-B7 for pgsql-bugs@postgresql.org; Mon, 21 Mar 2022 14:43:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mJudblgUEPq6zrH1EtaaXosb4u7T/gjxBli4vkbPagc=; b=ed+QGt2I5gox5Ftm6qCHnBxYK+ zGgortm1Qbs1+YPDZQp1gyqSRDL7GJJIEILPjPuNA883uswQ3+a6WTTJGDZQ8O2qGgytIXL58TSsA 5ajtnqa/bge5iSztwqawTD67IiEjTSZWnCnaO0LdVULOtchPswyOr4N3RUPaXt5szPFU=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1nWJG1-0007TB-R7; Mon, 21 Mar 2022 15:43:41 +0100 Date: Mon, 21 Mar 2022 15:43:41 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: vignesh C Cc: pgsql-bugs mailing list Subject: Re: Logical replication stops dropping used initial-sync replication slots Message-ID: <20220321144341.GA27089@depesz.com> Reply-To: depesz@depesz.com References: <20220317142426.GA727@depesz.com> <20220318122758.GA25022@depesz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 21, 2022 at 07:48:20PM +0530, vignesh C wrote: > > What can I do about it? > > >2022-03-17 13:32:48.119 UTC,,,2923553,,62333880.2c9c21,2,,2022-03-17 13:32:48 UTC,8/447946,23877409,ERROR,53400,"could not find free replication state slot for replication origin with OID 51",,"Increase max_replication_slots and try again.",,,,,,,"","logical replication worker",,0 > Each Tablesync worker needs a replication slot to synchronize the data > to the subscriber, this error means there are not enough replication > slots. Try to increase max_replication_slots configuration if it is > set to lower value as you are using around 60k tables. yeah, but I don't need 60k replication slots? Please note that replication (initial sync) *IS* working happily for *some* time, and only then starts "eating" replication slots for whatever reason. Specifically - I have max_replication_slots set to 50 (per my original mail), and sync workers shouldn't exceed 10. > > 2022-03-17 18:28:54.189 UTC,"lrep_user","dbname",17706,"10.2.210.180:35794",62337de5.452a,13,"idle",2022-03-17 18:28:53 UTC,16/0,0,LOG,00000,"logical decoding found initial starting point at 8FB/83FCA7D8","Waiting for transactions (approximately 1) older than 160417372 to end.",,,,,"START_REPLICATION SLOT > > Snapshot builder is waiting for the open transaction to finish. Is it > possible that there are some open transactions that were started > during this logical replication. I felt once the transaction > completes, snapshot building and tablesync operation should finish. There are no long open transacitons there. This is test box with *zero* traffic (aside from running in a loop: create table, drop table), but *NOT* in transaction. Best regards, depesz