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 1lO7jJ-0004YH-Lv for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 23:43:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lO7jI-00081g-FB for pgsql-hackers@arkaria.postgresql.org; Sun, 21 Mar 2021 23:43: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 1lO7jI-00081Z-43 for pgsql-hackers@lists.postgresql.org; Sun, 21 Mar 2021 23:43:32 +0000 Received: from mail-il1-x12b.google.com ([2607:f8b0:4864:20::12b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lO7jE-0006tS-2t for pgsql-hackers@lists.postgresql.org; Sun, 21 Mar 2021 23:43:31 +0000 Received: by mail-il1-x12b.google.com with SMTP id v3so13255079ilj.12 for ; Sun, 21 Mar 2021 16:43:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=n9gy2VQpDjJJ8ODDuvH/HBgF0Fyf7yxlVep4Rc5XLoc=; b=fvU0n79YWxZMJtiednwxtCBbAuo29YEI3OrRSPo7bJFZUCsUJ/6CNYGOvMUYgK93rD yZXznp1w4sYaq7sAmpJN/zeXUu7tjtbeFsqRfl0BtJIP0culZW/m6DZ59ViXa0lrHY0v Qas9e+Y3hUgc9pQ5FtnU0GzbTIOiBU1vF8groBdJY3KygVJEij88tWEm1slGgVNwIX9D fhSSCNug93loirQT9l6wOSQkPYkBENp9ORoDlMfzbsk84GcDEPxNqw4snUYitvTlFA+O AjgZiSwmy7Ijx+0jO1QWjZayi9+/lhEl52oKHe2FoJpyMqvt88BO2vUemfY7LpTsYHk7 KY0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=n9gy2VQpDjJJ8ODDuvH/HBgF0Fyf7yxlVep4Rc5XLoc=; b=OdR7G+vfCGfgX9N6uQlHQSPw35cALoxJl0lqcGBNhPIFQOp9NKAKk9y09xcpqZYP+8 mM1oORjCjF7alpByLXPJzyZC1NmqTcD0GS40rDRNqsSy7nu8N1xboBBucLE8oG4Ibdbf vwBgD9sNYgorH8GsqrRDkbFIxMB1rD2Ub6RYh9q0vK7VzpVknagdnFE9XF7aR0ZtfZuq T9dkeK4cidECGP9p75G6bTJe7L0HF5uyqdGehN0vyBIQi2jV26tzJHdLsM4KjZyEi50a h+v12dxfF80XrOfa1qGa0WcuAEBn4H4iGcYc9F6n+4QYKNUb8pyqlquXXtNkN6W8+BWo 0+cA== X-Gm-Message-State: AOAM5319sSnFBZHrJrWA/E6YCLyQS7sQma6peB5O+Os8TUXXmasD4D4j IU4O4e4yFrJ1/4kd+Npl5CBIyQ== X-Google-Smtp-Source: ABdhPJwq4yTSL43ko6V3XZIgNWwvHVeR8HLD92gThzZwNZdXWTY4p3UMn5P1LT5bb7BfSvlmNC3KjQ== X-Received: by 2002:a05:6e02:1a65:: with SMTP id w5mr4181206ilv.5.1616370206520; Sun, 21 Mar 2021 16:43:26 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id x24sm6535633iob.28.2021.03.21.16.43.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Mar 2021 16:43:26 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 13649800941; Sun, 21 Mar 2021 18:43:25 -0500 (CDT) Date: Sun, 21 Mar 2021 18:43:24 -0500 From: Justin Pryzby To: Tom Lane Cc: Dilip Kumar , Robert Haas , Andres Freund , Tomas Vondra , Alexander Korotkov , David Steele , Ildus Kurbangaliev , Dmitry Dolgov <9erthalion6@gmail.com>, Andrey Borodin , PostgreSQL Hackers Subject: Re: [HACKERS] Custom compression methods (mac+lz4.h) Message-ID: <20210321234324.GC4203@telsasoft.com> References: <301730.1616276227@sss.pgh.pa.us> <20210320231957.GX11765@telsasoft.com> <309337.1616287493@sss.pgh.pa.us> <311370.1616290403@sss.pgh.pa.us> <414943.1616358751@sss.pgh.pa.us> <20210321204148.GB4203@telsasoft.com> <456616.1616360715@sss.pgh.pa.us> <504396.1616368310@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <504396.1616368310@sss.pgh.pa.us> 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 Sun, Mar 21, 2021 at 07:11:50PM -0400, Tom Lane wrote: > I wrote: > > Justin Pryzby writes: > >> On Sun, Mar 21, 2021 at 04:32:31PM -0400, Tom Lane wrote: > >>> This seems somewhat repeatable (three identical failures in three > >>> attempts). Not sure why I did not see it yesterday; but anyway, > >>> there is something wrong with partial detoasting for LZ4. > > >> With what version of LZ4 ? > > > RHEL8's, which is > > lz4-1.8.3-2.el8.x86_64 > > I hate to be the bearer of bad news, but this suggests that > LZ4_decompress_safe_partial is seriously broken in 1.9.2 > as well: > > https://github.com/lz4/lz4/issues/783 Ouch > Maybe we cannot rely on that function for a few more years yet. > > Also, I don't really understand why this code: > > /* slice decompression not supported prior to 1.8.3 */ > if (LZ4_versionNumber() < 10803) > return lz4_decompress_datum(value); > > It seems likely to me that we'd get a flat out build failure > from library versions lacking LZ4_decompress_safe_partial, > and thus that this run-time test is dead code and we should > better be using a configure probe if we intend to allow old > liblz4 versions. Though that might be moot. The function existed before 1.8.3, but didn't handle slicing. https://github.com/lz4/lz4/releases/tag/v1.8.3 |Finally, an existing function, LZ4_decompress_safe_partial(), has been enhanced to make it possible to decompress only the beginning of an LZ4 block, up to a specified number of bytes. Partial decoding can be useful to save CPU time and memory, when the objective is to extract a limited portion from a larger block. Possibly we could allow v >= 1.9.3 || (ver >= 1.8.3 && ver < 1.9.2). Or maybe not: the second half apparently worked "by accident", and we shouldn't need to have intimate knowledge of someone else's patchlevel releases, -- Justin