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 1lP7FZ-0003pc-2V for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Mar 2021 17:24:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lP7FX-00015u-VE for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Mar 2021 17:24:55 +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 1lP7FX-00015n-OY for pgsql-hackers@lists.postgresql.org; Wed, 24 Mar 2021 17:24:55 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lP7FV-0002kZ-Om for pgsql-hackers@lists.postgresql.org; Wed, 24 Mar 2021 17:24:55 +0000 Received: by mail-io1-xd33.google.com with SMTP id f19so22316004ion.3 for ; Wed, 24 Mar 2021 10:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=UDpFmUrSt2/jyicpDrL4DJb6abyJc72nq67YfC3ee88=; b=ajUNXf9BTo8e+YIe7z8nTxo99h9HEZARWENrY4ZTZxndBLtFTA27aHRYPa1AJIRUvy vpZ59ZA0ePU/7BBL1w0VgXrv8gtI8P8Kh6zqgQ4e7s2amTHdS/w/qntTjSkRbS3L/i5U E6Trf9UwCipPIrt2WUv5BckXTGGLCeKeKqoxIscsLrae71KqkUyUgE0xniu54maFjSJ8 d1R1cZH4o4ZzkkGeisw6tja4YQGTRzqSgyCQStqwj6DlDhxDJDuW/a6QTlgAyaczutNs M1piTAz80CdxO9Z/ncag+ARX2aR8fIpnV5eoknC7lgpa/iLZd7SvLTJY+bHEljIlMuTY GwTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=UDpFmUrSt2/jyicpDrL4DJb6abyJc72nq67YfC3ee88=; b=FwELnhP7SIsEc0nIBgULmLNlWARrVuM03es1Lr7v2S9VhmHnjLR5NSJnnsYpN+3/6w iPAX0MAS2gCCdhzrGq79XDIkZMYiqcwqJI+Y8QETiKsAxOH1loY/fWrRo34rqdGgejkr H7+85DA8yuQaeGEn2ETDthgYyKHzVkTXZCRQ+OWmLIhpyigKcdzTSZrWvBZpnigl1HXZ Rak0IDrkZr0hTyCYoHvdYW5sOpStS8yhKOHy/aDMBOxYWyUIje7cxkpbXxatcixRJszS kgiokbs3WqfZEnDdc7TOMmypyJvr2LYYsqchhgixk2xjU6zzmMFWTfpr+yZ7HxUcFXoo rWYA== X-Gm-Message-State: AOAM530QEycMudkYTWdlXBR9S8P85AnYjueHV6qsIPF7IwCto4b0RZhP QWy99lWHM+CK0DPzOzzPqN22FA== X-Google-Smtp-Source: ABdhPJy1Xxil2uKc8G2s3p0ND8l9+YkXfqWYmPGoneKWRTXrfolW/bM5N6PZfL0QpagHCc3W0fBogQ== X-Received: by 2002:a05:6638:e93:: with SMTP id p19mr3839611jas.10.1616606691695; Wed, 24 Mar 2021 10:24:51 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id i6sm1303273ils.77.2021.03.24.10.24.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Mar 2021 10:24:51 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 5D5FE80090D; Wed, 24 Mar 2021 12:24:50 -0500 (CDT) Date: Wed, 24 Mar 2021 12:24:50 -0500 From: Justin Pryzby To: Robert Haas Cc: Tom Lane , Andrew Dunstan , Dilip Kumar , Alvaro Herrera , Andres Freund , Tomas Vondra , Alexander Korotkov , David Steele , Ildus Kurbangaliev , Dmitry Dolgov <9erthalion6@gmail.com>, PostgreSQL Hackers Subject: Re: [HACKERS] Custom compression methods Message-ID: <20210324172450.GD15100@telsasoft.com> References: <4158590.1616185209@sss.pgh.pa.us> <20210320000625.GP11765@telsasoft.com> <20210320074420.GR11765@telsasoft.com> <20210320153933.GT11765@telsasoft.com> <229250.1616261775@sss.pgh.pa.us> <261449.1616267030@sss.pgh.pa.us> <1099280.1616600518@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Mar 24, 2021 at 12:24:38PM -0400, Robert Haas wrote: > On Wed, Mar 24, 2021 at 11:42 AM Tom Lane wrote: > > On reflection, though, I wonder if we've made pg_dump do the right > > thing anyway. There is a strong case to be made for the idea that > > when dumping from a pre-14 server, it should emit > > SET default_toast_compression = 'pglz'; > > rather than omitting any mention of the variable, which is what > > I made it do in aa25d1089. If we changed that, I think all these > > diffs would go away. Am I right in thinking that what's being > > compared here is new pg_dump's dump from old server versus new > > pg_dump's dump from new server? > > > > The "strong case" goes like this: initdb a v14 cluster, change > > default_toast_compression to lz4 in its postgresql.conf, then > > try to pg_upgrade from an old server. If the dump script doesn't > > set default_toast_compression = 'pglz' then the upgrade will > > do the wrong thing because all the tables will be recreated with > > a different behavior than they had before. IIUC, this wouldn't > > result in broken data, but it still seems to me to be undesirable. > > dump/restore ought to do its best to preserve the old DB state, > > unless you explicitly tell it --no-toast-compression or the like. > > This feels a bit like letting the tail wag the dog, because one might > reasonably guess that the user's intention in such a case was to > switch to using LZ4, and we've subverted that intention by deciding > that we know better. I wouldn't blame someone for thinking that using > --no-toast-compression with a pre-v14 server ought to have no effect, > but with your proposal here, it would. Furthermore, IIUC, the user has > no way of passing --no-toast-compression through to pg_upgrade, so > they're just going to have to do the upgrade and then fix everything > manually afterward to the state that they intended to have all along. > Now, on the other hand, if they wanted to make practically any other > kind of change while upgrading, they'd have to do something like that > anyway, so I guess this is no worse. I think it's not specific to pg_upgrade, but any pg_dump |pg_restore. The analogy with tablespaces is restoring from a cluster where the tablespace is named "vast" to one where it's named "huge". I do this by running PGOPTIONS=-cdefault_tablespace=huge pg_restore --no-tablespaces So I thinks as long as --no-toast-compression does the corresponding thing, the "restore with alternate compression" case is handled fine. -- Justin