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 1pc6wv-000368-2N for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Mar 2023 15:52:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pc6wt-00007n-NK for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Mar 2023 15:52:27 +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 1pc6wt-00007e-Cy for pgsql-hackers@lists.postgresql.org; Tue, 14 Mar 2023 15:52:27 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pc6wq-000601-DD for pgsql-hackers@lists.postgresql.org; Tue, 14 Mar 2023 15:52:27 +0000 Received: by mail-ed1-x533.google.com with SMTP id fd5so30005515edb.7 for ; Tue, 14 Mar 2023 08:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1678809143; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=IN/Njba5kgM/Xlby6oSZySl+n5tL+gjhfi2J/bEL+h4=; b=PWhT06iorXikamQTE6X+3Qu+BxSZX4KfW9s4T/ulMYuOHfku2jn+uPM69/D6X6v8Zb X2vxMJieQJnvvyTt44tX1sa4ZQ56nVV3CCVWG5AjHNQ2LHMpHxFhtLOyAHGXAX9G9PYQ TaOhmy5v+1ykuz92Ab88p7uyMd4XuQNTXFGvSFafaJ1b10ASCZa0H0/boO3uNvB7AI80 xI3IsjVcltcDyMmIu2PKlSqMzao9giOg1YKM6qy5URcLW72rHhq6lXFFqa3GXTqeUS4M 73Ius+WcLWNFcmZJqVqOPCMryLAJaGLjLiksCN718G16PCPaKGSvW/hpANZ8psr6Ebux wAag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678809143; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IN/Njba5kgM/Xlby6oSZySl+n5tL+gjhfi2J/bEL+h4=; b=zwdps1wbl3DMLTKwE5JMZctSbIqlP0GV8rvZtBtRiDmd/E8rpNVmgFAjQKpX4rqyk9 v5kwt4mpesdRNdZQJY5LqKKARmdLI7vHtZ9X21qZ6FPDbFxwgTEI7kOxmpOKpMsAIEF1 SX/zZNXOGPfiirzEVUVqAByofWt/IaZH2etcJjrcryOgUdJAeW/5f+sgXBy3xSu3h2oP CiTn76GLCfjy/6MfgP/iaBTExp+TPMCERzB3gR4H+dSN+jBZ9BgSR06OcM4BH7CU6O1n jHebE7Qw3aINxwyyjaoLSlsCiej9FehTOHSFThTSujtnzgESTCvsTVDVwGuXHgmhCgI+ CQZQ== X-Gm-Message-State: AO0yUKVyEblyX1kw692NJKCyCaQ86wQQxaBwLn4sL+RerlUuqomFXD0i GFuX1Csy9JZchmjapmthEdkhG5Q1OA2RQ85naPTSJZK6UB8YGJxyjSXBmbwCtdsE4e/nghuCbGZ bQWVa3OoH7GE+WLrS2bMNDFdolCrZr8mInuPptS89QruA16Q4QusKlX2C97F+4M1FYZ/cGsc82E 3a96dCvjnPQo/V1KKKCBCpFUUc+N8RxxmTMB/gzBew1R4SzdXQTOft X-Google-Smtp-Source: AK7set8oObQAr26ucArAxILOrw3vEePyK1MEwSw5FNyVTH8NvFJywkMTjCmeejZqYaFhmmDgLe3qWQ== X-Received: by 2002:a17:906:8298:b0:8af:2b57:b80f with SMTP id h24-20020a170906829800b008af2b57b80fmr2847402ejx.55.1678809143187; Tue, 14 Mar 2023 08:52:23 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-228-162.bb.vodafone.cz. [86.49.228.162]) by smtp.gmail.com with ESMTPSA id j25-20020a170906279900b0092bcd18bfa5sm1326165ejc.20.2023.03.14.08.52.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Mar 2023 08:52:22 -0700 (PDT) Message-ID: <1ea99cb0-c39c-ff1b-37ca-5816ed08f8d7@enterprisedb.com> Date: Tue, 14 Mar 2023 16:52:20 +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 Content-Language: en-US To: gkokolatos@pm.me Cc: Justin Pryzby , shiy.fnst@fujitsu.com, Michael Paquier , pgsql-hackers@lists.postgresql.org, Rachel Heaton References: <22cb80ed-ec87-54c7-fd5b-cdcf79766bb1@enterprisedb.com> <8421f53d-c9f7-c02e-3278-9f9522a8e8f3@enterprisedb.com> <20230228235834.GC30529@telsasoft.com> 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 On 3/14/23 12:07, gkokolatos@pm.me wrote: > > > ------- Original Message ------- > On Monday, March 13th, 2023 at 10:47 PM, Tomas Vondra wrote: > > > >> >>> Change pg_fatal() to an assertion+comment; >> >> >> Yeah, that's reasonable. I'd even ditch the assert/comment, TBH. We >> could add such protections against "impossible" stuff to a zillion other >> places and the confusion likely outweighs the benefits. >> > > A minor note to add is to not ignore the lessons learned from a7885c9bb. > > For example, as the testing framework stands, one can not test that the > contents of the custom format are indeed compressed. One can infer it by > examining the header of the produced dump and searching for the > compression flag. The code responsible for writing the header and the > code responsible for actually dealing with data, is not the same. Also, > the compression library itself will happily read and write uncompressed > data. > > A pg_fatal, assertion, or similar, is the only guard rail against this > kind of error. Without it, the tests will continue passing even after > e.g. a wrong initialization of the API. It was such a case that lead to > a7885c9bb in the first place. I do think that we wish it to be an > "impossible" case. Also it will be an untested case with some history > without such a guard rail. > So is the pg_fatal() a dead code or not? My understanding was it's not really reachable, and the main purpose is to remind people this is not possible. Or am I mistaken/confused? If it's reachable, can we test it? AFAICS we don't, per the coverage reports. If it's just a protection against incorrect API initialization, then an assert is the right solution, I think. With proper comment. But can't we actually verify that *during* the initialization? Also, how come WriteDataToArchiveLZ4() doesn't need this protection too? Or is that due to gzip being the default compression method? > Of course I will not object to removing it, if you think that is more > confusing than useful. > Not sure, I have a feeling I don't quite understand in what situation this actually helps. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company