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 1lJJWX-0006G8-DT for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Mar 2021 17:18:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJJWW-00078k-74 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Mar 2021 17:18:28 +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 1lJJWV-00077w-WF for pgsql-hackers@lists.postgresql.org; Mon, 08 Mar 2021 17:18:28 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lJJWT-0001EY-1k for pgsql-hackers@postgresql.org; Mon, 08 Mar 2021 17:18:27 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 18so22192936lff.6 for ; Mon, 08 Mar 2021 09:18:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hagander-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+QXA5F2W0W8frKLNbrryXEgfth5FK1+CKHA9Nfr38ec=; b=ecqMDjh2Qz3DjxD2uQfl4ABcVw2pshnoAMaiTkpoVE0reK9ZJD1efK1LKVZSkTbBaZ fEjnjFU9pKJQzY6/YpW85HC2j0HWfcaBJxlXhP9TVYVEZk4tIyqAFwS6qOX0yfkHipyw irs+lcvRWjStd6cmj+HqUXuX4QkYh3Pk28za34kwz79iXZN4uXZ0xQM2/LuLLcBf7qxP KySLKQxxp4cKAzBfGorw2GRGMJ1kUxm19SOjtKvxdPX5N+naYWN+UO9Mttkda4P9MkfS N9MCijzqLSQnbuLS4XROqpjdUf/GVgtIZ6vJkS77Ylqx1duPY9K9j+t1+QEFkpCsc521 ZYzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+QXA5F2W0W8frKLNbrryXEgfth5FK1+CKHA9Nfr38ec=; b=TtUpcHecvwIwc9/kh5gte7F/BjJV7pk3qaKG1US46NySL1C2uxGoqRqyek519yEtKV 07kyiQsW1lKuoPIHzhaMt+Jr6BT8bfvvlm+Un+jZf3Xtel5PBt54ULGUBw/fATBdIHYr LlX4iglxq1T6AFVakeA/pnIHdgXnuc0l1s8mKqeAAoNfFAZrQd7xE4rRv/BDtJTqnibY bxtCd6cr8CMJSCUacuHWeJi4P2VcLemS6QpNpfh9Hp06tNl5MPPte9wvpLSQkMQfyi+c N7jEjsWGrXYChBVubOfashqtfO145sYn0Tq0nr6Qgb8Qfa10UCcGVDRcVCRww75Qi5Xb XTWA== X-Gm-Message-State: AOAM5324cI1UfLDkf1/gjPOPcXfnUMtFyoc3haLgou0khqEz5gSMsZnj 2i6dhVkbGdr6cEHopaDQbmcS2WXqe/f76Rj7Gg/qpw== X-Google-Smtp-Source: ABdhPJwZZmqk+4L7k3hb0KRS+9jidM4846v42OWHysBShK9rZdvOpHCUFdYJZI2egrn+LZjIRAt6izzDRhyz576NNbA= X-Received: by 2002:ac2:4292:: with SMTP id m18mr166694lfh.430.1615223904110; Mon, 08 Mar 2021 09:18:24 -0800 (PST) MIME-Version: 1.0 References: <1742698.1615221182@sss.pgh.pa.us> <1743618.1615222719@sss.pgh.pa.us> In-Reply-To: <1743618.1615222719@sss.pgh.pa.us> From: Magnus Hagander Date: Mon, 8 Mar 2021 18:18:12 +0100 Message-ID: Subject: Re: pg_upgrade failing for 200+ million Large Objects To: Tom Lane Cc: Robins Tharakan , Peter Eisentraut , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 8, 2021 at 5:58 PM Tom Lane wrote: > > Magnus Hagander writes: > > On Mon, Mar 8, 2021 at 5:33 PM Tom Lane wrote: > >> It does seem that --single-transaction is a better idea than fiddling with > >> the transaction wraparound parameters, since the latter is just going to > >> put off the onset of trouble. However, we'd have to do something about > >> the lock consumption. Would it be sane to have the backend not bother to > >> take any locks in binary-upgrade mode? > > > I believe the problem occurs when writing them rather than when > > reading them, and I don't think we have a binary upgrade mode there. > > You're confusing pg_dump's --binary-upgrade switch (indeed applied on > the dumping side) with the backend's -b switch (IsBinaryUpgrade, > applied on the restoring side). Ah. Yes, I am. > > We could invent one of course. Another option might be to exclusively > > lock pg_largeobject, and just say that if you do that, we don't have > > to lock the individual objects (ever)? > > What was in the back of my mind is that we've sometimes seen complaints > about too many locks needed to dump or restore a database with $MANY > tables; so the large-object case seems like just a special case. It is -- but I guess it's more likely to have 100M large objects than to have 100M tables. (and the cutoff point comes a lot earlier than 100M). But the fundamental onei s the same. > The answer up to now has been "raise max_locks_per_transaction enough > so you don't see the failure". Having now consumed a little more > caffeine, I remember that that works in pg_upgrade scenarios too, > since the user can fiddle with the target cluster's postgresql.conf > before starting pg_upgrade. > > So it seems like the path of least resistance is > > (a) make pg_upgrade use --single-transaction when calling pg_restore > > (b) document (better) how to get around too-many-locks failures. Agreed. Certainly seems like a better path forward than arbitrarily pushing the limit on number of transactions which just postpones the problem. -- Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/