Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rOQEW-0042X4-2M for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jan 2024 22:42:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rOQEU-005woo-FC for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jan 2024 22:42:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rOQEU-005wog-5V for pgsql-hackers@lists.postgresql.org; Fri, 12 Jan 2024 22:42:34 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rOQER-001FVI-34 for pgsql-hackers@postgresql.org; Fri, 12 Jan 2024 22:42:32 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-3606dc4fdf2so35713255ab.0 for ; Fri, 12 Jan 2024 14:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705099350; x=1705704150; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rv6XMCbfxYiu2H8IYuZ6rpi9PcfmEtyx5BL9W/2QJ38=; b=Th/lHPNoE4QahUhKVs2fCq1c7edo1cTYxEV/pfH6h6WFaX0BGqdQu8fYrKsgHlljpM e0DOhuQ7WUr0TTVQDTjWPJdDVIb/8gKvHpb1RUi0T/fZSUrNlCf0DRMrCJx2EkaDelY9 YTrq41zdaAELVG1l5LVaaFXO/VBCpW0iPdubiPHLdDrghp3/9KlNI02Y7DQQrmf20l4f vezG4drvDnbAyc//Fd0kNzTqr7/fxVQ3C2TpnwqIIcjBbpgN/btUmKqn2JIGp4INGVu4 St40Ou6acvSHNLrcPJK8V78Q0SKe+8RJHFmw2upesczuVd/Ie0pjhblw+J7Kjvjoj2l+ s8RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705099350; x=1705704150; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rv6XMCbfxYiu2H8IYuZ6rpi9PcfmEtyx5BL9W/2QJ38=; b=mR6rQ0B+5iY85gXWbXsTap/5Dwp93MGCmYJYWGBIfYXJfKY+ncvWXgOneHxGTAlclp yZuW/88Ull+uKoTguRI0O0qN5Bn1szzwCp+3yU19YbbOGvLCmDQBumfI/2WLTDI3G5WY tkc1YAbWVXDGBK3GRSIGldd5BikMvJa/XKtGnXLeXzhpoP3UySQ6KI/qGukRuCc3ledI BU3qgSW2n88McNKauA0q7trU/lcz2KgtgR/LwvRrt08wYSwJjZOu716mDkSOGfvFG6/i uBDeamvdVVeDLd+XE+dvJ/dh5cVlzlkedL0FNbN267ePwCRKnCtPCqEb3TKNygH56vS2 3M/A== X-Gm-Message-State: AOJu0YxIuHE5Lh+UeuEdMY3KKFur2HXFC63g/mHeZXkjQLzrHqJiaKaJ YLExPYhvWVuD4BtGtQHCBGQ= X-Google-Smtp-Source: AGHT+IHqVkX37jRdcUfZrHIwL2l6ijNJ0c5ZqOIrR0iU3l4Nq/wc2aL7NZxiUf8H0hVTiBF/+FW7gg== X-Received: by 2002:a05:6e02:491:b0:360:6ede:b624 with SMTP id b17-20020a056e02049100b003606edeb624mr1859658ils.27.1705099350285; Fri, 12 Jan 2024 14:42:30 -0800 (PST) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id f3-20020a02b783000000b0046e6f691874sm154712jam.20.2024.01.12.14.42.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 14:42:29 -0800 (PST) Date: Fri, 12 Jan 2024 16:42:27 -0600 From: Nathan Bossart To: Tom Lane Cc: "Kumar, Sachin" , Jan Wieck , Bruce Momjian , Zhihong Yu , Andrew Dunstan , Magnus Hagander , Robins Tharakan , Peter Eisentraut , "pgsql-hackers@postgresql.org" Subject: Re: pg_upgrade failing for 200+ million Large Objects Message-ID: <20240112224227.GA3857154@nathanxps13> References: <663393ca-b2ff-26f0-2e2d-adc942aff4fd@timescale.com> <20220908231807.GA2242918@nathanxps13> <0643CC11-223A-4039-AC34-94E127462796@amazon.com> <1152134.1699555261@sss.pgh.pa.us> <83D44BE5-0088-4D41-8AE6-20A05D026F46@amazon.com> <81D13E16-BA04-43CF-9B89-B8924300B211@amazon.com> <240D05EC-8B28-4112-BEAB-85ECBAF3F871@amazon.com> <2055911.1702258962@sss.pgh.pa.us> <534746.1703116064@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <534746.1703116064@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Dec 20, 2023 at 06:47:44PM -0500, Tom Lane wrote: > * I did not invent a switch to control the batching of blobs; it's > just hard-wired at 1000 blobs per group here. Probably we need some > user knob for that, but I'm unsure if we want to expose a count or > just a boolean for one vs more than one blob per batch. The point of > forcing one blob per batch would be to allow exact control during > selective restore, and I'm not sure if there's any value in random > other settings. On the other hand, selective restore of blobs has > been completely broken for the last dozen years and I can't recall any > user complaints about that; so maybe nobody cares and we could just > leave this as an internal choice. I think the argument for making this configurable is that folks might have fewer larger blobs, in which case it might make sense to lower the batch size, or they might have many smaller blobs, in which case they might want to increase it. But I'm a bit skeptical that will make any sort of tremendous difference in practice, and I'm not sure how a user would decide on the right value besides trial-and-error. In any case, at the moment I think it'd be okay to keep this an internal setting and wait for feedback from the field. > * As the patch stands, we still build a separate TOC entry for each > comment or seclabel or ACL attached to a blob. If you have a lot of > blobs with non-default properties then the TOC bloat problem comes > back again. We could do something about that, but it would take a bit > of tedious refactoring, and the most obvious way to handle it probably > re-introduces too-many-locks problems. Is this a scenario that's > worth spending a lot of time on? I'll ask around about this. > Subject: [PATCH v9 1/4] Some small preliminaries for pg_dump changes. This one looked good to me. > Subject: [PATCH v9 2/4] In dumps, group large objects into matching metadata > and data entries. I spent most of my review time reading this one. Overall, it looks pretty good to me, and I think you've called out most of the interesting design choices. > + char *cmdEnd = psprintf(" OWNER TO %s", fmtId(te->owner)); > + > + IssueCommandPerBlob(AH, te, "ALTER LARGE OBJECT ", cmdEnd); This is just a nitpick, but is there any reason not to have IssueCommandPerBlob() accept a format string and the corresponding arguments? > + while (n < 1000 && i + n < ntups) Another nitpick: it might be worth moving these hard-wired constants to macros. Without a control switch, that'd at least make it easy for anyone determined to change the value for their installation. > Subject: [PATCH v9 3/4] Move BLOBS METADATA TOC entries into SECTION_DATA. This one looks reasonable, too. > In this patch I have just hard-wired pg_upgrade to use > --transaction-size 1000. Perhaps there would be value in adding > another pg_upgrade option to allow user control of that, but I'm > unsure that it's worth the trouble; I think few users would use it, > and any who did would see not that much benefit. However, we > might need to adjust the logic to make the size be 1000 divided > by the number of parallel restore jobs allowed. I wonder if it'd be worth making this configurable for pg_upgrade as an escape hatch in case the default setting is problematic. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com