Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fqJs5-0005q6-FL for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Aug 2018 15:07:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fqJs3-0006Ue-0w for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Aug 2018 15:07:31 +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.89) (envelope-from ) id 1fqJs2-0006UW-Ik for pgsql-hackers@lists.postgresql.org; Thu, 16 Aug 2018 15:07:30 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fqJrv-0007MM-3p for pgsql-hackers@postgresql.org; Thu, 16 Aug 2018 15:07:29 +0000 Received: by mail-wr1-x441.google.com with SMTP id w11-v6so1895119wrc.5 for ; Thu, 16 Aug 2018 08:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Ja3wU1YttZgtkFVS7wl0YMxiYYUH6j/mv6g46jP2QD0=; b=mmP1LgIhbgdc40rS/cME0555PHXSR3vZFwG2ZaM3hCYfwokIlWtwIz3YKhA+mvJj2R rhbKYGGLKZkM5CS8GLkIwjSnUBahvV4aXUAUemHIJwwLM+Ik1wa5LGDs7b8pl4NckTbB Azzl3x7W5xUwqhMZUBQ71ekGuNECDLFvknzC1fuODt289XAS4cx6kZJM6l9wxRo6o8WK 8RcpYV0Vle2HlyA3uQC2aTQB/Z/+66MckoYnZ4zLR19v3Sjdo3GWXETmCWWGxPI+HvMw WOWTC+FHnQmow1DEl2/ZK16UbBxCyvDkEwo902Ekvfu+KvJE3A/JbDIbiEKq2BauugpR sJmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Ja3wU1YttZgtkFVS7wl0YMxiYYUH6j/mv6g46jP2QD0=; b=M+ZYcRuUCcxEzNiLVEOCSzHgOWdjyzHt9PxcQMnKkLJZHW7WukKI2niKtnfZ9XwA1z tEZHHIY3AXgi++81EPY6EGG2Q9sT9gqCAd34ODS+8RyA1ynUwVec/+1HcRElUpSfrCFY ifHUzMdgPCYmCrDc4Ki5HIu+hRs86RRrstJ4S/5PXaPxbKUCpflCiVm4ENix5PvbcUQ0 6Cn6ahSowrtoakEKfldhQBhmsaV1UCq6qi2vchDQwKYMeTFZ5VA4yQ8eFXWWijtkGDYB o0puWScJpae2c2D74gbkVMT/M5KJTWUCEx/4yshlkSL91j11LPc0ygCQcQP+4k3eU1VE vAOg== X-Gm-Message-State: AOUpUlEQtAG3kER9EeD6lUdxGbWsUv853nI7nzcHiXQNb3BxkzuB9pH8 D0kPOcryO9VG8QHynUW6A0DZBMqOZzAWhFngzaMhvBS9m25OXWuB+m9hBp5hYCs/l9LTbCjoUXD Vgg4YGI17E9gbUeKjDuP6GqSsSuQO6DQQSBkFlynQjEYs9DA2XQBwlsGGy+/z+yKZWr2rxotBUD XD3395Gj+N6k9RYw== X-Google-Smtp-Source: AA+uWPzEw1JX2ooHZpz7h84SUznNvBj8RXraGXZyhc5iwFGn3FhculSVV5UQqP3vCTT4WWWvaQ+5AQ== X-Received: by 2002:adf:e992:: with SMTP id h18-v6mr20261363wrm.238.1534432040981; Thu, 16 Aug 2018 08:07:20 -0700 (PDT) Received: from [10.137.2.19] (ip-86-49-245-142.net.upcbroadband.cz. [86.49.245.142]) by smtp.gmail.com with ESMTPSA id u14-v6sm27525655wrs.57.2018.08.16.08.07.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 08:07:20 -0700 (PDT) Subject: Re: logical decoding / rewrite map vs. maxAllocatedDescs From: Tomas Vondra To: Tom Lane Cc: Andres Freund , Alvaro Herrera , PostgreSQL-development References: <20180809174746.aa6rbpsu4zjipzif@alvherre.pgsql> <20180810211340.nlgyfa7jlmkjcs5m@alap3.anarazel.de> <79a0c7f4-89fb-cf8d-82eb-5a7ca8e08d56@2ndquadrant.com> <6899.1533996956@sss.pgh.pa.us> <53047b69-9af7-1399-d190-6d7db60a7dd8@2ndquadrant.com> Message-ID: <82d51b43-3b98-38e5-2e37-a8959b13ef49@2ndquadrant.com> Date: Thu, 16 Aug 2018 17:07:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <53047b69-9af7-1399-d190-6d7db60a7dd8@2ndquadrant.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 08/11/2018 04:18 PM, Tomas Vondra wrote: > On 08/11/2018 04:15 PM, Tom Lane wrote: >> Tomas Vondra writes: >>>>> On 08/09/2018 07:47 PM, Alvaro Herrera wrote: >>>>>> Actually, it seems to me that ApplyLogicalMappingFile is just leaking >>>>>> the file descriptor for no good reason. >> >>> I think the fix can be as simple as attached ... I'm mostly afk for the >>> weekend, so I'll commit & backpatch on Monday or so. >> >> LGTM. While you're at it, would you fix the misspelling three lines >> below this? >> >> * Check whether the TransactionOId 'xid' is in the pre-sorted array 'xip'. >> ^ > > Sure. > I've pushed this, and backpatched it all the way back to 9.4 where logical decoding was introduced. While this resolves the way to run out of file descriptors, I wonder if there are other trivial ways to trigger it (say, long-running transaction spanning many 'vacuum full pg_class' runs). Not sure, will try later. The other question is whether errors are handled correctly - as reported initially, I've seen this to trigger ERROR: XX000: subtransaction logged without previous top-level txn record I assume just fixing the error did not really fix that, so that if something else fails we might end up in the same state. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services