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 1pfOSU-00071d-3N for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2023 17:10:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pfOSS-0004w1-VU for pgsql-hackers@arkaria.postgresql.org; Thu, 23 Mar 2023 17:10:36 +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 1pfOSS-0004vA-Kr for pgsql-hackers@lists.postgresql.org; Thu, 23 Mar 2023 17:10:36 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pfOSQ-0001D3-3Y for pgsql-hackers@lists.postgresql.org; Thu, 23 Mar 2023 17:10:35 +0000 Received: by mail-lf1-x12b.google.com with SMTP id s8so28474294lfr.8 for ; Thu, 23 Mar 2023 10:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1679591432; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Mdh6tx9OIN0bTQkhXnfcV74tO65KUiWLLlPe9IEkDeA=; b=SYaBUUANLBECRXu2LvKdPgG/Vy+pYAeH6vlHL7k16Nl2IrzKLMcXZSTHWG6rOW5XfH KyACZuFemm0+4aqSAzzn3SD0gNXzcFxDOwBUYEtmS7wqgBwiAcm7XIQsVLPuuymUYAnY rZuqcFEZeoWVBVMShYKzTM0cGyaCZioyDOgSU3lx+8I9h13V8E08RzJLwyEzaD6gNFKB F084zWzpV/qtKqsFId7I5GQuiAvxP4zpr9CPYAjSFFa9tc5XrDiN9Rhel6ozTWgr3+DP vQX/4vIkskGOgXb2iCyhjlvHNpmipxdk3BK4L+Him6jDvD7eiPY5gF0QO7XnpqkLPpeJ fonQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679591432; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Mdh6tx9OIN0bTQkhXnfcV74tO65KUiWLLlPe9IEkDeA=; b=L62pnePSQ0rKzVqpU3Tw3K/8i3L4qHflNT3KxvfdaSLwCvOSDoSV8dYCzX9GZ+kD/p lbsCVtw3LxSFvvKdfq4F3FBkfDLnW6ylZ4xlwKiiDPVV3vmH7jZY5/BJ9U9fZwyGj+4I Wq16AiqzRg6PR0ASNDX2sxC2kz7J39mkDkyj37qS9EqalwEbvQwBe9QXgE0pA5GM7SYP YDrDWHBh7+sa9WgfQL2iZ1dmvej2anUOmYik0zmICcM6EOW4bGSjQvnhg8Wlty3VQmbA qcKaYTKClpN1GzNtdbvDAxrFCUjzo9wBXedbgXNyHr9GvmkE0y0gMnxPb1qu5oli2yGy JJwg== X-Gm-Message-State: AO0yUKUbK6x65BmwAkbEeAJJ8sxhttYtDrKE6SF1e03iaFb3OGa9Ikl3 8LZaS9noNyEtHNaJKRhqIfR6D4VlB9QRUtnOvlM4I4RIznGCTHjmpSNmg87ESyqFg4zLnK/P9wT k+YgDqLIuPPDHtgWueu8zrE8lGyDfc4UYeH1YQYZELuv1xNRt0nJZWBl41jrPA16Bw4p2sXcr4o pTbN3m388y/YA+JaA0wdIRs/pDOE6ELQSn/Ve8yNHxApwJKnh0SW/9 X-Google-Smtp-Source: AK7set+u62EG+dFSZoqYk2A//Y/+kcmkOQ1XebduGO49gDO2ODIiPonQWK4iHdxGCTaPW3E2SceC9g== X-Received: by 2002:ac2:51ca:0:b0:4dd:fb28:2efc with SMTP id u10-20020ac251ca000000b004ddfb282efcmr3442451lfm.63.1679591432456; Thu, 23 Mar 2023 10:10:32 -0700 (PDT) Received: from [10.137.0.17] ([84.217.81.189]) by smtp.gmail.com with ESMTPSA id s8-20020a19ad48000000b004dc83d04840sm2973773lfd.79.2023.03.23.10.10.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 23 Mar 2023 10:10:31 -0700 (PDT) Message-ID: <3beb0dd7-c927-3eca-689f-716e255d5b27@enterprisedb.com> Date: Thu, 23 Mar 2023 18:10:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Add LZ4 compression in pg_dump To: Justin Pryzby , gkokolatos@pm.me Cc: Alexander Lakhin , shiy.fnst@fujitsu.com, Michael Paquier , pgsql-hackers@lists.postgresql.org, Rachel Heaton References: <7zu6GYFi72jByVk2SEe_nd8r1DHhwA35vSntAE9sAfiMX9Lfk6bwimkwmu7GDgYaEvL27SE4qF1uK4_LHWQM4H-SXOwkMAI-GV8PKGmED_E=@pm.me> <8421f53d-c9f7-c02e-3278-9f9522a8e8f3@enterprisedb.com> <33496f7c-3449-1426-d568-63f6bca2ac1f@gmail.com> <1aBKUlb8BGVUUTkRJwEmU3ud1NyeHVCoC7bpOKAuRYlHHJ7hRiDVXYgad-wmjx1K3pykd_ctyY4Lqy9xA7JGLXOm1Eul-imdZ_7TVr5LY8U=@pm.me> <3da84c90-7e12-75ee-a582-025bc68dd098@enterprisedb.com> <5qAu7vrMV3hEodlIC82b0JICWTwEUSRoIDWlIaczNBIEVVfDH2lccxHNIQ726e4nX_Qqjc4lPc5_z9RtV28NMdVv7BNiADF4JB-FDahmlVk=@pm.me> <32ba9612-1982-4b2d-135a-5d1222987082@enterprisedb.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I looked at this again, and I realized I misunderstood the bit about errno in LZ4File_open_write a bit. I now see it simply just brings the function in line with Gzip_open_write(), so that the callers can just do pg_fatal("%m"). I still think the special "errno" handling in this one place feels a bit random, and handling it by get_error_func() would be nicer, but we can leave that for a separate patch - no need to block these changes because of that. So pushed all three parts, after updating the commit messages a bit. This leaves the empty-data issue (which we have a fix for) and the switch to LZ4F. And then the zstd part. On 3/20/23 23:40, Justin Pryzby wrote: > On Fri, Mar 17, 2023 at 03:43:58PM +0000, gkokolatos@pm.me wrote: >> From a174cdff4ec8aad59f5bcc7e8d52218a14fe56fc Mon Sep 17 00:00:00 2001 >> From: Georgios Kokolatos >> Date: Fri, 17 Mar 2023 14:45:58 +0000 >> Subject: [PATCH v3 1/3] Improve type handling in pg_dump's compress file API > >> -int >> +bool >> EndCompressFileHandle(CompressFileHandle *CFH) >> { >> - int ret = 0; >> + bool ret = 0; > > Should say "= false" ? > Right, fixed. >> /* >> * Write 'size' bytes of data into the file from 'ptr'. >> + * >> + * Returns true on success and false on error. >> + */ >> + bool (*write_func) (const void *ptr, size_t size, > >> - * Get a pointer to a string that describes an error that occurred during a >> - * compress file handle operation. >> + * Get a pointer to a string that describes an error that occurred during >> + * a compress file handle operation. >> */ >> const char *(*get_error_func) (CompressFileHandle *CFH); > > This should mention that the error accessible in error_func() applies (only) to > write_func() ? > > As long as this touches pg_backup_directory.c you could update the > header comment to refer to "compressed extensions", not just .gz. > > I noticed that EndCompressorLZ4() tests "if (LZ4cs)", but that should > always be true. > I haven't done these two things. We can/should do that, but it didn't fit into the three patches. > I was able to convert the zstd patch to this new API with no issue. > Good to hear. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company