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 1pw5AF-0006Ct-6z for pgsql-hackers@arkaria.postgresql.org; Mon, 08 May 2023 18:00:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pw5AD-0003x9-EG for pgsql-hackers@arkaria.postgresql.org; Mon, 08 May 2023 18:00:45 +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 1pw5AD-0003wy-4n for pgsql-hackers@lists.postgresql.org; Mon, 08 May 2023 18:00:45 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pw5A9-001PYo-OG for pgsql-hackers@lists.postgresql.org; Mon, 08 May 2023 18:00:44 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9661047f8b8so477264366b.0 for ; Mon, 08 May 2023 11:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1683568841; x=1686160841; h=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=+4eSYk4V8EkyqjsjUMOA2CgydclV8GGH9NEfEy+rKY4=; b=mZfrQBofjUPgLem4QY6WgSARHQHnxPagSMwYbfUkGE38SZFTfAj+WDZDXBHABLP3GH 2aoD4HsOVH5WAsSebSwrnyMb6tCxHwIwSLtoBZuCEUALX6EjnX2FYiQSLCIxKiklCYhG NgAJ2l5M5E+AEtT6Q8I+wAom8c5w+zjGSyHxD8EesIgCnUAOVJsycmoNuHHyYczumnrp bEJMqlSdPLRMEMK1dYqgQcnv1pYqgrZ/0gGHwybn/v2OZ3l7MeC+9nx1prk+QA56JplO ctB19VEieRbf4D1nIjIWsIlurDdlGuT/KN32+v5OnSZjD2i3ZjhW4ykY0VdX9cf0FPxS bwaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683568841; x=1686160841; h=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=+4eSYk4V8EkyqjsjUMOA2CgydclV8GGH9NEfEy+rKY4=; b=gCHomgONJ5QZhPFIdwhL3XBj0429UV2HvoWeYWAsi+DRTuBjeqlx7cHlhbgb8tH66G 74Z+BVov/ZPNQoo9Kh9qatd+23gwdzVxdNRrKFduowJwq4SjeSUPDN8DehJkIKKigUzG bTmS1pQ3UcAUMZSYlAHDlQK53eUjAYsuJjOW9mv92pDja93r5d/LNOmCCsgKzu/AXsSY C/Gd0X9YKTxdu6GnyJNmJxRoDJd/9nX7/284kgRppGC+zovYZAPJGiQCXp1nU1M5eXKk IiMa0ZtXddO0w+IlKUymcoZsTPWuFlqC6zdu9vb3vTfxLRW4wrPi6mUaV4d9ZIOZ5xJH tYOg== X-Gm-Message-State: AC+VfDwoNR9M/W0hsyQRwzLjZyMT2VRejqGRdUuEdqbnGHB1D831ooP3 Gr3vdWBZNhDoL+Kmbj9Qg60avMVnDHyjFX+ETrN2C+8WPZJ6KC0XlwCVfZ+DsSHQwNM7YHpdRQM JuxkJIH8xKqFkhzPikFAdkGEkaJE/Rhuk58NZtxvOZlBr65jUtnmnBGcodGjIydAuzp5LMzIbzI JBQ2jT8uP0v9FQtLzgmZNQoD5JbfD0iJho7+AFB3iuAMpyY1KZQAkL X-Google-Smtp-Source: ACHHUZ5tEiiA3NKM3i8MLp96G1V+5nbPclo+H9NUhv6ZzSmmTK+TShzCUV4zfYzxUhUlQvJMUSQurQ== X-Received: by 2002:a17:906:d552:b0:965:c898:949d with SMTP id cr18-20020a170906d55200b00965c898949dmr9948701ejc.54.1683568840659; Mon, 08 May 2023 11:00:40 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-228-220.bb.vodafone.cz. [86.49.228.220]) by smtp.gmail.com with ESMTPSA id v9-20020a170906338900b0094ee99eeb01sm248078eja.150.2023.05.08.11.00.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 May 2023 11:00:39 -0700 (PDT) Content-Type: multipart/mixed; boundary="------------KlEPLecfgPwt0ebUCTEo0V0f" Message-ID: Date: Mon, 8 May 2023 20:00:39 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Add LZ4 compression in pg_dump To: Tom Lane , Michael Paquier Cc: gkokolatos@pm.me, Andrew Dunstan , Alexander Lakhin , Justin Pryzby , shiy.fnst@fujitsu.com, pgsql-hackers@lists.postgresql.org, Rachel Heaton References: <7zu6GYFi72jByVk2SEe_nd8r1DHhwA35vSntAE9sAfiMX9Lfk6bwimkwmu7GDgYaEvL27SE4qF1uK4_LHWQM4H-SXOwkMAI-GV8PKGmED_E=@pm.me> <32ba9612-1982-4b2d-135a-5d1222987082@enterprisedb.com> <3beb0dd7-c927-3eca-689f-716e255d5b27@enterprisedb.com> <94ae9bca-5ebb-1e68-bb7b-4f32e89fefbe@gmail.com> <71868915-0345-1b7b-f3d6-ec66547c662a@dunslane.net> <219662.1683508165@sss.pgh.pa.us> <220484.1683508611@sss.pgh.pa.us> Content-Language: en-US From: Tomas Vondra In-Reply-To: <220484.1683508611@sss.pgh.pa.us> 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 This is a multi-part message in MIME format. --------------KlEPLecfgPwt0ebUCTEo0V0f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/8/23 03:16, Tom Lane wrote: > I wrote: >> Michael Paquier writes: >>> While testing this patch, I have triggered an error pointing out that >>> the decompression path of LZ4 is broken for table data. I can >>> reproduce that with a dump of the regression database, as of: >>> make installcheck >>> pg_dump --format=d --file=dump_lz4 --compress=lz4 regression > >> Ugh. Reproduced here ... so we need an open item for this. > > BTW, it seems to work with --format=c. > The LZ4Stream_write() forgot to move the pointer to the next chunk, so it was happily decompressing the initial chunk over and over. A bit embarrassing oversight :-( The custom format calls WriteDataToArchiveLZ4(), which was correct. The attached patch fixes this for me. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --------------KlEPLecfgPwt0ebUCTEo0V0f Content-Type: text/x-patch; charset=UTF-8; name="pg-dump-lz4-fix.patch" Content-Disposition: attachment; filename="pg-dump-lz4-fix.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL3NyYy9iaW4vcGdfZHVtcC9jb21wcmVzc19sejQuYyBiL3NyYy9iaW4v cGdfZHVtcC9jb21wcmVzc19sejQuYwppbmRleCA0MjNlMWI3OTc2Zi4uNDNjNGI5MTg3ZWYg MTAwNjQ0Ci0tLSBhL3NyYy9iaW4vcGdfZHVtcC9jb21wcmVzc19sejQuYworKysgYi9zcmMv YmluL3BnX2R1bXAvY29tcHJlc3NfbHo0LmMKQEAgLTU4NCw2ICs1ODQsOCBAQCBMWjRTdHJl YW1fd3JpdGUoY29uc3Qgdm9pZCAqcHRyLCBzaXplX3Qgc2l6ZSwgQ29tcHJlc3NGaWxlSGFu ZGxlICpDRkgpCiAJCQllcnJubyA9IChlcnJubykgPyBlcnJubyA6IEVOT1NQQzsKIAkJCXJl dHVybiBmYWxzZTsKIAkJfQorCisJCXB0ciA9ICgoY2hhciAqKSBwdHIpICsgY2h1bms7CiAJ fQogCiAJcmV0dXJuIHRydWU7Cg== --------------KlEPLecfgPwt0ebUCTEo0V0f--