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 1pLFqz-0001yH-Ke for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jan 2023 03:56:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pLFqy-0000wr-Fo for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Jan 2023 03:56:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pLFqy-0000wI-02 for pgsql-hackers@lists.postgresql.org; Fri, 27 Jan 2023 03:56:40 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pLFqu-0001Fn-Jb for pgsql-hackers@lists.postgresql.org; Fri, 27 Jan 2023 03:56:38 +0000 Received: by mail-il1-x12c.google.com with SMTP id i17so1851178ila.9 for ; Thu, 26 Jan 2023 19:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent: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=zAFOhTy7JL6V7nvykEFYv+myX6yb9rPgufvFRwk+xKY=; b=5Rg6Spz7pP7Pu5e2puew0GdW17UoFlRE80kqEJhFmz3oYTjR6LPRqOxOqOmcIO6h2q tJZsBS7SBzIpeWEgsUDs44qTzbRlBhhQIn5Wfk80KOSsMheEbmY+mPlU9xY1a1KDwO88 KS68zmnrxxoKUtZdicm2FNLY+ZLTIiZBCdGX4F2yIo20dQFrZc08hnjuaIvLj11L0SzJ gbRCd6DrKB8Ow2hFHdjKu2JUr9ugU+fBUBb7rmea3RHz9qwZOt9GQFxwY5JSR4GwsNwl EjdaT9CzWUjscNHWnDi9EvvJKW+lzS/FzE82lo3/t1efjhvQ4ulBcWgixrQijs9x+6lQ iIkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent: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=zAFOhTy7JL6V7nvykEFYv+myX6yb9rPgufvFRwk+xKY=; b=GculGdIvTsDOj5G4IdbPfMKYfnRobUoNsQUNDoIftL4+RMCq5qy+vgKvv670o2Z1M2 Aawtbo4NOIEVPtho1H//sWuck93hmIixqiauwC47f6S0Nr8M6K88KLIxAIY7pZTplrMU Fz8fUz7b3zmf6ea3tGoIFNbzzo/Ds+tSwvcSfHxHV8aLiGYavaC4MT5pH1oGjP/YsdM+ VzrkYo7yvdHw/U5tC6bZlyYuh81lafGt02oNESWKJ5XO3i0qhtQHJZEKg9jsQBK1nm93 Y6+F+VGh0o0vvASbTeQPul9Os6QRhDUlVAJgbcpRMTfAUQyRvWEr3mlLU99zUB+JHTCQ 3RRg== X-Gm-Message-State: AFqh2kpWUCq94EkY+db7Eq+4EIG44Vx/N4q4tuecLtV4cewxpkFhExC7 seSBuOP7fg0YbcDX+PVoqCbgLw== X-Google-Smtp-Source: AMrXdXtMRqqH9X4rV+rDkPopv5e1D6veLe9B/13i+2aRrrbWJVmms7MdybJsPiWesEATckCBBomSdA== X-Received: by 2002:a05:6e02:1a45:b0:302:392c:5878 with SMTP id u5-20020a056e021a4500b00302392c5878mr35157234ilv.13.1674791795675; Thu, 26 Jan 2023 19:56:35 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p11-20020a92da4b000000b00300d3c0e33dsm864412ilq.4.2023.01.26.19.56.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 19:56:34 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 977F9800EEB; Thu, 26 Jan 2023 21:56:32 -0600 (CST) Date: Thu, 26 Jan 2023 21:56:32 -0600 From: Justin Pryzby To: Michael Paquier Cc: gkokolatos@pm.me, pgsql-hackers@lists.postgresql.org, Rachel Heaton Subject: Re: Add LZ4 compression in pg_dump Message-ID: <20230127035631.GV22427@telsasoft.com> References: <20221219172706.GA1153@telsasoft.com> <20221220152610.GG1153@telsasoft.com> <20221222170859.GO1153@telsasoft.com> <20230108194524.GA27637@telsasoft.com> <20230114214308.GC9837@telsasoft.com> <20230116015625.GH9837@telsasoft.com> 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 Mon, Jan 16, 2023 at 11:54:46AM +0900, Michael Paquier wrote: > On Sun, Jan 15, 2023 at 07:56:25PM -0600, Justin Pryzby wrote: > > On Mon, Jan 16, 2023 at 10:28:50AM +0900, Michael Paquier wrote: > >> The functions changed by 0001 are cfopen[_write](), > >> AllocateCompressor() and ReadDataFromArchive(). Why is it a good idea > >> to change these interfaces which basically exist to handle inputs? > > > > I changed to pass pg_compress_specification as a pointer, since that's > > the usual convention for structs, as followed by the existing uses of > > pg_compress_specification. > > Okay, but what do we gain here? It seems to me that this introduces > the risk that a careless change in one of the internal routines if > they change slight;ly compress_spec, hence impacting any of their > callers? Or is that fixing an actual bug (except if I am missing your > point, that does not seem to be the case)? To circle back to this: I was not saying there's any bug. The proposed change was only to follow normal and existing normal conventions for passing structs. It could also be a pointer to const. It's fine with me if you say that it's intentional how it's written already. > >> Is there some benefit in changing compression_spec within the > >> internals of these routines before going back one layer down to their > >> callers? Changing the compression_spec on-the-fly in these internal > >> paths could be risky, actually, no? > > > > I think what you're saying is that if the spec is passed as a pointer, > > then the called functions shouldn't set spec->algorithm=something. > > Yes. HEAD makes sure of that, 0001 would not prevent that. So I am a > bit confused in seeing how this is a benefit.