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 1pHEji-0007Nb-0p for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jan 2023 01:56:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHEjg-0007Mn-PC for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Jan 2023 01:56:32 +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 1pHEjg-0007KJ-By for pgsql-hackers@lists.postgresql.org; Mon, 16 Jan 2023 01:56:32 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pHEjd-0001gO-P4 for pgsql-hackers@lists.postgresql.org; Mon, 16 Jan 2023 01:56:31 +0000 Received: by mail-io1-xd36.google.com with SMTP id p66so13053666iof.1 for ; Sun, 15 Jan 2023 17:56:29 -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=/eaEPII0ajmuULv4ZzgG1c9uWYuxD1JluDwI2qLCRi0=; b=2XCAnGbQ0+jpr6XJs+E7q5lQHQAdlv8Ck2gdnGrg8q+4hLY1wXDD+aHVSWpVbLiYhi zjMp+UqEQwPP0l61EmnCck1cj2FW49/XSQYUYKrMDKla0jccEvURUN80EUddpq0GS02c Lg3H87QMvlnuxNkU8nnZ/J8wHkI6x2Eej4X2/dQUshSy6Wz0m41qHnSFyKgf1gjgC2Pr g4ZN9nQt780RhpxqJRPoJ4KQSUuUPe6OlKy2pMv/m/GEZQ6bHbK/hfvsBCQ90e0ytZA4 yWRlW/l0sI8e1q7qHEpu6j6vfB4m3mrXaa8u0Ipld/DaaTs73I0NDtF8OehWsIKrOqyp NIrg== 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=/eaEPII0ajmuULv4ZzgG1c9uWYuxD1JluDwI2qLCRi0=; b=qXiwMmsyiQPKNv5XntKtBwG2Fl/G1cYK/QtGTZFQ4BQyajcdT5V8bu2iMyfimM1Q5L yHyh+IKFe9hAAlbd+Re/kmUcXogHsLSoyTEp3bhbgkEgQikdFyl1tnAY5Chp/s/vh9eF GujiIKbCV/vMN5XLnt+6a1sev8nHRwH+ymyAKLNhpRqlpvkkE2WtAO0lC10jGxPx0iUb 1AjggIQpgJUx3WMwKXQCCmJABZ7aKoSZS+UqlHKbO4brGCX0QPRnxL6Gv5hFZuNTwb0k aAQNXr9DVwT9niq1xpUvCh69Czrqpu5sOYOssCJFb2rUWBOn9XqWM+HVg/ZkpKJfQPC+ V3Fg== X-Gm-Message-State: AFqh2kqQra10kRo3FLoVQYyTyO+hgnvJDPSk1vxPYOH8xlZAgLpFpXR+ sa624WgeEZe/hu4AVwUS+oebkQ== X-Google-Smtp-Source: AMrXdXseKV3YGNNbBg05BMUm0fjPxsb1pRKSkrkNSh/S/zU7et3p2rkvdD/+XvTHEuoLTNuSew9VSQ== X-Received: by 2002:a6b:5c17:0:b0:6bc:d70f:8b2f with SMTP id z23-20020a6b5c17000000b006bcd70f8b2fmr13165392ioh.9.1673834187757; Sun, 15 Jan 2023 17:56:27 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id ay27-20020a5d9d9b000000b006e00e8f0e76sm9152681iob.40.2023.01.15.17.56.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Jan 2023 17:56:27 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id E7259800CAB; Sun, 15 Jan 2023 19:56:25 -0600 (CST) Date: Sun, 15 Jan 2023 19:56:25 -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: <20230116015625.GH9837@telsasoft.com> References: <20221219172706.GA1153@telsasoft.com> <20221220152610.GG1153@telsasoft.com> <20221222170859.GO1153@telsasoft.com> <20230108194524.GA27637@telsasoft.com> <20230114214308.GC9837@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 10:28:50AM +0900, Michael Paquier wrote: > On Sat, Jan 14, 2023 at 03:43:09PM -0600, Justin Pryzby wrote: > > On Sun, Jan 08, 2023 at 01:45:25PM -0600, Justin Pryzby wrote: > >> pg_compress_specification is being passed by value, but I think it > >> should be passed as a pointer, as is done everywhere else. > > > > ISTM that was an issue with 5e73a6048, affecting a few public and > > private functions. I wrote a pre-preparatory patch which changes to > > pass by reference. > > 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. > 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. I agree that if they need to do that, they should use a local variable. Which looks to be true for the functions that were changed in 001. > > And addressed a handful of other issues I reported as separate fixup > > commits. And changed to use LZ4 by default for CI. > > Are your slight changes shaped as of 0003-f.patch, 0005-f.patch and > 0007-f.patch on top of the original patches sent by Georgios? Yes, the original patches, rebased as needed on top of HEAD and 001... > >> pg_compress_algorithm is being writen directly into the pg_dump header. > > Do you mean that this is what happens once the patch series 0001~0008 > sent upthread is applied on HEAD? Yes > - /* > - * For now the compression type is implied by the level. This will need > - * to change once support for more compression algorithms is added, > - * requiring a format bump. > - */ > - WriteInt(AH, AH->compression_spec.level); > + AH->WriteBytePtr(AH, AH->compression_spec.algorithm); > > I may be missing something here, but it seems to me that you ought to > store as well the level in the dump header, or it would not be > possible to report in the dump's description what was used? Hence, > K_VERS_1_15 should imply that we have both the method compression and > the compression level. Maybe. But the "level" isn't needed for decompression for any case I'm aware of. Also, dumps with the default compression level currently say: "Compression: -1", which does't seem valuable. -- Justin