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 1lJIre-0004KZ-97 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Mar 2021 16:36:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lJIrd-00068R-0g for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Mar 2021 16:36:13 +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 1lJIrc-00068K-Mo for pgsql-hackers@lists.postgresql.org; Mon, 08 Mar 2021 16:36:12 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lJIrZ-0000tO-83 for pgsql-hackers@postgresql.org; Mon, 08 Mar 2021 16:36:12 +0000 Received: by mail-lj1-x234.google.com with SMTP id c19so8560063ljn.12 for ; Mon, 08 Mar 2021 08:36:08 -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=g0jNPkslC/d151lwo7lOiIKlsv4vOUVbBUYZynmkQSI=; b=HxgbYfsHmss+nFUvVFjGWJ/ijmGEAkTN0eDmatDJL2T1qJxHPsozsL9Kwbd6OfcyOk Akio1wf2tU8PqpyxWzWPGxxrNgzhgss0uHpJIGYv+OWeXCSlioO2rIH8zUeFgEJJ9Z2Y q7IYD3JYo8wWzemIraxXm/rKw4MfCLIiKrYMhuYODCuWiLyhY3Cu6+SC9Qz8iJbBpBYL KO9LeI8vMfgTr0qXpwtzvII2VfItaMktMirFlGG/VOBYfy0NziKcGqkzb0UULKg5bFeG fdciMXeWvdvBEp3SCOKGdZXaoR8kIFHZZAdop3crOU+4s1kSjlP/rkWIdvK/VlIjQR0s MvNA== 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=g0jNPkslC/d151lwo7lOiIKlsv4vOUVbBUYZynmkQSI=; b=J5hVqp5grmCnnelO4oRMm0ki/FfojYzzn7P3XfQyDCmdFJRTWrzpbeYlX/KrK9hZ+1 G46vTOcMukEB4n+0erAn63VZn084I0Qtkm1jNI7AuDAD0OYKiOX84q/VP+8LAXd1xiU0 FsguoOq4BzfepsDpFsQBKLmdIMlKltjdY3sswt4KRBFFVcM8llquTBQDoonqsJO+qGkr Wmi4oWECD2rEMvSb5LIg3fhXSPb8fhLLom7KgoG2HO4SbxZaCu3v2KLQXFpNz0RVm0+L mjZFWS57qjYR+yaUK9K6tNVPSVH1bloaw1XXiCW26Ibz1nvjBihr8/ZCMjpV2HTKmOhl tPog== X-Gm-Message-State: AOAM533vA1y8AHoaRtTDYUJ/FevQzT2dbjhiDEMaXV4RM/J5qrpDa3oM +e0oNR8VsiSNyaZbEgwV9p8PMjDCwn4hV8sVb8+oSvm1m4s= X-Google-Smtp-Source: ABdhPJyYZpBTwraRwyKpw4IRVhipnsrT/jDOB+1g3KU2BSfZXzAz1V9Iwvlf8Jo8tu/djBq7yxj4p9pTD+x5YoSZdnA= X-Received: by 2002:a2e:3015:: with SMTP id w21mr14320579ljw.120.1615221368093; Mon, 08 Mar 2021 08:36:08 -0800 (PST) MIME-Version: 1.0 References: <1742698.1615221182@sss.pgh.pa.us> In-Reply-To: <1742698.1615221182@sss.pgh.pa.us> From: Magnus Hagander Date: Mon, 8 Mar 2021 17:35:56 +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:33 PM Tom Lane wrote: > > Robins Tharakan writes: > > On Mon, 8 Mar 2021 at 23:34, Magnus Hagander wrote: > >> Without looking, I would guess it's the schema reload using > >> pg_dump/pg_restore and not actually pg_upgrade itself. This is a known > >> issue in pg_dump/pg_restore. And if that is the case -- perhaps just > >> running all of those in a single transaction would be a better choice? > >> One could argue it's still not a proper fix, because we'd still have a > >> huge memory usage etc, but it would then only burn 1 xid instead of > >> 500M... > > > (I hope I am not missing something but) When I tried to force pg_restore to > > use a single transaction (by hacking pg_upgrade's pg_restore call to use > > --single-transaction), it too failed owing to being unable to lock so many > > objects in a single transaction. > > 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. 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)? -- Magnus Hagander Me: https://www.hagander.net/ Work: https://www.redpill-linpro.com/